| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #include <config.h> |
| |
| #ident "$Id$" |
| |
| #include <sys/types.h> |
| #include <stdio.h> |
| #include "prototypes.h" |
| #include "defines.h" |
| #include <pwd.h> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| bool valid (const char *password, const struct passwd *ent) |
| { |
| const char *encrypted; |
| const char *salt; |
| |
| |
| |
| |
| |
| |
| |
| |
| if ((NULL != ent->pw_name) && ('\0' == ent->pw_passwd[0])) { |
| if ('\0' == password[0]) { |
| return true; |
| } else { |
| return false; |
| } |
| } |
| |
| |
| |
| |
| |
| if ((NULL == ent->pw_name) || ('\0' == ent->pw_passwd[0])) { |
| salt = "xx"; |
| } else { |
| salt = ent->pw_passwd; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| encrypted = pw_encrypt (password, salt); |
| |
| |
| |
| |
| |
| |
| |
| if ( (NULL != ent->pw_name) |
| && (NULL != encrypted) |
| && (strcmp (encrypted, ent->pw_passwd) == 0)) { |
| return true; |
| } else { |
| return false; |
| } |
| } |
| |