summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Basch <probe@mit.edu>1994-12-28 22:08:02 +0000
committerRichard Basch <probe@mit.edu>1994-12-28 22:08:02 +0000
commitff67d69e64b9a643ae32efe17861b75f22e64b04 (patch)
tree5a7d8f5e671aa04dfe72e68e47664e9b873ea221 /src
parent2caae83b06c2eac2b1e153f952c5bfc3db536fcb (diff)
downloadkrb5-ff67d69e64b9a643ae32efe17861b75f22e64b04.tar.gz
krb5-ff67d69e64b9a643ae32efe17861b75f22e64b04.tar.xz
krb5-ff67d69e64b9a643ae32efe17861b75f22e64b04.zip
Corrected logic for shadow password tests
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4775 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/appl/bsd/login.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/appl/bsd/login.c b/src/appl/bsd/login.c
index e46bff6bb..8e968d4bd 100644
--- a/src/appl/bsd/login.c
+++ b/src/appl/bsd/login.c
@@ -534,14 +534,14 @@ main(argc, argv)
checknologin();
/*
- * Disallow automatic login to root; if not invoked by
- * root, disallow if the uid's differ.
+ * Disallow automatic login to root.
+ * If not invoked by root, disallow if the uid's differ.
*/
if (fflag && pwd) {
int uid = (int) getuid();
- passwd_req = pwd->pw_uid == 0 ||
- (uid && uid != pwd->pw_uid);
+ passwd_req =
+ (pwd->pw_uid == 0 || (uid && uid != pwd->pw_uid));
}
/*
@@ -551,17 +551,20 @@ main(argc, argv)
if (Fflag && pwd) {
int uid = (int) getuid();
- passwd_req = uid && uid != pwd->pw_uid;
+ passwd_req = (uid && uid != pwd->pw_uid);
}
/*
* If no remote login authentication and a password exists
* for this user, prompt for one and verify it.
*/
- if (!passwd_req || pwd && !*(pwd->pw_passwd))
+ if (!passwd_req) break;
#ifdef HAVE_SHADOW
- if (spwd && !*(spwd->sp_pwdp))
+ if (spwd) {
+ if (!*(spwd->sp_pwdp)) break;
+ } else
#endif
+ if (pwd && !*(pwd->pw_passwd))
break;
#ifdef KRB4
@@ -677,14 +680,16 @@ bad_login:
#ifdef HAVE_SETPRIORITY
(void) setpriority(PRIO_PROCESS, 0, -4 + PRIO_OFFSET);
#endif
- p = crypt(getpass("password:"), salt);
+ p = crypt(getpass("Password:"), salt);
#ifdef HAVE_SETPRIORITY
(void) setpriority(PRIO_PROCESS, 0, 0 + PRIO_OFFSET);
#endif
- if (pwd && !strcmp(p, pwd->pw_passwd))
#ifdef HAVE_SHADOW
- if (spwd && !strcmp(p, spwd->sp_pwdp))
+ if (spwd && !strcmp(p, spwd->sp_pwdp))
+ break;
+ else
#endif
+ if (pwd && !strcmp(p, pwd->pw_passwd))
break;
#endif /* KRB4 */