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
75
76
77
78
79
|
$NetBSD: patch-ar,v 1.4 2003/05/16 17:30:59 wiz Exp $
--- modules/pam_unix/support.c.orig Mon Sep 23 13:33:22 2002
+++ modules/pam_unix/support.c
@@ -6,13 +6,17 @@
#define _BSD_SOURCE
+#include "../../_pam_aconf.h"
+
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <malloc.h>
#include <pwd.h>
+#ifdef HAVE_SHADOW_H
#include <shadow.h>
+#endif
#include <limits.h>
#include <utmp.h>
#include <errno.h>
@@ -113,6 +117,12 @@ int _make_remark(pam_handle_t * pamh, un
*/
char *PAM_getlogin(void)
{
+#ifdef USE_GETLOGIN
+ char *retval = NULL;
+ retval = getlogin();
+ D(("PAM_getlogin retval: %s", retval));
+ return retval;
+#else
struct utmp *ut, line;
char *curr_tty, *retval;
static char curr_user[sizeof(ut->ut_user) + 4];
@@ -135,6 +145,7 @@ char *PAM_getlogin(void)
D(("PAM_getlogin retval: %s", retval));
return retval;
+#endif
}
/*
@@ -358,6 +369,7 @@ int _unix_blankpasswd(unsigned int ctrl,
#endif
if (pwd != NULL) {
+#ifdef HAVE_GETSPNAM
if (strcmp( pwd->pw_passwd, "*NP*" ) == 0)
{ /* NIS+ */
uid_t save_euid, save_uid;
@@ -400,6 +412,9 @@ int _unix_blankpasswd(unsigned int ctrl,
salt = x_strdup(spwdent->sp_pwdp);
else
salt = x_strdup(pwd->pw_passwd);
+#else
+ salt = x_strdup(pwd->pw_passwd);
+#endif
}
/* Does this user have a password? */
if (salt == NULL) {
@@ -535,6 +550,7 @@ int _unix_verify_password(pam_handle_t *
pwd = getpwnam(name); /* Get password file entry... */
if (pwd != NULL) {
+#ifdef HAVE_GETSPNAM
if (strcmp( pwd->pw_passwd, "*NP*" ) == 0)
{ /* NIS+ */
uid_t save_euid, save_uid;
@@ -572,6 +588,9 @@ int _unix_verify_password(pam_handle_t *
salt = x_strdup(spwdent->sp_pwdp);
else
salt = x_strdup(pwd->pw_passwd);
+#else
+ salt = x_strdup(pwd->pw_passwd);
+#endif
}
data_name = (char *) malloc(sizeof(FAIL_PREFIX) + strlen(name));
|