aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/auth/factotum/secstore.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-05-31 12:09:43 -0400
committerRuss Cox <rsc@swtch.com>2008-05-31 12:09:43 -0400
commit5f6612babbd9e6c0a4a204db0f9d2f286ec58261 (patch)
tree235cf74b64f811c96be1e8e267a06adab5038b54 /src/cmd/auth/factotum/secstore.c
parent518f0a1d31c58266a12ee76c90180d66fde57bb4 (diff)
parent518f0a1d31c58266a12ee76c90180d66fde57bb4 (diff)
downloadplan9port-5f6612babbd9e6c0a4a204db0f9d2f286ec58261.tar.gz
plan9port-5f6612babbd9e6c0a4a204db0f9d2f286ec58261.tar.bz2
plan9port-5f6612babbd9e6c0a4a204db0f9d2f286ec58261.zip
merge
Diffstat (limited to 'src/cmd/auth/factotum/secstore.c')
-rw-r--r--src/cmd/auth/factotum/secstore.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/cmd/auth/factotum/secstore.c b/src/cmd/auth/factotum/secstore.c
index 315de0eb..c9009ee2 100644
--- a/src/cmd/auth/factotum/secstore.c
+++ b/src/cmd/auth/factotum/secstore.c
@@ -48,14 +48,17 @@ havesecstore(void)
if(fd < 0){
if(debug)
fprint(2, "secdial: %r\n");
+ flog("secdial: %r");
return 0;
}
if(write(fd, buf, n) != n || readn(fd, buf, 2) != 2){
+ flog("secstore: no count");
close(fd);
return 0;
}
n = ((buf[0]&0x7f)<<8) + buf[1];
if(n+1 > sizeof buf){
+ flog("secstore: bad count");
werrstr("implausibly large count %d", n);
close(fd);
return 0;
@@ -63,16 +66,23 @@ havesecstore(void)
m = readn(fd, buf, n);
close(fd);
if(m != n){
+ flog("secstore: unexpected eof");
if(m >= 0)
werrstr("short read from secstore");
return 0;
}
buf[n] = 0;
if(strcmp((char*)buf, "!account expired") == 0){
+ flog("secstore: account expired");
werrstr("account expired");
return 0;
}
- return strcmp((char*)buf, "!account exists") == 0;
+ if(strcmp((char*)buf, "!account exists") == 0){
+ flog("secstore: account exists");
+ return 1;
+ }
+ flog("secstore: %s", buf);
+ return 0;
}
/* delimited, authenticated, encrypted connection */
@@ -384,8 +394,10 @@ getfile(SConn *conn, uchar *key, int nkey)
if(q = strchr(p, '\n'))
*q++ = '\0';
n++;
- if(ctlwrite(p) < 0)
+ if(ctlwrite(p) < 0){
+ flog("secstore %s:%d: %r", gf, n);
fprint(2, "secstore(%s) line %d: %r\n", gf, n);
+ }
p = q;
}
free(buf);
@@ -636,6 +648,8 @@ secstorefetch(void)
rv = 0;
Out:
+ if(rv < 0)
+ flog("secstorefetch: %r");
if(conn)
conn->free(conn);
if(pass)