diff options
author | rsc <devnull@localhost> | 2005-02-13 05:59:29 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-02-13 05:59:29 +0000 |
commit | 6e527fbc4d8f404a7eec934e5c9efaaaa92ffdff (patch) | |
tree | 4d9ed63c88e5a8dd8a4d5bd3582e7d5e6a24065f /src/cmd/auth/factotum/plan9.c | |
parent | 0f8ec41b0ae522b73085fa1662461e6351ba7e54 (diff) | |
download | plan9port-6e527fbc4d8f404a7eec934e5c9efaaaa92ffdff.tar.gz plan9port-6e527fbc4d8f404a7eec934e5c9efaaaa92ffdff.tar.bz2 plan9port-6e527fbc4d8f404a7eec934e5c9efaaaa92ffdff.zip |
new auth
Diffstat (limited to 'src/cmd/auth/factotum/plan9.c')
-rw-r--r-- | src/cmd/auth/factotum/plan9.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/cmd/auth/factotum/plan9.c b/src/cmd/auth/factotum/plan9.c new file mode 100644 index 00000000..0b6bb601 --- /dev/null +++ b/src/cmd/auth/factotum/plan9.c @@ -0,0 +1,45 @@ +#include "std.h" +#include "dat.h" +#include <bio.h> + +int +memrandom(void *p, int n) +{ + uchar *cp; + + for(cp = (uchar*)p; n > 0; n--) + *cp++ = fastrand(); + return 0; +} + +Attr* +addcap(Attr *a, char *from, Ticket *t) +{ + return addattr(a, "cuid=%q suid=%q cap=''", t->cuid, t->suid); +} + +int +_authdial(char *net, char *authdom) +{ + return authdial(net, authdom); +} + +Key* +plan9authkey(Attr *a) +{ + char *dom; + Key *k; + + /* + * The only important part of a is dom. + * We don't care, for example, about user name. + */ + dom = strfindattr(a, "dom"); + if(dom) + k = keylookup("proto=p9sk1 role=server user? dom=%q", dom); + else + k = keylookup("proto=p9sk1 role=server user? dom?"); + if(k == nil) + werrstr("could not find plan 9 auth key dom %q", dom); + return k; +} |