new dunix shadow code, use dispcrypt(3)
This commit is contained in:
@@ -50,9 +50,6 @@ static char rcsid[] = "$Id$";
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include "sudo.h"
|
|
||||||
|
|
||||||
/* Shadow password includes */
|
|
||||||
#ifdef HAVE_GETSPNAM
|
#ifdef HAVE_GETSPNAM
|
||||||
# include <shadow.h>
|
# include <shadow.h>
|
||||||
#endif /* HAVE_GETSPNAM */
|
#endif /* HAVE_GETSPNAM */
|
||||||
@@ -73,6 +70,8 @@ static char rcsid[] = "$Id$";
|
|||||||
# include <auth.h>
|
# include <auth.h>
|
||||||
#endif /* HAVE_GETAUTHUID */
|
#endif /* HAVE_GETAUTHUID */
|
||||||
|
|
||||||
|
#include "sudo.h"
|
||||||
|
|
||||||
#ifndef STDC_HEADERS
|
#ifndef STDC_HEADERS
|
||||||
#ifndef __GNUC__ /* gcc has its own malloc */
|
#ifndef __GNUC__ /* gcc has its own malloc */
|
||||||
extern char *malloc __P((size_t));
|
extern char *malloc __P((size_t));
|
||||||
@@ -145,9 +144,6 @@ static char *sudo_getepw(pw_ent)
|
|||||||
if (spw_ent != NULL && spw_ent->ufld.fd_encrypt != NULL) {
|
if (spw_ent != NULL && spw_ent->ufld.fd_encrypt != NULL) {
|
||||||
# ifdef __alpha
|
# ifdef __alpha
|
||||||
crypt_type = spw_ent -> ufld.fd_oldcrypt;
|
crypt_type = spw_ent -> ufld.fd_oldcrypt;
|
||||||
# ifdef AUTH_CRYPT_C1CRYPT
|
|
||||||
if (crypt_type != AUTH_CRYPT_C1CRYPT)
|
|
||||||
# endif /* AUTH_CRYPT_C1CRYPT */
|
|
||||||
# endif /* __alpha */
|
# endif /* __alpha */
|
||||||
return(spw_ent -> ufld.fd_encrypt);
|
return(spw_ent -> ufld.fd_encrypt);
|
||||||
}
|
}
|
||||||
|
46
secureware.c
46
secureware.c
@@ -59,55 +59,29 @@ static char rcsid[] = "$Id$";
|
|||||||
#include "sudo.h"
|
#include "sudo.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Globals
|
|
||||||
*/
|
|
||||||
#ifdef __alpha
|
|
||||||
extern int crypt_type;
|
|
||||||
#endif /* __alpha */
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
*
|
*
|
||||||
* check_secureware()
|
* check_secureware()
|
||||||
*
|
*
|
||||||
* This function checks a password against the user's encrypted one
|
* 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)
|
int check_secureware(pass)
|
||||||
char *pass;
|
char *pass;
|
||||||
{
|
{
|
||||||
#ifndef __alpha
|
#ifdef __alpha
|
||||||
# ifdef HAVE_BIGCRYPT
|
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)
|
if (strcmp(user_passwd, bigcrypt(pass, user_passwd)) == 0)
|
||||||
return(1);
|
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 */
|
#endif /* __alpha */
|
||||||
|
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_GETPRPWUID */
|
#endif /* HAVE_GETPRPWUID */
|
||||||
|
@@ -70,6 +70,11 @@ static char rcsid[] = "$Id$";
|
|||||||
#endif /* HAVE_TERMIO_H */
|
#endif /* HAVE_TERMIO_H */
|
||||||
#endif /* HAVE_TERMIOS_H */
|
#endif /* HAVE_TERMIOS_H */
|
||||||
#ifdef HAVE_GETPRPWUID
|
#ifdef HAVE_GETPRPWUID
|
||||||
|
# ifdef __hpux
|
||||||
|
# include <hpsecurity.h>
|
||||||
|
# else
|
||||||
|
# include <sys/security.h>
|
||||||
|
# endif /* __hpux */
|
||||||
# include <prot.h> /* for AUTH_MAX_PASSWD_LENGTH */
|
# include <prot.h> /* for AUTH_MAX_PASSWD_LENGTH */
|
||||||
#endif /* HAVE_GETPRPWUID */
|
#endif /* HAVE_GETPRPWUID */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user