From d366d09e6bd42c8ab82264f975167be2ed9815a5 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 1 Sep 1994 01:56:15 +0000 Subject: [PATCH] added osf auth support & removed some extra spaces --- check.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/check.c b/check.c index 86ab84278..811503f1f 100644 --- a/check.c +++ b/check.c @@ -64,6 +64,10 @@ static char rcsid[] = "$Id$"; #ifdef __svr4__ #include #endif /* __svr4__ */ +#if defined(__osf__) && defined(HAVE_C2_SECURITY) +#include +#include +#endif /* __osf__ && HAVE_C2_SECURITY */ #if defined(ultrix) && defined(HAVE_C2_SECURITY) #include #endif /* ultrix && HAVE_C2_SECURITY */ @@ -265,13 +269,16 @@ static void check_passwd() #ifdef __svr4__ struct spwd *spw_ent; #endif /* __svr4__ */ -#if defined (__hpux) && defined(HAVE_C2_SECURITY) +#if defined(__hpux) && defined(HAVE_C2_SECURITY) struct s_passwd *spw_ent; #endif /* __hpux && HAVE_C2_SECURITY */ -#if defined (ultrix) && defined(HAVE_C2_SECURITY) +#if defined(__osf__) && defined(HAVE_C2_SECURITY) + struct pr_passwd *spw_ent; +#endif /* __osf__ && HAVE_C2_SECURITY */ +#if defined(ultrix) && defined(HAVE_C2_SECURITY) AUTHORIZATION *spw_ent; #endif /* ultrix && HAVE_C2_SECURITY */ -#if defined (__convex__) && defined(HAVE_C2_SECURITY) +#if defined(__convex__) && defined(HAVE_C2_SECURITY) char salt[2]; /* Need the salt to perform the encryption */ register int i; struct pr_passwd *spw_ent; @@ -280,7 +287,7 @@ static void check_passwd() char *pass; /* this is what gets entered */ register int counter = TRIES_FOR_PASSWORD; -#if defined (__hpux) && defined(HAVE_C2_SECURITY) +#if defined(__hpux) && defined(HAVE_C2_SECURITY) /* * grab encrypted password from shadow pw file * or just use the regular one... @@ -291,7 +298,19 @@ static void check_passwd() if (spw_ent && spw_ent -> pw_passwd) encrypted = spw_ent -> pw_passwd; #endif /* __hpux && HAVE_C2_SECURITY */ -#if defined (ultrix) && defined(HAVE_C2_SECURITY) +#if defined(__osf__) && defined(HAVE_C2_SECURITY) + /* + * grab encrypted password from protected passwd file + * or just use the regular one... + */ + be_root(); + (void) set_auth_parameters(); + spw_ent = getprpwuid(uid); + be_user(); + if (spw_ent && spw_ent -> ufld) + encrypted = spw_ent -> ufld.fd_encrypt; +#endif /* __osf__ && HAVE_C2_SECURITY */ +#if defined(ultrix) && defined(HAVE_C2_SECURITY) /* * grab encrypted password from /etc/auth * or just use the regular one... @@ -318,7 +337,7 @@ static void check_passwd() } encrypted = spw_ent -> sp_pwdp; #endif /* __svr4__ */ -#if defined (__convex__) && defined(HAVE_C2_SECURITY) +#if defined(__convex__) && defined(HAVE_C2_SECURITY) /* * Convex with C2 security */ @@ -345,13 +364,13 @@ static void check_passwd() #endif /* USE_GETPASS */ if (!pass || *pass == '\0') exit(0); -#if defined (__convex__) && defined(HAVE_C2_SECURITY) +#if defined(__convex__) && defined(HAVE_C2_SECURITY) strncpy(salt, spw_ent->ufld.fd_encrypt, 2); i = AUTH_SALT_SIZE + AUTH_CIPHERTEXT_SEG_CHARS; if (strncmp(encrypted, crypt(pass, salt), i) == 0) return; /* if the passwd is correct return() */ #else -#if defined (ultrix) && defined(HAVE_C2_SECURITY) +#if defined(ultrix) && defined(HAVE_C2_SECURITY) if (spw_ent && !strcmp(encrypted, (char *) crypt16(pass, encrypted))) return; /* if the passwd is correct return() */ #endif /* ultrix && HAVE_C2_SECURITY */