aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/factotum/confirm.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-02-13 05:58:45 +0000
committerrsc <devnull@localhost>2005-02-13 05:58:45 +0000
commit0f8ec41b0ae522b73085fa1662461e6351ba7e54 (patch)
tree2d54cfd8208bdd903273ccc7df889677cf7fe8d5 /src/cmd/factotum/confirm.c
parent7637c81af02c49ef508b946dfdec39f757a658d4 (diff)
downloadplan9port-0f8ec41b0ae522b73085fa1662461e6351ba7e54.tar.gz
plan9port-0f8ec41b0ae522b73085fa1662461e6351ba7e54.tar.bz2
plan9port-0f8ec41b0ae522b73085fa1662461e6351ba7e54.zip
moving to auth
Diffstat (limited to 'src/cmd/factotum/confirm.c')
-rw-r--r--src/cmd/factotum/confirm.c139
1 files changed, 0 insertions, 139 deletions
diff --git a/src/cmd/factotum/confirm.c b/src/cmd/factotum/confirm.c
deleted file mode 100644
index 8f492450..00000000
--- a/src/cmd/factotum/confirm.c
+++ /dev/null
@@ -1,139 +0,0 @@
-#include "std.h"
-#include "dat.h"
-
-Logbuf confbuf;
-
-void
-confirmread(Req *r)
-{
- lbread(&confbuf, r);
-}
-
-void
-confirmflush(Req *r)
-{
- lbflush(&confbuf, r);
-}
-
-int
-confirmwrite(char *s)
-{
- char *t, *ans;
- int allow;
- ulong tag;
- Attr *a;
- Conv *c;
-
- a = _parseattr(s);
- if(a == nil){
- werrstr("bad attr");
- return -1;
- }
- if((t = _strfindattr(a, "tag")) == nil){
- werrstr("no tag");
- return -1;
- }
- tag = strtoul(t, 0, 0);
- if((ans = _strfindattr(a, "answer")) == nil){
- werrstr("no answer");
- return -1;
- }
- if(strcmp(ans, "yes") == 0)
- allow = 1;
- else if(strcmp(ans, "no") == 0)
- allow = 0;
- else{
- werrstr("bad answer");
- return -1;
- }
- for(c=conv; c; c=c->next){
- if(tag == c->tag){
- nbsendul(c->keywait, allow);
- break;
- }
- }
- if(c == nil){
- werrstr("tag not found");
- return -1;
- }
- return 0;
-}
-
-int
-confirmkey(Conv *c, Key *k)
-{
- if(*confirminuse == 0)
- return -1;
-
- lbappend(&confbuf, "confirm tag=%lud %A %N", c->tag, k->attr, k->privattr);
- c->state = "keyconfirm";
- return recvul(c->keywait);
-}
-
-Logbuf needkeybuf;
-
-void
-needkeyread(Req *r)
-{
- lbread(&needkeybuf, r);
-}
-
-void
-needkeyflush(Req *r)
-{
- lbflush(&needkeybuf, r);
-}
-
-int
-needkeywrite(char *s)
-{
- char *t;
- ulong tag;
- Attr *a;
- Conv *c;
-
- a = _parseattr(s);
- if(a == nil){
- werrstr("empty write");
- return -1;
- }
- if((t = _strfindattr(a, "tag")) == nil){
- werrstr("no tag");
- freeattr(a);
- return -1;
- }
- tag = strtoul(t, 0, 0);
- for(c=conv; c; c=c->next)
- if(c->tag == tag){
- nbsendul(c->keywait, 0);
- break;
- }
- if(c == nil){
- werrstr("tag not found");
- freeattr(a);
- return -1;
- }
- freeattr(a);
- return 0;
-}
-
-int
-needkey(Conv *c, Attr *a)
-{
- if(c == nil || *needkeyinuse == 0)
- return -1;
-
- lbappend(&needkeybuf, "needkey tag=%lud %A", c->tag, a);
- return nbrecvul(c->keywait);
-}
-
-int
-badkey(Conv *c, Key *k, char *msg, Attr *a)
-{
- if(c == nil || *needkeyinuse == 0)
- return -1;
-
- lbappend(&needkeybuf, "badkey tag=%lud %A %N\n%s\n%A",
- c->tag, k->attr, k->privattr, msg, a);
- return nbrecvul(c->keywait);
-}