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'.
This commit is contained in:
parent
f3d640240b
commit
53152fc9db
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user