summaryrefslogtreecommitdiffstats
path: root/usr.bin/login/login.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-05-18 04:55:16 +0000
committerobrien <obrien@FreeBSD.org>2001-05-18 04:55:16 +0000
commitde8cebdec8dd479da03e2676ff747fe62d75b2b3 (patch)
treec8b580a4dce129563932464cd3093ff7a73937e9 /usr.bin/login/login.c
parentb8425680b5070beb3b2a5ebb23e322eebebdebe5 (diff)
downloadFreeBSD-src-de8cebdec8dd479da03e2676ff747fe62d75b2b3.zip
FreeBSD-src-de8cebdec8dd479da03e2676ff747fe62d75b2b3.tar.gz
Add the "prompt" and "passwd_prompt" fields to /etc/login.conf,
which makes lgoin more like getty in its ability to be configured. Submitted by: tlambert (code only)
Diffstat (limited to 'usr.bin/login/login.c')
-rw-r--r--usr.bin/login/login.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index fb7cff2..877235b 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -129,6 +129,8 @@ static void usage __P((void));
#define TTYGRPNAME "tty" /* name of group to own ttys */
#define DEFAULT_BACKOFF 3
#define DEFAULT_RETRIES 10
+#define DEFAULT_PROMPT "login: "
+#define DEFAULT_PASSWD_PROMPT "Password:"
/*
* This bounds the time given to login. Not a define so it can
@@ -141,7 +143,7 @@ jmp_buf timeout_buf;
struct passwd *pwd;
int failures;
-char *term, *envinit[1], *hostname, *username, *tty;
+char *term, *envinit[1], *hostname, *passwd_prompt, *prompt, *tty, *username;
char full_hostname[MAXHOSTNAMELEN];
int
@@ -271,6 +273,9 @@ main(argc, argv)
* Get "login-retries" & "login-backoff" from default class
*/
lc = login_getclass(NULL);
+ prompt = login_getcapstr(lc, "prompt", DEFAULT_PROMPT, DEFAULT_PROMPT);
+ passwd_prompt = login_getcapstr(lc, "passwd_prompt",
+ DEFAULT_PASSWD_PROMPT, DEFAULT_PASSWD_PROMPT);
retries = login_getcapnum(lc, "login-retries", DEFAULT_RETRIES, DEFAULT_RETRIES);
backoff = login_getcapnum(lc, "login-backoff", DEFAULT_BACKOFF, DEFAULT_BACKOFF);
login_close(lc);
@@ -706,7 +711,7 @@ auth_traditional()
rval = 1;
salt = pwd != NULL ? pwd->pw_passwd : "xx";
- p = getpass("Password:");
+ p = getpass(passwd_prompt);
ep = crypt(p, salt);
if (pwd) {
@@ -884,7 +889,7 @@ getloginname()
static char nbuf[NBUFSIZ];
for (;;) {
- (void)printf("login: ");
+ (void)printf(prompt);
for (p = nbuf; (ch = getchar()) != '\n'; ) {
if (ch == EOF) {
badlogin(username);
OpenPOWER on IntegriCloud