factotum: fix memory leak for p9any key confirmation, fix key handling for role=client
when we look up role=speakfor key and askforkeys is set, the findkey() can return RpcNeedkey, which causes us to skip the query for a role=client key. Instead, we now check for the return value != RpcOk (and != RpcConfirm which we want to handle the same for both queries). we have to free the attribute lists when returning RpcConfirm.
This commit is contained in:
parent
4410517b44
commit
95d6ca9f3c
1 changed files with 3 additions and 1 deletions
|
@ -318,7 +318,7 @@ p9anywrite(Fsstate *fss, void *va, uint n)
|
||||||
ret = findkey(&k, &ki, "proto=%q dom=%q role=speakfor %s",
|
ret = findkey(&k, &ki, "proto=%q dom=%q role=speakfor %s",
|
||||||
p->name, dom, p->keyprompt);
|
p->name, dom, p->keyprompt);
|
||||||
}
|
}
|
||||||
if(ret == RpcFailure){
|
if(ret != RpcOk && ret != RpcConfirm){
|
||||||
ki.attr = anew;
|
ki.attr = anew;
|
||||||
ki.user = fss->sysuser;
|
ki.user = fss->sysuser;
|
||||||
ret = findkey(&k, &ki,
|
ret = findkey(&k, &ki,
|
||||||
|
@ -327,6 +327,8 @@ p9anywrite(Fsstate *fss, void *va, uint n)
|
||||||
}
|
}
|
||||||
if(ret == RpcConfirm){
|
if(ret == RpcConfirm){
|
||||||
free(a);
|
free(a);
|
||||||
|
_freeattr(anew);
|
||||||
|
_freeattr(anewsf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if(ret == RpcOk)
|
if(ret == RpcOk)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue