Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <authsrv.h>
4
 
5
#define	CHAR(x)		f->x = *p++
6
#define	SHORT(x)	f->x = (p[0] | (p[1]<<8)); p += 2
7
#define	VLONG(q)	q = (p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24)); p += 4
8
#define	LONG(x)		VLONG(f->x)
9
#define	STRING(x,n)	memmove(f->x, p, n); p += n
10
 
11
void
12
convM2T(char *ap, Ticket *f, char *key)
13
{
14
	uchar *p;
15
 
16
	if(key)
17
		decrypt(key, ap, TICKETLEN);
18
	p = (uchar*)ap;
19
	CHAR(num);
20
	STRING(chal, CHALLEN);
21
	STRING(cuid, ANAMELEN);
22
	f->cuid[ANAMELEN-1] = 0;
23
	STRING(suid, ANAMELEN);
24
	f->suid[ANAMELEN-1] = 0;
25
	STRING(key, DESKEYLEN);
26
	USED(p);
27
}
28