summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Lankshear <doug@lankshear.net>1998-07-22 01:21:10 -0700
committerGurusamy Sarathy <gsar@cpan.org>1998-07-22 17:11:55 +0000
commitff95b63ed9e9faabe3ba15c12a39c2c97a712ee9 (patch)
treed0e1b48c7548b219ab2f45e04f8771df7dbc3abc
parente9ee4811e9cb1e626e3ac1b3b595de5ded0d4121 (diff)
downloadperl-ff95b63ed9e9faabe3ba15c12a39c2c97a712ee9.tar.gz
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
-rw-r--r--iperlsys.h3
-rw-r--r--pp.c2
-rw-r--r--win32/Makefile2
-rw-r--r--win32/makefile.mk2
-rw-r--r--win32/perlhost.h4
-rw-r--r--win32/win32.c6
-rw-r--r--win32/win32iop.h2
7 files changed, 17 insertions, 4 deletions
diff --git a/iperlsys.h b/iperlsys.h
index 0c93fd8fad..91389a2b7b 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 5e32613ce7..4eb8f2f09f 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 811e32ffe1..e33cb9183a 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 57813aa0b3..249c0aad98 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 e2d8ca70cd..842d9c3275 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 970fc3f365..03a9bd8aa9 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 cf2bd75db5..12fe63e38f 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