From: Todd C. Miller Date: Mon, 19 Oct 1998 18:32:39 +0000 (+0000) Subject: new dunix shadow code, use dispcrypt(3) X-Git-Tag: SUDO_1_5_7~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d92a1bb92b4a9b10df321c8f3d01f5b889f6f18;p=sudo new dunix shadow code, use dispcrypt(3) --- diff --git a/getspwuid.c b/getspwuid.c index 01fc57aa1..e9546a58b 100644 --- a/getspwuid.c +++ b/getspwuid.c @@ -50,9 +50,6 @@ static char rcsid[] = "$Id$"; #include #include #include -#include "sudo.h" - -/* Shadow password includes */ #ifdef HAVE_GETSPNAM # include #endif /* HAVE_GETSPNAM */ @@ -73,6 +70,8 @@ static char rcsid[] = "$Id$"; # include #endif /* HAVE_GETAUTHUID */ +#include "sudo.h" + #ifndef STDC_HEADERS #ifndef __GNUC__ /* gcc has its own malloc */ extern char *malloc __P((size_t)); @@ -145,11 +144,8 @@ static char *sudo_getepw(pw_ent) if (spw_ent != NULL && spw_ent->ufld.fd_encrypt != NULL) { # ifdef __alpha crypt_type = spw_ent -> ufld.fd_oldcrypt; -# ifdef AUTH_CRYPT_C1CRYPT - if (crypt_type != AUTH_CRYPT_C1CRYPT) -# endif /* AUTH_CRYPT_C1CRYPT */ # endif /* __alpha */ - return(spw_ent -> ufld.fd_encrypt); + return(spw_ent -> ufld.fd_encrypt); } } #endif /* HAVE_GETPRPWUID */ diff --git a/secureware.c b/secureware.c index e5c7974e9..47c6fca89 100644 --- a/secureware.c +++ b/secureware.c @@ -59,55 +59,29 @@ static char rcsid[] = "$Id$"; #include "sudo.h" -/* - * Globals - */ -#ifdef __alpha -extern int crypt_type; -#endif /* __alpha */ - /******************************************************************** * * check_secureware() * * This function checks a password against the user's encrypted one - * using the SecureWare crypt functions. + * using the SecureWare crypt functions. Returns 1 on a match, else 0. */ int check_secureware(pass) char *pass; { -#ifndef __alpha -# ifdef HAVE_BIGCRYPT +#ifdef __alpha + extern int crypt_type; + + if (crypt_type != -1 && + strcmp(user_passwd, dispcrypt(pass, user_passwd, crypt_type)) == 0) + return(1); +#elif defined(HAVE_BIGCRYPT) if (strcmp(user_passwd, bigcrypt(pass, user_passwd)) == 0) return(1); -# endif /* HAVE_BIGCRYPT */ -#else /* __alpha */ - switch (crypt_type) { - case AUTH_CRYPT_BIGCRYPT: - if (!strcmp(user_passwd, bigcrypt(pass, user_passwd))) - return(1); - break; - case AUTH_CRYPT_CRYPT16: - if (!strcmp(user_passwd, crypt16(pass, user_passwd))) - return(1); - break; -# ifdef AUTH_CRYPT_OLDCRYPT - case AUTH_CRYPT_OLDCRYPT: - case AUTH_CRYPT_C1CRYPT: -# endif - case -1: - if (!strcmp(user_passwd, crypt(pass, user_passwd))) - return(1); - break; - default: - (void) fprintf(stderr, - "%s: Sorry, I don't know how to deal with crypt type %d.\n", - Argv[0], crypt_type); - exit(1); - } - return(0); #endif /* __alpha */ + + return(0); } #endif /* HAVE_GETPRPWUID */ diff --git a/tgetpass.c b/tgetpass.c index 8e9e25fd0..a6c4d01e5 100644 --- a/tgetpass.c +++ b/tgetpass.c @@ -70,7 +70,12 @@ static char rcsid[] = "$Id$"; #endif /* HAVE_TERMIO_H */ #endif /* HAVE_TERMIOS_H */ #ifdef HAVE_GETPRPWUID -#include /* for AUTH_MAX_PASSWD_LENGTH */ +# ifdef __hpux +# include +# else +# include +# endif /* __hpux */ +# include /* for AUTH_MAX_PASSWD_LENGTH */ #endif /* HAVE_GETPRPWUID */ #include