aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>1999-03-30 10:23:35 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>1999-03-30 10:23:35 +0000
commit53152fc9dbcfd3a3c559583578ee30910bc9fb53 (patch)
tree243eccbd91740df502d9ec41ca421b30317b5c2c /libexec
parentf3d640240bb2989a4a344d3cafbf2d8041fa2840 (diff)
downloadsrc-53152fc9dbcfd3a3c559583578ee30910bc9fb53.tar.gz
src-53152fc9dbcfd3a3c559583578ee30910bc9fb53.zip
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'.
Notes
Notes: svn path=/head/; revision=45146
Diffstat (limited to 'libexec')
-rw-r--r--libexec/uucpd/uucpd.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c
index 1e6281f9d0b1..59a69320b022 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);