diff options
author | Damien Miller <djm@mindrot.org> | 1999-10-27 23:42:05 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 1999-10-27 23:42:05 +1000 |
commit | 332e67fde27c4017d2df8dafe05a55be3c7597cd (patch) | |
tree | 3c973d134c785a840e2f0c56aea886d8fa6f6b96 /auth-passwd.c | |
parent | 726a5b3be128911d2f38f73a6a8c9be6dde9bb3a (diff) |
Attempt to clean up PAM code
Use PWDB getpw* functions if HAVE_PWDB defined
Minor other tidyups
Diffstat (limited to 'auth-passwd.c')
-rw-r--r-- | auth-passwd.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/auth-passwd.c b/auth-passwd.c index 7d6846789..61f66fedd 100644 --- a/auth-passwd.c +++ b/auth-passwd.c | |||
@@ -15,7 +15,7 @@ the password is valid for the user. | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | RCSID("$Id: auth-passwd.c,v 1.1 1999/10/27 03:42:43 damien Exp $"); | 18 | RCSID("$Id: auth-passwd.c,v 1.2 1999/10/27 13:42:05 damien Exp $"); |
19 | 19 | ||
20 | #include "packet.h" | 20 | #include "packet.h" |
21 | #include "ssh.h" | 21 | #include "ssh.h" |
@@ -26,14 +26,6 @@ RCSID("$Id: auth-passwd.c,v 1.1 1999/10/27 03:42:43 damien Exp $"); | |||
26 | extern char *ticket; | 26 | extern char *ticket; |
27 | #endif /* KRB4 */ | 27 | #endif /* KRB4 */ |
28 | 28 | ||
29 | #ifdef HAVE_PAM | ||
30 | #include <security/pam_appl.h> | ||
31 | extern pam_handle_t *pamh; | ||
32 | extern int retval; | ||
33 | extern char* pampasswd; | ||
34 | extern int origretval; | ||
35 | #endif /* HAVE_PAM */ | ||
36 | |||
37 | /* Tries to authenticate the user using password. Returns true if | 29 | /* Tries to authenticate the user using password. Returns true if |
38 | authentication succeeds. */ | 30 | authentication succeeds. */ |
39 | 31 | ||
@@ -58,26 +50,6 @@ int auth_password(struct passwd *pw, const char *password) | |||
58 | if (pw == NULL) | 50 | if (pw == NULL) |
59 | return 0; | 51 | return 0; |
60 | 52 | ||
61 | #ifdef HAVE_PAM | ||
62 | retval = origretval; | ||
63 | |||
64 | pampasswd = xstrdup(password); | ||
65 | |||
66 | if (retval == PAM_SUCCESS) | ||
67 | retval = pam_authenticate ((pam_handle_t *)pamh, 0); | ||
68 | |||
69 | if (retval == PAM_SUCCESS) | ||
70 | retval = pam_acct_mgmt ((pam_handle_t *)pamh, 0); | ||
71 | |||
72 | xfree(pampasswd); | ||
73 | |||
74 | if (retval == PAM_SUCCESS) | ||
75 | retval = pam_open_session ((pam_handle_t *)pamh, 0); | ||
76 | |||
77 | return (retval == PAM_SUCCESS); | ||
78 | |||
79 | #else /* HAVE_PAM */ | ||
80 | |||
81 | #ifdef SKEY | 53 | #ifdef SKEY |
82 | if (options.skey_authentication == 1) { | 54 | if (options.skey_authentication == 1) { |
83 | if (strncasecmp(password, "s/key", 5) == 0) { | 55 | if (strncasecmp(password, "s/key", 5) == 0) { |
@@ -205,5 +177,4 @@ int auth_password(struct passwd *pw, const char *password) | |||
205 | 177 | ||
206 | /* Authentication is accepted if the encrypted passwords are identical. */ | 178 | /* Authentication is accepted if the encrypted passwords are identical. */ |
207 | return (strcmp(encrypted_password, pw->pw_passwd) == 0); | 179 | return (strcmp(encrypted_password, pw->pw_passwd) == 0); |
208 | #endif /* HAVE_PAM */ | ||
209 | } | 180 | } |