diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-19 21:06:17 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-19 21:06:17 +0200 |
commit | 02cfcfeab46f36aad95263ed40d19df7bd5eddef (patch) | |
tree | 30f67204be8d474b2c761e8944c20d042df1a08b /sys/src/libauth/httpauth.c | |
parent | f785d4da07349c7bb250eb00a3f2bed3eb170828 (diff) |
libauthsrv: generalize ticket service, not hardcoding ticket format and DES encryption
this is in preparation for replacing DES ticket encryption with
something better. but first need to make the code stop making
assumptions.
the wire encoding of the Ticket might be variable length
with TICKETLEN just giving an upper bound. the details will be
handled by libauthsrv _asgetticket() and _asgetresp() funciotns.
the Authenticator and Passwordreq structures are encrypted
with the random ticket key. The encryption schmeme will depend
on the Ticket format used, so we pass the Ticket* structure
instead of the DES key.
introduce Authkey structure that will hold all the required
cryptographic keys instead of passing DES key.
Diffstat (limited to 'sys/src/libauth/httpauth.c')
-rw-r--r-- | sys/src/libauth/httpauth.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/sys/src/libauth/httpauth.c b/sys/src/libauth/httpauth.c deleted file mode 100644 index 9d1b0d26f..000000000 --- a/sys/src/libauth/httpauth.c +++ /dev/null @@ -1,51 +0,0 @@ -#include <u.h> -#include <libc.h> -#include <auth.h> -#include <authsrv.h> - -/* deprecated. - This is the mechanism that put entries in /sys/lib/httpd.rewrite - and passwords on the authserver in /sys/lib/httppasswords, which - was awkward to administer. Instead, use local .httplogin files, - which are implemented in sys/src/cmd/ip/httpd/authorize.c */ - -int -httpauth(char *name, char *password) -{ - int afd; - Ticketreq tr; - Ticket t; - char key[DESKEYLEN]; - char buf[512]; - - afd = authdial(nil, nil); - if(afd < 0) - return -1; - - /* send ticket request to AS */ - memset(&tr, 0, sizeof(tr)); - strcpy(tr.uid, name); - tr.type = AuthHttp; - convTR2M(&tr, buf); - if(write(afd, buf, TICKREQLEN) != TICKREQLEN){ - close(afd); - return -1; - } - if(_asrdresp(afd, buf, TICKETLEN) < 0){ - close(afd); - return -1; - } - close(afd); - - /* - * use password and try to decrypt the - * ticket. If it doesn't work we've got a bad password, - * give up. - */ - passtokey(key, password); - convM2T(buf, &t, key); - if(t.num != AuthHr || strcmp(t.cuid, tr.uid)) - return -1; - - return 0; -} |