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)
This commit is contained in:
parent
02c629d468
commit
078ae588ab
@ -203,7 +203,11 @@ ensure octal interpretation.
|
||||
.Sh AUTHENTICATION
|
||||
.Bl -column minpasswordlen indent indent
|
||||
.It Sy "Name Type Notes Description
|
||||
.It "login_prompt string The login prompt given by
|
||||
.Xr login 1
|
||||
.It "minpasswordlen number 6 The minimum length a local password may be.
|
||||
.It "passwd_prompt string The password prompt presented by
|
||||
.Xr login 1
|
||||
.It "passwd_format string md5 The encryption format that new or
|
||||
changed passwords will use.
|
||||
Valid values include "des", "md5" and "blf".
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user