From: Todd C. Miller Date: Sun, 19 Nov 1995 23:23:46 +0000 (+0000) Subject: fixed SKey support X-Git-Tag: SUDO_1_4_0~121 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53ae703b75a76fed2f2da529c9481e20fd5a6ce9;p=sudo fixed SKey support --- diff --git a/check.c b/check.c index 4e9d2bb37..664d5d678 100644 --- a/check.c +++ b/check.c @@ -473,8 +473,7 @@ static void check_passwd() # endif /* SECUREWARE */ #endif /* SHADOW_TYPE */ #ifdef HAVE_SKEY - int pw_ok = 1; - struct passwd *pw_ent = getpwuid(uid); + struct passwd *pw_ent; #endif /* HAVE_SKEY */ char *encrypted=epasswd; /* this comes from /etc/passwd */ #if defined(HAVE_KERB4) && defined(USE_GETPASS) @@ -543,9 +542,14 @@ static void check_passwd() /* * you get TRIES_FOR_PASSWORD times to guess your password */ +#ifdef HAVE_SKEY + pw_ent = getpwuid(uid); +#endif /* HAVE_SKEY */ while (counter > 0) { #ifdef HAVE_SKEY - pass = skey_getpass(prompt, pw_ent, pw_ok); + set_perms(PERM_ROOT); + pass = skey_getpass(prompt, pw_ent, 1); + set_perms(PERM_USER); #else # ifdef USE_GETPASS # ifdef HAVE_KERB4 @@ -581,9 +585,13 @@ static void check_passwd() #endif /* SHADOW_TYPE */ #ifdef HAVE_SKEY + set_perms(PERM_ROOT); if (!strcmp(pw_ent->pw_passwd, skey_crypt(pass, pw_ent->pw_passwd, - pw_ent, pw_ok))) + pw_ent, 0))) { + set_perms(PERM_USER); return; /* if the passwd is correct return() */ + } + set_perms(PERM_USER); #else if (!strcmp(encrypted, (char *) crypt(pass, encrypted))) return; /* if the passwd is correct return() */