From e83c9b3e61cf3aff761b9e662bc7495faa18b94c Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 16 Dec 2015 21:27:44 +0100 Subject: auth/httpauth: use auth_userpasswd() instead of AuthHttp request to AS the /sys/lib/httppasswords will be removed soon from authsrv, so we use auth_userpasswd() to verify a username/password pair instead. --- sys/src/cmd/auth/httpauth.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'sys/src/cmd/auth/httpauth.c') diff --git a/sys/src/cmd/auth/httpauth.c b/sys/src/cmd/auth/httpauth.c index 4b0f39028..fc333de93 100644 --- a/sys/src/cmd/auth/httpauth.c +++ b/sys/src/cmd/auth/httpauth.c @@ -1,36 +1,6 @@ #include #include -#include - -int -httpauth(char *name, char *password) -{ - int afd; - Ticketreq tr; - Ticket t; - Authkey key; - - afd = authdial(nil, nil); - if(afd < 0) - return -1; - - passtokey(&key, password); - - /* send ticket request to AS */ - memset(&tr, 0, sizeof(tr)); - strcpy(tr.uid, name); - tr.type = AuthHttp; - if(_asrequest(afd, &tr) < 0){ - close(afd); - return -1; - } - _asgetresp(afd, &t, nil, &key); - close(afd); - if(t.num != AuthHr || strcmp(t.cuid, tr.uid) != 0) - return -1; - - return 0; -} +#include void usage(void) @@ -73,7 +43,7 @@ main(int argc, char *argv[]) } if(*s == '\0') sysfatal("empty username"); - if(httpauth(s, a)) + if(auth_userpasswd(s, a) == nil) sysfatal("bad password"); print("%s\n", s); exits(nil); -- cgit v1.2.3