ref: 78c45541eb66a661f4e45c2f86bb5ac37de2408b
parent: a40c4006d21d6e553d805da7d1a297bdce42f571
author: cinap_lenrek <[email protected]>
date: Thu Aug 20 11:47:49 EDT 2015
libauthsrv: add missing files (thanks mischief)
--- /dev/null
+++ b/sys/src/libauthsrv/_asgetresp.c
@@ -1,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;
+}
--- /dev/null
+++ b/sys/src/libauthsrv/_asrequest.c
@@ -1,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;
+}