diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-21 20:36:19 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-21 20:36:19 +0200 |
commit | 809522e80f4011925e8d92aa480fad04c7ff9e10 (patch) | |
tree | 61d77af9eb0d08c3e272dd55f520c684d0bae9cb | |
parent | f6dbd3d99325352b80e2ff6b0d13e8a1557369cb (diff) | |
download | plan9front-809522e80f4011925e8d92aa480fad04c7ff9e10.tar.xz |
auth/changeuser: set the aes key in plan9 database, but not in securenet db
-rw-r--r-- | sys/src/cmd/auth/changeuser.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/src/cmd/auth/changeuser.c b/sys/src/cmd/auth/changeuser.c index aebf14b10..e40572769 100644 --- a/sys/src/cmd/auth/changeuser.c +++ b/sys/src/cmd/auth/changeuser.c @@ -82,9 +82,11 @@ main(int argc, char *argv[]) if(answer[0] != 'y' && answer[0] != 'Y') newkey = 0; } - if(newkey) + if(newkey){ + memset(&key, 0, sizeof(key)); for(i=0; i<DESKEYLEN; i++) key.des[i] = nrand(256); + } if(a.user == 0){ t = getexpiration(f->keys, u); newbio = querybio(f->who, u, &a); @@ -117,11 +119,8 @@ install(char *db, char *u, Authkey *key, long t, int newkey) } if(newkey){ - sprint(buf, "%s/%s/key", db, u); - fd = open(buf, OWRITE); - if(fd < 0 || write(fd, key->des, DESKEYLEN) != DESKEYLEN) + if(!setkey(db, u, key)) error("can't set key: %r"); - close(fd); } if(t == -1) |