diff options
| author | Charles.Forsyth <devnull@localhost> | 2008-03-04 13:50:55 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2008-03-04 13:50:55 +0000 |
| commit | 89e4c40ea5a3bbe61d66cd110d1cabd03086d222 (patch) | |
| tree | 37575ed80eaf9c0e1ca8080b72c058e2fe0342d3 /appl/cmd/auth | |
| parent | 7ba4ff5becea2074955758024f3418d6ac79860f (diff) | |
20080304-1358
Diffstat (limited to 'appl/cmd/auth')
| -rw-r--r-- | appl/cmd/auth/secstore.b | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/appl/cmd/auth/secstore.b b/appl/cmd/auth/secstore.b index 5a63b78d..9cb731ee 100644 --- a/appl/cmd/auth/secstore.b +++ b/appl/cmd/auth/secstore.b @@ -9,6 +9,9 @@ include "sys.m"; include "draw.m"; +include "dial.m"; + dial: Dial; + include "bufio.m"; bufio: Bufio; Iobuf: import bufio; @@ -37,6 +40,7 @@ init(nil: ref Draw->Context, args: list of string) sys = load Sys Sys->PATH; bufio = load Bufio Bufio->PATH; secstore = load Secstore Secstore->PATH; + dial = load Dial Dial->PATH; sys->pctl(Sys->FORKFD, nil); stderr = sys->fildes(2); @@ -108,7 +112,7 @@ Auth: filekey = secstore->mkfilekey(pass); for(i := 0; i < len pass; i++) pass[i] = 0; # clear it - conn = secstore->dial(netmkaddr(addr, "net", "secstore")); + conn = secstore->dial(dial->netmkaddr(addr, "net", "secstore")); if(conn == nil) error(sys->sprint("can't connect to secstore: %r")); (srvname, diag) := secstore->auth(conn, user, seckey); @@ -300,18 +304,3 @@ readfile(f: string): string return ""; return string buf[0:n]; } - -netmkaddr(addr, net, svc: string): string -{ - if(net == nil) - net = "net"; - (n, nil) := sys->tokenize(addr, "!"); - if(n <= 1){ - if(svc== nil) - return sys->sprint("%s!%s", net, addr); - return sys->sprint("%s!%s!%s", net, addr, svc); - } - if(svc == nil || n > 2) - return addr; - return sys->sprint("%s!%s", addr, svc); -} |
