]> granicus.if.org Git - sudo/commitdiff
new dunix shadow code, use dispcrypt(3)
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 19 Oct 1998 18:32:39 +0000 (18:32 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 19 Oct 1998 18:32:39 +0000 (18:32 +0000)
getspwuid.c
secureware.c
tgetpass.c

index 01fc57aa166b84382547350c55a6a14ff0785ade..e9546a58bbad0ea9b9b1f05b39323919b783375b 100644 (file)
@@ -50,9 +50,6 @@ static char rcsid[] = "$Id$";
 #include <sys/param.h>
 #include <netinet/in.h>
 #include <pwd.h>
-#include "sudo.h"
-
-/* Shadow password includes */
 #ifdef HAVE_GETSPNAM
 #  include <shadow.h>
 #endif /* HAVE_GETSPNAM */
@@ -73,6 +70,8 @@ static char rcsid[] = "$Id$";
 #  include <auth.h>
 #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 */
index e5c7974e91cdae65038e650f953f71db6484a2df..47c6fca89222bc67a80c27bcd527ef3d063d85bb 100644 (file)
@@ -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 */
index 8e9e25fd0651524401e26ef99f0b87b39c7c8875..a6c4d01e5f46104f98f55e808ff7a0d61913ef37 100644 (file)
@@ -70,7 +70,12 @@ static char rcsid[] = "$Id$";
 #endif /* HAVE_TERMIO_H */
 #endif /* HAVE_TERMIOS_H */
 #ifdef HAVE_GETPRPWUID
-#include <prot.h>                      /* for AUTH_MAX_PASSWD_LENGTH */
+#  ifdef __hpux
+#    include <hpsecurity.h>
+#  else
+#    include <sys/security.h>
+#  endif /* __hpux */
+#  include <prot.h>                    /* for AUTH_MAX_PASSWD_LENGTH */
 #endif /* HAVE_GETPRPWUID */
 
 #include <pathnames.h>