From: Douglas Lankshear Date: Wed, 22 Jul 1998 08:21:10 +0000 (-0700) Subject: support optional crypt() with PERL_OBJECT X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ff95b63ed9e9faabe3ba15c12a39c2c97a712ee9;p=p5sagit%2Fp5-mst-13.2.git support optional crypt() with PERL_OBJECT Message-Id: <000701bdb584$5b57c070$a32fa8c0@tau.Active> Subject: [PATCH 5.005 maybe] for crypt with PERL_OBJECT p4raw-id: //depot/perl@1641 --- diff --git a/iperlsys.h b/iperlsys.h index 0c93fd8..91389a2 100644 --- a/iperlsys.h +++ b/iperlsys.h @@ -634,6 +634,7 @@ class IPerlProc { public: virtual void Abort(void) = 0; + virtual char * Crypt(const char* clear, const char* salt) = 0; virtual void Exit(int status) = 0; virtual void _Exit(int status) = 0; virtual int Execl(const char *cmdname, const char *arg0, @@ -671,6 +672,7 @@ public: }; #define PerlProc_abort() PL_piProc->Abort() +#define PerlProc_crypt(c,s) PL_piProc->Crypt((c), (s)) #define PerlProc_exit(s) PL_piProc->Exit((s)) #define PerlProc__exit(s) PL_piProc->_Exit((s)) #define PerlProc_execl(c, w, x, y, z) \ @@ -713,6 +715,7 @@ public: #else /* PERL_OBJECT */ #define PerlProc_abort() abort() +#define PerlProc_crypt(c,s) crypt((c), (s)) #define PerlProc_exit(s) exit((s)) #define PerlProc__exit(s) _exit((s)) #define PerlProc_execl(c,w,x,y,z) \ diff --git a/pp.c b/pp.c index 5e32613..4eb8f2f 100644 --- a/pp.c +++ b/pp.c @@ -2105,7 +2105,7 @@ PP(pp_crypt) #ifdef FCRYPT sv_setpv(TARG, fcrypt(tmps, SvPV(right, PL_na))); #else - sv_setpv(TARG, crypt(tmps, SvPV(right, PL_na))); + sv_setpv(TARG, PerlProc_crypt(tmps, SvPV(right, PL_na))); #endif #else DIE( diff --git a/win32/Makefile b/win32/Makefile index 811e32f..e33cb91 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -68,7 +68,7 @@ INST_VER = \5.005 # # if you have the source for des_fcrypt(), uncomment this and make sure the # file exists (see README.win32). File should be located in the same -# directory as this file. Not (yet) supported with PERL_OBJECT. +# directory as this file. # #CRYPT_SRC = des_fcrypt.c diff --git a/win32/makefile.mk b/win32/makefile.mk index 57813aa..249c0aa 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -76,7 +76,7 @@ CCTYPE *= BORLAND # # if you have the source for des_fcrypt(), uncomment this and make sure the # file exists (see README.win32). File should be located in the same -# directory as this file. Not (yet) supported with PERL_OBJECT. +# directory as this file. # #CRYPT_SRC *= des_fcrypt.c diff --git a/win32/perlhost.h b/win32/perlhost.h index e2d8ca7..842d9c3 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -468,6 +468,10 @@ public: { win32_abort(); }; + virtual char * Crypt(const char* clear, const char* salt) + { + return win32_crypt(clear, salt); + }; virtual void Exit(int status) { exit(status); diff --git a/win32/win32.c b/win32/win32.c index 970fc3f..03a9bd8 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1162,14 +1162,20 @@ win32_alarm(unsigned int sec) return 0; } +#if defined(HAVE_DES_FCRYPT) || defined(PERL_OBJECT) #ifdef HAVE_DES_FCRYPT extern char * des_fcrypt(char *cbuf, const char *txt, const char *salt); +#endif DllExport char * win32_crypt(const char *txt, const char *salt) { +#ifdef HAVE_DES_FCRYPT dTHR; return des_fcrypt(crypt_buffer, txt, salt); +#else + die("The crypt() function is unimplemented due to excessive paranoia."); +#endif } #endif diff --git a/win32/win32iop.h b/win32/win32iop.h index cf2bd75..12fe63e 100644 --- a/win32/win32iop.h +++ b/win32/win32iop.h @@ -127,7 +127,7 @@ DllExport int win32_wait(int *status); DllExport int win32_waitpid(int pid, int *status, int flags); DllExport int win32_kill(int pid, int sig); -#ifdef HAVE_DES_FCRYPT +#if defined(HAVE_DES_FCRYPT) || defined(PERL_OBJECT) DllExport char * win32_crypt(const char *txt, const char *salt); #endif