summaryrefslogtreecommitdiff
path: root/security/PAM/patches/patch-ap
blob: aa5d3f25ba0b4622e481894e52e9911fffca3dfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
$NetBSD: patch-ap,v 1.2 2002/01/29 17:10:11 jlam Exp $

--- modules/pam_unix/support.c.orig	Sun Feb 11 01:33:53 2001
+++ modules/pam_unix/support.c
@@ -12,7 +12,10 @@
 #include <string.h>
 #include <malloc.h>
 #include <pwd.h>
+#include <sys/param.h>
+#ifndef BSD
 #include <shadow.h>
+#endif
 #include <limits.h>
 #include <utmp.h>
 
@@ -111,6 +114,9 @@
    */
 char *PAM_getlogin(void)
 {
+#ifdef BSD
+	return getlogin();
+#else
 	struct utmp *ut, line;
 	char *curr_tty, *retval;
 	static char curr_user[sizeof(ut->ut_user) + 4];
@@ -132,6 +138,7 @@
 	D(("PAM_getlogin retval: %s", retval));
 
 	return retval;
+#endif
 }
 
 /*
@@ -330,6 +337,7 @@
 	pwd = getpwnam(name);	/* Get password file entry... */
 
 	if (pwd != NULL) {
+#ifndef BSD
 		if (strcmp( pwd->pw_passwd, "*NP*" ) == 0)
 		{ /* NIS+ */                 
 			uid_t save_euid, save_uid;
@@ -367,6 +375,7 @@
 		if (spwdent)
 			salt = x_strdup(spwdent->sp_pwdp);
 		else
+#endif
 			salt = x_strdup(pwd->pw_passwd);
 	}
 	/* Does this user have a password? */
@@ -481,6 +490,7 @@
 	pwd = getpwnam(name);	/* Get password file entry... */
 
 	if (pwd != NULL) {
+#ifndef BSD	
 		if (strcmp( pwd->pw_passwd, "*NP*" ) == 0)
 		{ /* NIS+ */                 
 			uid_t save_euid, save_uid;
@@ -498,7 +508,7 @@
 						return PAM_CRED_INSUFFICIENT;
 				}
 			}
-	
+
 			spwdent = getspnam( name );
 			if (save_uid == pwd->pw_uid)
 				setreuid( save_uid, save_euid );
@@ -517,6 +527,7 @@
 		if (spwdent)
 			salt = x_strdup(spwdent->sp_pwdp);
 		else
+#endif
 			salt = x_strdup(pwd->pw_passwd);
 	}