* $Source: /usr/src/kerberosIV/des/RCS/read_password.c,v $
* Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
* For copying and distribution information, please see the file
* This routine prints the supplied string to standard
* output as a prompt, and reads a password string without
static char rcsid_read_password_c
[] =
"$Header: /usr/src/kerberosIV/des/RCS/read_password.c,v 4.13 90/06/23 03:09:35 kfall Exp $";
#include <mit-copyright.h>
des_read_password(k
, prompt
, verify
)
char key_string
[_PASSWORD_LEN
];
ok
= des_read_pw_string(key_string
, _PASSWORD_LEN
, prompt
, verify
);
des_string_to_key(key_string
, k
);
bzero(key_string
, sizeof (key_string
));
* This version just returns the string, doesn't map to key.
* Returns 0 on success, non-zero on failure.
des_read_pw_string(s
, max
, prompt
, verify
)
register int len
= MIN(_PASSWORD_LEN
, max
);
char *ptr
= getpass(prompt
);
(void)strncpy(s
, ptr
, len
);
while (strncmp(getpass(prompt
), s
, len
) != 0) {
printf("\n\07\07Mismatch - try again\n");
s
[len
-1] = '\0'; /* just in case */