1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #ifndef WS_AUTH_H
30 #define WS_AUTH_H
31
32 #include <sys/types.h>
33
34 #include "nsapi.h"
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #ifdef XP_WIN32
41 typedef int uid_t;
42 typedef int gid_t;
43 #endif
44
45 typedef struct auth_db AuthDB;
46 typedef struct user User;
47
48
49
50
51
52
53
54 typedef User*(*authdb_get_user_f)(AuthDB*, Session*, Request*,
const char*);
55
56 struct auth_db {
57 char *name;
58
59 authdb_get_user_f get_user;
60 int use_cache;
61 };
62
63
64
65
66
67
68
69
70 typedef int(*user_verify_passwd_f)(User*,
const char*);
71
72
73
74
75
76
77
78 typedef int(*user_check_group_f)(User*,
const char*);
79
80
81
82
83 typedef void(*user_free_f)(User*);
84
85 struct user {
86 char *name;
87 uid_t uid;
88 gid_t gid;
89
90 user_verify_passwd_f verify_password;
91
92 user_check_group_f check_group;
93
94 user_free_f free;
95 };
96
97
98 User* authdb_get_user(AuthDB *db, Session *sn, Request *rq,
const char *user);
99 User* authdb_get_and_verify(AuthDB *db, Session *sn, Request *rq,
const char *user,
const char *password,
int *pw);
100
101 #ifdef __cplusplus
102 }
103 #endif
104
105 #endif
106
107