summaryrefslogtreecommitdiff
path: root/sys/src/cmd/disk
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-08-20 20:56:00 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-08-20 20:56:00 +0200
commite48a5832b26f817ab06db2d42f88288373b78fac (patch)
treed4523da2ba38368a46571d8b50e18602affdaf29 /sys/src/cmd/disk
parent167ea748f8b20a5940108ef5b23132310213e77e (diff)
kfs: adjust to new libauthsrv
Diffstat (limited to 'sys/src/cmd/disk')
-rw-r--r--sys/src/cmd/disk/kfs/auth.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/src/cmd/disk/kfs/auth.c b/sys/src/cmd/disk/kfs/auth.c
index 4d02c035f..e3872dea3 100644
--- a/sys/src/cmd/disk/kfs/auth.c
+++ b/sys/src/cmd/disk/kfs/auth.c
@@ -8,6 +8,7 @@
int allownone;
Nvrsafe nvr;
+Authkey authkey;
int didread;
/*
@@ -18,8 +19,10 @@ mkchallenge(Chan *cp)
{
int i;
- if(!didread && readnvram(&nvr, 0) >= 0)
+ if(!didread && readnvram(&nvr, 0) >= 0){
+ memmove(authkey.des, nvr.machkey, DESKEYLEN);
didread = 1;
+ }
srand(truerand());
for(i = 0; i < CHALLEN; i++)
@@ -58,14 +61,14 @@ authorize(Chan *cp, Oldfcall *in, Oldfcall *ou)
return 0;
/* decrypt and unpack ticket */
- convM2T(in->ticket, &t, nvr.machkey);
+ convM2T(in->ticket, sizeof(in->ticket), &t, &authkey);
if(t.num != AuthTs){
print("bad AuthTs num\n");
return 0;
}
/* decrypt and unpack authenticator */
- convM2A(in->auth, &a, t.key);
+ convM2A(in->auth, sizeof(in->auth), &a, &t);
if(a.num != AuthAc){
print("bad AuthAc num\n");
return 0;
@@ -110,7 +113,7 @@ print("names don't match\n");
/* craft a reply */
a.num = AuthAs;
memmove(a.chal, cp->rchal, CHALLEN);
- convA2M(&a, ou->rauth, t.key);
+ convA2M(&a, ou->rauth, sizeof(ou->rauth), &t);
cp->authed = 1;
return 1;