summaryrefslogtreecommitdiff
path: root/sys/src/cmd/auth
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-12-16 21:27:44 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2015-12-16 21:27:44 +0100
commite83c9b3e61cf3aff761b9e662bc7495faa18b94c (patch)
tree32b7096cd444255d8b0b6812bf16bc6654b2ac20 /sys/src/cmd/auth
parent8a60d9e2a8dc5b81b44426002b03110ef391f618 (diff)
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.
Diffstat (limited to 'sys/src/cmd/auth')
-rw-r--r--sys/src/cmd/auth/httpauth.c34
1 files changed, 2 insertions, 32 deletions
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 <u.h>
#include <libc.h>
-#include <authsrv.h>
-
-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 <auth.h>
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);