Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 May 2001 23:54:06 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        current@freebsd.org
Subject:   PATCH: /usr/src/usr.bin/login
Message-ID:  <200105162355.QAA27838@usr01.primenet.com>

next in thread | raw e-mail | index | archive | help
This patch adds the "prompt" and "passwd_prompt" fields to the
/etc/login.conf, which makes lgoin more like getty in its ability
to be configured.

Sorry, no documentation at this time, and no support for "%h" and
other getty psecific things.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.
---------------------------------
RCS file: /home/cvs/FreeBSD/src/usr.bin/login/login.c,v
retrieving revision 1.51.2.5
diff -u -r1.51.2.5 login.c
--- login.c	2001/02/13 13:05:20	1.51.2.5
+++ login.c	2001/05/17 00:28:57
@@ -116,6 +116,8 @@
 #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
@@ -128,7 +130,7 @@
 
 struct	passwd *pwd;
 int	failures;
-char	*term, *envinit[1], *hostname, *username, *tty;
+char	*term, *envinit[1], *hostname, *username, *tty, *prompt, passwd_prompt;
 char    full_hostname[MAXHOSTNAMELEN];
 #ifndef NO_PAM
 static char **environ_pam;
@@ -257,6 +259,8 @@
 	 * 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);
@@ -651,7 +655,7 @@
 	rval = 1;
 	salt = pwd != NULL ? pwd->pw_passwd : "xx";
 
-	p = getpass("Password:");
+	p = getpass(passwd_prompt);
 	ep = crypt(p, salt);
 
 	if (pwd) {
@@ -819,7 +823,7 @@
 	static char nbuf[NBUFSIZ];
 
 	for (;;) {
-		(void)printf("login: ");
+		(void)printf(prompt);
 		for (p = nbuf; (ch = getchar()) != '\n'; ) {
 			if (ch == EOF) {
 				badlogin(username);
---------------------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105162355.QAA27838>