diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-07-31 20:09:47 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-07-31 20:09:47 +0200 |
commit | a75f4de5c9f1782b3a7e0a9648e24b360031a0d5 (patch) | |
tree | c2c956bcb49a31710835995b5ac1fdf0d68017a5 /sys/src/cmd/auth/secstore/secuser.c | |
parent | ae5fb4ab78d7dd776a056045f673129f5a1cc779 (diff) |
auth/secstore: use common readcons() routine from libauthsrv
Diffstat (limited to 'sys/src/cmd/auth/secstore/secuser.c')
-rw-r--r-- | sys/src/cmd/auth/secstore/secuser.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/src/cmd/auth/secstore/secuser.c b/sys/src/cmd/auth/secstore/secuser.c index e4cffb69c..2a1700e0f 100644 --- a/sys/src/cmd/auth/secstore/secuser.c +++ b/sys/src/cmd/auth/secstore/secuser.c @@ -2,6 +2,7 @@ #include <libc.h> #include <mp.h> #include <libsec.h> +#include <authsrv.h> #include "SConn.h" #include "secstore.h" @@ -71,28 +72,29 @@ main(int argc, char **argv) /* get main password for id */ for(;;){ if(isnew) - snprint(prompt, sizeof(prompt), "%s password: ", id); + snprint(prompt, sizeof(prompt), "%s password", id); else - snprint(prompt, sizeof(prompt), "%s password [default = don't change]: ", id); - pass = getpassm(prompt); + snprint(prompt, sizeof(prompt), "%s password [default = don't change]", id); + pass = readcons(prompt, nil, 1); if(pass == nil) - sysfatal("getpassm failed"); + sysfatal("password input aborted"); if(verbose) print("%ld characters\n", strlen(pass)); if(pass[0] == '\0' && isnew == 0) break; if(strlen(pass) >= 7) break; + memset(pass, 0, strlen(pass)); + free(pass); print("password must be at least 7 characters\n"); } if(pass[0] != '\0'){ - snprint(prompt, sizeof(prompt), "retype password: "); if(verbose) print("confirming...\n"); - passck = getpassm(prompt); + passck = readcons("retype password", nil, 1); if(passck == nil) - sysfatal("getpassm failed"); + sysfatal("password input aborted"); if(strcmp(pass, passck) != 0) sysfatal("passwords didn't match"); memset(passck, 0, strlen(passck)); |