summaryrefslogtreecommitdiff
path: root/sys/src/cmd/auth
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-02-22 20:55:51 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2016-02-22 20:55:51 +0100
commit95d6ca9f3c05283057f1542f3af37c8741cbc11b (patch)
treede4d08e98c8afe6e02cbd53bc6b6115db04b3508 /sys/src/cmd/auth
parent4410517b44fd2610abe0dcd1349bb3e6b3c5ddb8 (diff)
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.
Diffstat (limited to 'sys/src/cmd/auth')
-rw-r--r--sys/src/cmd/auth/factotum/p9any.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/src/cmd/auth/factotum/p9any.c b/sys/src/cmd/auth/factotum/p9any.c
index 367f6b4d2..9bc0b467d 100644
--- a/sys/src/cmd/auth/factotum/p9any.c
+++ b/sys/src/cmd/auth/factotum/p9any.c
@@ -318,7 +318,7 @@ p9anywrite(Fsstate *fss, void *va, uint n)
ret = findkey(&k, &ki, "proto=%q dom=%q role=speakfor %s",
p->name, dom, p->keyprompt);
}
- if(ret == RpcFailure){
+ if(ret != RpcOk && ret != RpcConfirm){
ki.attr = anew;
ki.user = fss->sysuser;
ret = findkey(&k, &ki,
@@ -327,6 +327,8 @@ p9anywrite(Fsstate *fss, void *va, uint n)
}
if(ret == RpcConfirm){
free(a);
+ _freeattr(anew);
+ _freeattr(anewsf);
return ret;
}
if(ret == RpcOk)