diff options
Diffstat (limited to 'system_cmds/passwd.tproj')
-rw-r--r-- | system_cmds/passwd.tproj/Makefile | 8 | ||||
-rw-r--r-- | system_cmds/passwd.tproj/passwd.c | 11 |
2 files changed, 10 insertions, 9 deletions
diff --git a/system_cmds/passwd.tproj/Makefile b/system_cmds/passwd.tproj/Makefile new file mode 100644 index 0000000..7dcc91f --- /dev/null +++ b/system_cmds/passwd.tproj/Makefile @@ -0,0 +1,8 @@ +PROG= passwd +MAN= passwd.1 +SRCS= file_passwd.c nis_passwd.c od_passwd.c \ + pam_passwd.c passwd.c + +LDADD+=-lcrypt + +.include <bsd.prog.mk> diff --git a/system_cmds/passwd.tproj/passwd.c b/system_cmds/passwd.tproj/passwd.c index 877036e..663a40d 100644 --- a/system_cmds/passwd.tproj/passwd.c +++ b/system_cmds/passwd.tproj/passwd.c @@ -30,6 +30,7 @@ #include <libc.h> #include <ctype.h> #include <string.h> +#include <crypt.h> #include "passwd.h" #ifdef __SLICK__ @@ -50,7 +51,6 @@ getpasswd(char *name, int isroot, int minlen, int mixcase, int nonalpha, char *p; static char obuf[_PASSWORD_LEN+1]; static char nbuf[_PASSWORD_LEN+1]; - char salt[9]; printf("Changing password for %s.\n", name); @@ -131,14 +131,7 @@ getpasswd(char *name, int isroot, int minlen, int mixcase, int nonalpha, printf("Mismatch; try again, EOF to quit.\n"); } - /* - * Create a random salt - */ - srandom((int)time((time_t *)NULL)); - salt[0] = saltchars[random() % strlen(saltchars)]; - salt[1] = saltchars[random() % strlen(saltchars)]; - salt[2] = '\0'; - *new_pw = crypt(nbuf, salt); + *new_pw = crypt(nbuf, crypt_gensalt("$6$", 0, saltchars, strlen(saltchars))); *old_clear = obuf; *new_clear = nbuf; |