diff options
| -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; +} |
