diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2003-01-21 20:55:56 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2003-01-21 20:55:56 +0000 |
commit | 9e5d6c002ca589fb2e767fc8bafd6ceddaa12d39 (patch) | |
tree | cc4bb2d87b27a82c93e46d0abc3f9ab8a3f3a232 /loginutils/login.c | |
parent | 4c51202b9dfe3df38e0a50bef9b66bd4cae39277 (diff) | |
download | busybox-9e5d6c002ca589fb2e767fc8bafd6ceddaa12d39.tar.gz |
run telnet from inetd, present login prompt if login is configured,
patch from Bastian Blank
Diffstat (limited to 'loginutils/login.c')
-rw-r--r-- | loginutils/login.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/loginutils/login.c b/loginutils/login.c index 4a7f13ae8..c1ea165c8 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -253,20 +253,18 @@ static int login_prompt ( char *buf_name ) int i; for(i=0; i<EMPTY_USERNAME_COUNT; i++) { - gethostname ( buf, sizeof( buf )); - printf ( "\n%s login: ", buf ); - fflush ( stdout ); + print_login_prompt(); + + if ( !fgets ( buf, sizeof( buf ) - 1, stdin )) + return 0; - if ( !fgets ( buf, sizeof( buf ) - 1, stdin )) - return 0; - if ( !strchr ( buf, '\n' )) - return 0; - - for ( sp = buf; isspace ( *sp ); sp++ ) { } - for ( ep = sp; isgraph ( *ep ); ep++ ) { } + return 0; + + for ( sp = buf; isspace ( *sp ); sp++ ) { } + for ( ep = sp; isgraph ( *ep ); ep++ ) { } - *ep = 0; + *ep = 0; safe_strncpy(buf_name, sp, USERNAME_SIZE); if(buf_name[0]) return 1; |