aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Weingärtner <timo@tiwe.de>2013-05-10 21:27:56 +0200
committerTimo Weingärtner <timo@tiwe.de>2013-05-12 18:44:18 +0200
commit88dd2b1a22cd06fc401a8ddadd41114cebe159d5 (patch)
tree8f5e911e36bf06ef96ae33d1b76f61f350baceb6
parent138c589dd4cdf68659bfa643e5659fa1200f6081 (diff)
downloadlibpam-pwdfile-88dd2b1a22cd06fc401a8ddadd41114cebe159d5.tar.gz
include proper headers for crypt()
this also prepares for crypt_r()
-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