diff options
author | joerg <joerg@FreeBSD.org> | 1999-03-30 10:23:35 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1999-03-30 10:23:35 +0000 |
commit | ae5a3098bca353a4104d0c4d55464206b850883f (patch) | |
tree | a4d58b910d4ce8648ef18dac6c8d10b23fa685c7 /libexec | |
parent | 9895dfa31e2d611f2cc28d6a7d3e951ba52df44c (diff) | |
download | FreeBSD-src-ae5a3098bca353a4104d0c4d55464206b850883f.zip FreeBSD-src-ae5a3098bca353a4104d0c4d55464206b850883f.tar.gz |
Ignore empty usernames, and repeat the login: prompt in this case.
There's not much point in having uucpd behave differently than
login(1) for this, and now uucpd is compatible to the default chat
script of Taylor UUCP which sends a single \r at first.
While i was at it, added a few strategic ``errno = 0;''s, so at least
an `Undefined error 0' will be returned for things like a closed
connection while reading the login ID or password, as opposed to an
even more bogus thing like `No such file or directory'.
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/uucpd/uucpd.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c index 1e6281f..59a6932 100644 --- a/libexec/uucpd/uucpd.c +++ b/libexec/uucpd/uucpd.c @@ -45,7 +45,7 @@ static const char copyright[] = static char sccsid[] = "@(#)uucpd.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id: uucpd.c,v 1.14 1997/12/04 07:20:45 charnier Exp $"; + "$Id: uucpd.c,v 1.15 1998/06/30 15:19:51 bde Exp $"; #endif /* not lint */ /* @@ -150,11 +150,14 @@ void doit(struct sockaddr_in *sinp) int pwdok =0; alarm(60); - printf("login: "); fflush(stdout); - if (readline(user, sizeof user, 0) < 0) { - syslog(LOG_WARNING, "login read: %m"); - _exit(1); - } + do { + printf("login: "); fflush(stdout); + errno = 0; + if (readline(user, sizeof user, 0) < 0) { + syslog(LOG_WARNING, "login read: %m"); + _exit(1); + } + } while (user[0] == '\0'); /* truncate username to LOGNAMESIZE characters */ user[LOGNAMESIZE] = '\0'; pw = getpwnam(user); @@ -171,6 +174,7 @@ void doit(struct sockaddr_in *sinp) /* always ask for passwords to deter account guessing */ if (!pwdok || (pw->pw_passwd && *pw->pw_passwd != '\0')) { printf("Password: "); fflush(stdout); + errno = 0; if (readline(passwd, sizeof passwd, 1) < 0) { syslog(LOG_WARNING, "passwd read: %m"); _exit(1); |