Blob


1 #include <u.h>
2 #include <libc.h>
3 #include <authsrv.h>
5 #define CHAR(x) *p++ = f->x
6 #define SHORT(x) p[0] = f->x; p[1] = f->x>>8; p += 2
7 #define VLONG(q) p[0] = (q); p[1] = (q)>>8; p[2] = (q)>>16; p[3] = (q)>>24; p += 4
8 #define LONG(x) VLONG(f->x)
9 #define STRING(x,n) memmove(p, f->x, n); p += n
11 int
12 convPR2M(Passwordreq *f, char *ap, char *key)
13 {
14 int n;
15 uchar *p;
17 p = (uchar*)ap;
18 CHAR(num);
19 STRING(old, ANAMELEN);
20 STRING(new, ANAMELEN);
21 CHAR(changesecret);
22 STRING(secret, SECRETLEN);
23 n = p - (uchar*)ap;
24 if(key)
25 encrypt(key, ap, n);
26 return n;
27 }