diff options
author | Russ Cox <rsc@swtch.com> | 2008-05-31 12:09:43 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2008-05-31 12:09:43 -0400 |
commit | 5f6612babbd9e6c0a4a204db0f9d2f286ec58261 (patch) | |
tree | 235cf74b64f811c96be1e8e267a06adab5038b54 /src/cmd/auth/factotum/conv.c | |
parent | 518f0a1d31c58266a12ee76c90180d66fde57bb4 (diff) | |
parent | 518f0a1d31c58266a12ee76c90180d66fde57bb4 (diff) | |
download | plan9port-5f6612babbd9e6c0a4a204db0f9d2f286ec58261.tar.gz plan9port-5f6612babbd9e6c0a4a204db0f9d2f286ec58261.tar.bz2 plan9port-5f6612babbd9e6c0a4a204db0f9d2f286ec58261.zip |
merge
Diffstat (limited to 'src/cmd/auth/factotum/conv.c')
-rw-r--r-- | src/cmd/auth/factotum/conv.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/cmd/auth/factotum/conv.c b/src/cmd/auth/factotum/conv.c index cd9d5045..1c92c06c 100644 --- a/src/cmd/auth/factotum/conv.c +++ b/src/cmd/auth/factotum/conv.c @@ -89,12 +89,14 @@ convgetrpc(Conv *c, int want) { for(;;){ if(c->hangup){ + flog("convgetrpc: hangup"); werrstr("hangup"); return nil; } if(c->rpc.op == RpcUnknown){ recvp(c->rpcwait); if(c->hangup){ + flog("convgetrpc: hangup"); werrstr("hangup"); return nil; } @@ -227,12 +229,27 @@ convneedkey(Conv *c, Attr *a) * in response. The keys get added out-of-band (via the * ctl file), so assume the key has been added when the * next request comes in. + * + * The convgetrpc seems dodgy, because we might be in + * the middle of an rpc, and what about the one that comes + * in later? It's all actually okay: convgetrpc is idempotent + * until rpcrespond is called, so if we're in the middle of an rpc, + * the first convgetrpc is a no-op, the rpcrespond sends back + * the needkey, and then the client repeats the rpc we're in + * the middle of. Otherwise, if we're not in the middle of an + * rpc, the first convgetrpc waits for one, we respond needkey, + * and then the second convgetrpc waits for another. Because + * there is no second response, eventually the caller will get + * around to asking for an rpc itself, at which point the already + * gotten rpc will be returned again. */ if(convgetrpc(c, -1) == nil) return -1; + flog("convneedkey %A", a); rpcrespond(c, "needkey %A", a); if(convgetrpc(c, -1) == nil) return -1; + flog("convneedkey returning"); return 0; } @@ -242,6 +259,7 @@ convbadkey(Conv *c, Key *k, char *msg, Attr *a) { if(convgetrpc(c, -1) == nil) return -1; + flog("convbadkey %A %N / %s / %A", k->attr, k->privattr, msg, a); rpcrespond(c, "badkey %A %N\n%s\n%A", k->attr, k->privattr, msg, a); if(convgetrpc(c, -1) == nil) |