Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_posix/sys/src/cmd/unix/drawterm/include/auth.h – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#ifdef PLAN9
2
#pragma	src	"/sys/src/libauth"
3
#pragma	lib	"libauth.a"
4
#endif
5
 
6
/*
7
 * Interface for typical callers.
8
 */
9
 
10
typedef struct	AuthInfo	AuthInfo;
11
typedef struct	Chalstate	Chalstate;
12
typedef struct	Chapreply	Chapreply;
13
typedef struct	MSchapreply	MSchapreply;
14
typedef struct	UserPasswd	UserPasswd;
15
typedef struct	AuthRpc		AuthRpc;
16
 
17
enum
18
{
19
	MAXCHLEN=	256,		/* max challenge length	*/
20
	AMAXNAMELEN=	256,		/* maximum name length */
21
	MD5LEN=		16,
22
 
23
	ARok = 0,			/* rpc return values */
24
	ARdone,
25
	ARerror,
26
	ARneedkey,
27
	ARbadkey,
28
	ARwritenext,
29
	ARtoosmall,
30
	ARtoobig,
31
	ARrpcfailure,
32
	ARphase,
33
 
34
	AuthRpcMax = 4096,
35
};
36
 
37
struct AuthRpc
38
{
39
	int afd;
40
	char ibuf[AuthRpcMax];
41
	char obuf[AuthRpcMax];
42
	char *arg;
43
	uint narg;
44
};
45
 
46
struct AuthInfo
47
{
48
	char	*cuid;		/* caller id */
49
	char	*suid;		/* server id */
50
	char	*cap;		/* capability (only valid on server side) */
51
	int	nsecret;	/* length of secret */
52
	uchar	*secret;	/* secret */
53
};
54
 
55
struct Chalstate
56
{
57
	char	*user;
58
	char	chal[MAXCHLEN];
59
	int	nchal;
60
	void	*resp;
61
	int	nresp;
62
 
63
/* for implementation only */
64
	int	afd;			/* to factotum */
65
	AuthRpc	*rpc;			/* to factotum */
66
	char	userbuf[AMAXNAMELEN];	/* temp space if needed */
67
	int	userinchal;		/* user was sent to obtain challenge */
68
};
69
 
70
struct	Chapreply		/* for protocol "chap" */
71
{
72
	uchar	id;
73
	char	resp[MD5LEN];
74
};
75
 
76
struct	MSchapreply	/* for protocol "mschap" */
77
{
78
	char	LMresp[24];		/* Lan Manager response */
79
	char	NTresp[24];		/* NT response */
80
};
81
 
82
struct	UserPasswd
83
{
84
	char	*user;
85
	char	*passwd;
86
};
87
 
88
extern	int	newns(char*, char*);
89
extern	int	addns(char*, char*);
90
 
91
extern	int	noworld(char*);
92
extern	int	amount(int, char*, int, char*);
93
 
94
/* these two may get generalized away -rsc */
95
extern	int	login(char*, char*, char*);
96
extern	int	httpauth(char*, char*);
97
 
98
typedef struct Attr Attr;
99
typedef struct String String;
100
enum {
101
	AttrNameval,		/* name=val -- when matching, must have name=val */
102
	AttrQuery,		/* name? -- when matching, must be present */
103
	AttrDefault,		/* name:=val -- when matching, if present must match INTERNAL */
104
};
105
struct Attr
106
{
107
	int type;
108
	Attr *next;
109
	char *name;
110
	char *val;
111
};
112
 
113
typedef int AuthGetkey(char*);
114
 
115
int	_attrfmt(Fmt*);
116
Attr	*_copyattr(Attr*);
117
Attr	*_delattr(Attr*, char*);
118
Attr	*_findattr(Attr*, char*);
119
void	_freeattr(Attr*);
120
Attr	*_mkattr(int, char*, char*, Attr*);
121
Attr	*_parseattr(char*);
122
char	*_strfindattr(Attr*, char*);
123
#ifdef VARARGCK
124
#pragma varargck type "A" Attr*
125
#endif
126
 
127
extern AuthInfo*	fauth_proxy(int, AuthRpc *rpc, AuthGetkey *getkey, char *params);
128
extern AuthInfo*	auth_proxy(int fd, AuthGetkey *getkey, char *fmt, ...);
129
extern int		auth_getkey(char*);
130
extern int		(*amount_getkey)(char*);
131
extern void		auth_freeAI(AuthInfo *ai);
132
extern int		auth_chuid(AuthInfo *ai, char *ns);
133
extern Chalstate	*auth_challenge(char*, ...);
134
extern AuthInfo*	auth_response(Chalstate*);
135
extern int		auth_respond(void*, uint, char*, uint, void*, uint, AuthGetkey *getkey, char*, ...);
136
extern void		auth_freechal(Chalstate*);
137
extern AuthInfo*	auth_userpasswd(char *user, char *passwd);
138
extern UserPasswd*	auth_getuserpasswd(AuthGetkey *getkey, char*, ...);
139
extern AuthInfo*	auth_getinfo(AuthRpc *rpc);
140
extern AuthRpc*		auth_allocrpc(int afd);
141
extern Attr*		auth_attr(AuthRpc *rpc);
142
extern void		auth_freerpc(AuthRpc *rpc);
143
extern uint		auth_rpc(AuthRpc *rpc, char *verb, void *a, int n);
144
extern int		auth_wep(char*, char*, ...);
145
 
146
#ifdef VARARGCK
147
#pragma varargck argpos auth_proxy 3
148
#pragma varargck argpos auth_challenge 1
149
#pragma varargck argpos auth_respond 3
150
#pragma varargck argpos auth_getuserpasswd 2
151
#endif