auth/changeuser: set the aes key in plan9 database, but not in securenet db

This commit is contained in:
cinap_lenrek 2015-08-21 20:36:19 +02:00
parent f6dbd3d993
commit 809522e80f

View file

@ -82,9 +82,11 @@ main(int argc, char *argv[])
if(answer[0] != 'y' && answer[0] != 'Y') if(answer[0] != 'y' && answer[0] != 'Y')
newkey = 0; newkey = 0;
} }
if(newkey) if(newkey){
memset(&key, 0, sizeof(key));
for(i=0; i<DESKEYLEN; i++) for(i=0; i<DESKEYLEN; i++)
key.des[i] = nrand(256); key.des[i] = nrand(256);
}
if(a.user == 0){ if(a.user == 0){
t = getexpiration(f->keys, u); t = getexpiration(f->keys, u);
newbio = querybio(f->who, u, &a); newbio = querybio(f->who, u, &a);
@ -117,11 +119,8 @@ install(char *db, char *u, Authkey *key, long t, int newkey)
} }
if(newkey){ if(newkey){
sprint(buf, "%s/%s/key", db, u); if(!setkey(db, u, key))
fd = open(buf, OWRITE);
if(fd < 0 || write(fd, key->des, DESKEYLEN) != DESKEYLEN)
error("can't set key: %r"); error("can't set key: %r");
close(fd);
} }
if(t == -1) if(t == -1)