summaryrefslogtreecommitdiff
path: root/sys/src/libauth
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-01-06 03:09:00 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2016-01-06 03:09:00 +0100
commit2dae1ed53a73d81bfb86778793a6bda265d5140d (patch)
treee037c4a663fc9d17906cc2045c488232ac223ece /sys/src/libauth
parente064752dd476b7a2f76567f8cc15f9c2645e5d3d (diff)
auth: release dp9ik implementation and reentrant factotum
Diffstat (limited to 'sys/src/libauth')
-rw-r--r--sys/src/libauth/auth_userpasswd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/src/libauth/auth_userpasswd.c b/sys/src/libauth/auth_userpasswd.c
index e113d83a4..b5a2c89a9 100644
--- a/sys/src/libauth/auth_userpasswd.c
+++ b/sys/src/libauth/auth_userpasswd.c
@@ -11,13 +11,13 @@
* this was copied from inet's guard.
*/
static void
-netresp(Authkey *key, long chal, char *answer)
+netresp(char key[DESKEYLEN], long chal, char *answer)
{
uchar buf[8];
memset(buf, 0, sizeof buf);
snprint((char *)buf, sizeof buf, "%lud", chal);
- if(encrypt(key->des, buf, 8) < 0)
+ if(encrypt(key, buf, 8) < 0)
abort();
sprint(answer, "%.8ux", buf[0]<<24 | buf[1]<<16 | buf[2]<<8 | buf[3]);
}
@@ -25,8 +25,7 @@ netresp(Authkey *key, long chal, char *answer)
AuthInfo*
auth_userpasswd(char *user, char *passwd)
{
- char resp[16];
- Authkey key;
+ char resp[16], key[DESKEYLEN];
AuthInfo *ai;
Chalstate *ch;
@@ -38,9 +37,9 @@ auth_userpasswd(char *user, char *passwd)
if((ch = auth_challenge("user=%q proto=p9cr role=server", user)) == nil)
return nil;
- passtokey(&key, passwd);
- netresp(&key, atol(ch->chal), resp);
- memset(&key, 0, sizeof(Authkey));
+ passtodeskey(key, passwd);
+ netresp(key, atol(ch->chal), resp);
+ memset(key, 0, sizeof(key));
ch->resp = resp;
ch->nresp = strlen(resp);