From ae5a3098bca353a4104d0c4d55464206b850883f Mon Sep 17 00:00:00 2001 From: joerg Date: Tue, 30 Mar 1999 10:23:35 +0000 Subject: 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'. --- libexec/uucpd/uucpd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'libexec/uucpd/uucpd.c') 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); -- cgit v1.1