diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-07-31 20:16:25 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-07-31 20:16:25 +0200 |
commit | 261e3190929acd3e8e00507894789a5575fb815f (patch) | |
tree | 8d877d68090967ed4231c457dabed6d64d8bc002 /sys/src/cmd/auth/netkey.c | |
parent | a75f4de5c9f1782b3a7e0a9648e24b360031a0d5 (diff) |
auth: various cleanups, use common readcons() from libauthsrv, zero keys after use
Diffstat (limited to 'sys/src/cmd/auth/netkey.c')
-rw-r--r-- | sys/src/cmd/auth/netkey.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/src/cmd/auth/netkey.c b/sys/src/cmd/auth/netkey.c index 30ac5602c..9a1a47ced 100644 --- a/sys/src/cmd/auth/netkey.c +++ b/sys/src/cmd/auth/netkey.c @@ -4,7 +4,6 @@ #include <bio.h> #include "authcmdlib.h" - void usage(void) { @@ -15,7 +14,7 @@ usage(void) void main(int argc, char *argv[]) { - char buf[32], pass[32], key[DESKEYLEN]; + char buf[32], key[DESKEYLEN], *pass; char *s; int n; @@ -27,13 +26,18 @@ main(int argc, char *argv[]) usage(); s = getenv("service"); - if(s && strcmp(s, "cpu") == 0){ + if(s != nil && strcmp(s, "cpu") == 0){ fprint(2, "netkey must not be run on the cpu server\n"); exits("boofhead"); } + private(); - readln("Password: ", pass, sizeof pass, 1); + pass = readcons("Password", nil, 1); + if(pass == nil) + exits("no password"); passtodeskey(key, pass); + memset(pass, 0, strlen(pass)); + free(pass); for(;;){ print("challenge: "); |