Introduction
Introduction Statistics Contact Development Disclaimer Help
auth.h - 9base - revived minimalist port of Plan 9 userland to Unix
git clone git://git.suckless.org/9base
Log
Files
Refs
README
LICENSE
---
auth.h (3871B)
---
1 #ifndef __AUTH_H__
2 #define __AUTH_H__ 1
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 /*
8 #pragma src "/sys/src/libauth"
9 #pragma lib "libauth.a"
10 */
11 AUTOLIB(auth)
12
13 /*
14 * Interface for typical callers.
15 */
16
17 typedef struct AuthInfo AuthInfo;
18 typedef struct Chalstate Chalstate;
19 typedef struct Chapreply Chapreply;
20 typedef struct MSchapreply MSchapreply;
21 typedef struct UserPasswd UserPasswd;
22 typedef struct AuthRpc AuthRpc;
23
24 struct CFid;
25
26 enum
27 {
28 MAXCHLEN= 256, /* max challenge length …
29 MAXNAMELEN= 256, /* maximum name length */
30 MD5LEN= 16,
31
32 ARok = 0, /* rpc return values */
33 ARdone,
34 ARerror,
35 ARneedkey,
36 ARbadkey,
37 ARwritenext,
38 ARtoosmall,
39 ARtoobig,
40 ARrpcfailure,
41 ARphase,
42
43 AuthRpcMax = 4096
44 };
45
46 struct AuthRpc
47 {
48 int afd;
49 struct CFid *afid;
50 char ibuf[AuthRpcMax];
51 char obuf[AuthRpcMax];
52 char *arg;
53 uint narg;
54 };
55
56 struct AuthInfo
57 {
58 char *cuid; /* caller id */
59 char *suid; /* server id */
60 char *cap; /* capability (only valid on se…
61 int nsecret; /* length of secret */
62 uchar *secret; /* secret */
63 };
64
65 struct Chalstate
66 {
67 char *user;
68 char chal[MAXCHLEN];
69 int nchal;
70 void *resp;
71 int nresp;
72
73 /* for implementation only */
74 AuthRpc *rpc; /* to factotum */
75 char userbuf[MAXNAMELEN]; /* temp space if needed …
76 int userinchal; /* user was sent to obtain…
77 };
78
79 struct Chapreply /* for protocol "chap" */
80 {
81 uchar id;
82 char resp[MD5LEN];
83 };
84
85 struct MSchapreply /* for protocol "mschap" */
86 {
87 char LMresp[24]; /* Lan Manager response */
88 char NTresp[24]; /* NT response */
89 };
90
91 struct UserPasswd
92 {
93 char *user;
94 char *passwd;
95 };
96
97 extern int newns(char*, char*);
98 extern int addns(char*, char*);
99
100 extern int noworld(char*);
101 extern int amount(int, char*, int, char*);
102
103 /* these two may get generalized away -rsc */
104 extern int login(char*, char*, char*);
105 extern int httpauth(char*, char*);
106
107 typedef struct Attr Attr;
108 enum {
109 AttrNameval, /* name=val -- when matching, must h…
110 AttrQuery, /* name? -- when matching, must be pre…
111 AttrDefault /* name:=val -- when matching, if pre…
112 };
113 struct Attr
114 {
115 int type;
116 Attr *next;
117 char *name;
118 char *val;
119 };
120
121 typedef int AuthGetkey(char*);
122
123 int _attrfmt(Fmt*);
124 Attr *_copyattr(Attr*);
125 Attr *_delattr(Attr*, char*);
126 Attr *_findattr(Attr*, char*);
127 void _freeattr(Attr*);
128 Attr *_mkattr(int, char*, char*, Attr*);
129 Attr *_parseattr(char*);
130 char *_strfindattr(Attr*, char*);
131 /*
132 #pragma varargck type "A" Attr*
133 */
134
135 extern AuthInfo* fauth_proxy(int, AuthRpc *rpc, AuthGetkey *getke…
136 extern AuthInfo* auth_proxy(int fd, AuthGetkey *getkey, char *fmt…
137 extern AuthInfo* fsfauth_proxy(struct CFid*, AuthRpc *rpc, AuthGe…
138 extern AuthInfo* fsauth_proxy(struct CFid*, AuthGetkey *getkey, c…
139 extern int auth_getkey(char*);
140 extern int (*amount_getkey)(char*);
141 extern void auth_freeAI(AuthInfo *ai);
142 extern int auth_chuid(AuthInfo *ai, char *ns);
143 extern Chalstate *auth_challenge(char*, ...);
144 extern AuthInfo* auth_response(Chalstate*);
145 extern int auth_respond(void*, uint, char*, uint, void*, …
146 extern void auth_freechal(Chalstate*);
147 extern AuthInfo* auth_userpasswd(char *user, char *passwd);
148 extern UserPasswd* auth_getuserpasswd(AuthGetkey *getkey, char*, …
149 extern AuthInfo* auth_getinfo(AuthRpc *rpc);
150 extern AuthRpc* auth_allocrpc(void);
151 extern Attr* auth_attr(AuthRpc *rpc);
152 extern void auth_freerpc(AuthRpc *rpc);
153 extern uint auth_rpc(AuthRpc *rpc, char *verb, void *a, i…
154 extern int auth_wep(char*, char*, ...);
155
156 extern struct CFsys* fsamount(int fd, char *aname);
157 extern struct CFsys* nsamount(char *name, char *aname);
158
159
160 /*
161 #pragma varargck argpos auth_proxy 3
162 #pragma varargck argpos auth_challenge 1
163 #pragma varargck argpos auth_respond 3
164 #pragma varargck argpos auth_getuserpasswd 2
165 */
166 #ifdef __cplusplus
167 }
168 #endif
169 #endif
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.