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/libauthsrv/_asgetticket.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/libauthsrv/_asgetticket.c')
-rw-r--r-- | sys/src/libauthsrv/_asgetticket.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/src/libauthsrv/_asgetticket.c b/sys/src/libauthsrv/_asgetticket.c index 46283bd5a..11a344621 100644 --- a/sys/src/libauthsrv/_asgetticket.c +++ b/sys/src/libauthsrv/_asgetticket.c @@ -5,11 +5,13 @@ static char *pbmsg = "AS protocol botch"; int -_asgetticket(int fd, char *trbuf, char *tbuf) +_asgetticket(int fd, Ticketreq *tr, char *tbuf, int tbuflen) { - if(write(fd, trbuf, TICKREQLEN) < 0){ + if(_asrequest(fd, tr) < 0){ werrstr(pbmsg); return -1; } - return _asrdresp(fd, tbuf, 2*TICKETLEN); + if(tbuflen > 2*TICKETLEN) + tbuflen = 2*TICKETLEN; + return _asrdresp(fd, tbuf, tbuflen); } |