diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-20 15:47:49 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-20 15:47:49 +0200 |
commit | 78c45541eb66a661f4e45c2f86bb5ac37de2408b (patch) | |
tree | 37cf578d06178f12dd2dbc8991df2d1a80eb28b4 /sys/src/libauthsrv | |
parent | a40c4006d21d6e553d805da7d1a297bdce42f571 (diff) |
libauthsrv: add missing files (thanks mischief)
Diffstat (limited to 'sys/src/libauthsrv')
-rw-r--r-- | sys/src/libauthsrv/_asgetresp.c | 29 | ||||
-rw-r--r-- | sys/src/libauthsrv/_asrequest.c | 16 |
2 files changed, 45 insertions, 0 deletions
diff --git a/sys/src/libauthsrv/_asgetresp.c b/sys/src/libauthsrv/_asgetresp.c new file mode 100644 index 000000000..d2ad83aa6 --- /dev/null +++ b/sys/src/libauthsrv/_asgetresp.c @@ -0,0 +1,29 @@ +#include <u.h> +#include <libc.h> +#include <authsrv.h> + +int +_asgetresp(int fd, Ticket *t, Authenticator *a, Authkey *k) +{ + char tbuf[TICKETLEN+AUTHENTLEN]; + int n, m; + + memset(t, 0, sizeof(Ticket)); + if(a != nil) + memset(a, 0, sizeof(Authenticator)); + + n = _asrdresp(fd, tbuf, sizeof(tbuf)); + if(n <= 0) + return -1; + + m = convM2T(tbuf, n, t, k); + if(m <= 0) + return -1; + + if(a != nil){ + if(convM2A(tbuf+m, n-m, a, t) <= 0) + return -1; + } + + return 0; +} diff --git a/sys/src/libauthsrv/_asrequest.c b/sys/src/libauthsrv/_asrequest.c new file mode 100644 index 000000000..7479c4806 --- /dev/null +++ b/sys/src/libauthsrv/_asrequest.c @@ -0,0 +1,16 @@ +#include <u.h> +#include <libc.h> +#include <authsrv.h> + +int +_asrequest(int fd, Ticketreq *tr) +{ + char trbuf[TICKREQLEN]; + int n; + + n = convTR2M(tr, trbuf, sizeof(trbuf)); + if(write(fd, trbuf, n) != n) + return -1; + + return 0; +} |