aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bigcrypt.c5
-rw-r--r--bigcrypt.h1
-rw-r--r--pam_pwdfile.c15
3 files changed, 17 insertions, 4 deletions
diff --git a/bigcrypt.c b/bigcrypt.c
index 28d042a..c1486fa 100644
--- a/bigcrypt.c
+++ b/bigcrypt.c
@@ -24,10 +24,11 @@
* Andy Phillips <atp@mssl.ucl.ac.uk>
*/
+#define _XOPEN_SOURCE
+#include <unistd.h>
#include <string.h>
-char *crypt(const char *key, const char *salt);
-char *bigcrypt(const char *key, const char *salt);
+#include "bigcrypt.h"
/*
* Max cleartext password length in segments of 8 characters this
diff --git a/bigcrypt.h b/bigcrypt.h
new file mode 100644
index 0000000..a66a96e
--- /dev/null
+++ b/bigcrypt.h
@@ -0,0 +1 @@
+extern char *bigcrypt(const char *key, const char *salt);
diff --git a/pam_pwdfile.c b/pam_pwdfile.c
index 80cd893..34ce78d 100644
--- a/pam_pwdfile.c
+++ b/pam_pwdfile.c
@@ -42,6 +42,18 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef USE_CRYPT_R
+#define _GNU_SOURCE
+#include <crypt.h>
+#else
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 700
+#endif
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#endif
+
#include <features.h>
#include <syslog.h>
#include <stdio.h>
@@ -62,8 +74,7 @@
#include <security/pam_ext.h>
#include "md5.h"
-extern char *crypt(const char *key, const char *salt);
-extern char *bigcrypt(const char *key, const char *salt);
+#include "bigcrypt.h"
#define CRYPTED_DESPWD_LEN 13
#define CRYPTED_MD5PWD_LEN 34