summaryrefslogtreecommitdiffstats
path: root/src/cmd/factotum/plan9.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-02-11 16:56:15 +0000
committerrsc <devnull@localhost>2005-02-11 16:56:15 +0000
commit2e397eb47c87e78b4a9e2f4a550be4792bd05fa2 (patch)
tree696a69f20b422623857dc00cf309791db2d346e7 /src/cmd/factotum/plan9.c
parent3889d01d4b0d7a0c5e32ba81fb3c7e01094b8884 (diff)
downloadplan9port-2e397eb47c87e78b4a9e2f4a550be4792bd05fa2.tar.gz
plan9port-2e397eb47c87e78b4a9e2f4a550be4792bd05fa2.zip
bug fixes; add secstore
Diffstat (limited to 'src/cmd/factotum/plan9.c')
-rw-r--r--src/cmd/factotum/plan9.c85
1 files changed, 2 insertions, 83 deletions
diff --git a/src/cmd/factotum/plan9.c b/src/cmd/factotum/plan9.c
index 048c1906..36082c3b 100644
--- a/src/cmd/factotum/plan9.c
+++ b/src/cmd/factotum/plan9.c
@@ -15,7 +15,7 @@ memrandom(void *p, int n)
/*
* create a change uid capability
*/
-static int caphashfd;
+static int caphashfd = -1;
static char*
mkcap(char *from, char *to)
@@ -84,17 +84,7 @@ bindnetcs(void)
int
_authdial(char *net, char *authdom)
{
- int vanilla;
-
- vanilla = net==nil || strcmp(net, "/net")==0;
-
- if(!vanilla || bindnetcs()>=0)
- return authdial(net, authdom);
-
- /* use the auth sever passed to us as an arg */
- if(authaddr == nil)
- return -1;
- return dial(netmkaddr(authaddr, "tcp", "567"), 0, 0, 0);
+ return authdial(net, authdom);
}
Key*
@@ -116,74 +106,3 @@ plan9authkey(Attr *a)
werrstr("could not find plan 9 auth key dom %q", dom);
return k;
}
-
-/*
- * prompt for a string with a possible default response
- */
-char*
-readcons(char *prompt, char *def, int raw)
-{
- int fdin, fdout, ctl, n;
- char line[10];
- char *s;
-
- fdin = open("/dev/cons", OREAD);
- if(fdin < 0)
- fdin = 0;
- fdout = open("/dev/cons", OWRITE);
- if(fdout < 0)
- fdout = 1;
- if(def != nil)
- fprint(fdout, "%s[%s]: ", prompt, def);
- else
- fprint(fdout, "%s: ", prompt);
- if(raw){
- ctl = open("/dev/consctl", OWRITE);
- if(ctl >= 0)
- write(ctl, "rawon", 5);
- } else
- ctl = -1;
- s = estrdup("");
- for(;;){
- n = read(fdin, line, 1);
- if(n == 0){
- Error:
- close(fdin);
- close(fdout);
- if(ctl >= 0)
- close(ctl);
- free(s);
- return nil;
- }
- if(n < 0)
- goto Error;
- if(line[0] == 0x7f)
- goto Error;
- if(n == 0 || line[0] == '\n' || line[0] == '\r'){
- if(raw){
- write(ctl, "rawoff", 6);
- write(fdout, "\n", 1);
- }
- close(ctl);
- close(fdin);
- close(fdout);
- if(*s == 0 && def != nil)
- s = estrappend(s, "%s", def);
- return s;
- }
- if(line[0] == '\b'){
- if(strlen(s) > 0)
- s[strlen(s)-1] = 0;
- } else if(line[0] == 0x15) { /* ^U: line kill */
- if(def != nil)
- fprint(fdout, "\n%s[%s]: ", prompt, def);
- else
- fprint(fdout, "\n%s: ", prompt);
-
- s[0] = 0;
- } else {
- s = estrappend(s, "%c", line[0]);
- }
- }
- return nil; /* not reached */
-}