ref: 809522e80f4011925e8d92aa480fad04c7ff9e10
parent: f6dbd3d99325352b80e2ff6b0d13e8a1557369cb
author: cinap_lenrek <[email protected]>
date: Fri Aug 21 16:36:19 EDT 2015
auth/changeuser: set the aes key in plan9 database, but not in securenet db
--- a/sys/src/cmd/auth/changeuser.c
+++ b/sys/src/cmd/auth/changeuser.c
@@ -82,9 +82,11 @@
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 @@
}
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)