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 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #ifdef XP_WIN32
39 typedef int uid_t;
40 typedef int gid_t;
41 #endif
42
43 typedef struct auth_db AuthDB;
44 typedef struct user User;
45
46
47
48
49
50
51
52 typedef User*(*authdb_get_user_f)(AuthDB*,
char*);
53
54 struct auth_db {
55 char *name;
56
57 authdb_get_user_f get_user;
58 int use_cache;
59 };
60
61
62
63
64
65
66
67
68 typedef int(*user_verify_passwd_f)(User*,
char*);
69
70
71
72
73
74
75
76 typedef int(*user_check_group_f)(User*,
char*);
77
78
79
80
81 typedef void(*user_free_f)(User*);
82
83 struct user {
84 char *name;
85 uid_t uid;
86 gid_t gid;
87
88 user_verify_passwd_f verify_password;
89
90 user_check_group_f check_group;
91
92 user_free_f free;
93 };
94
95
96 User* authdb_get_user(AuthDB *db,
char *user);
97 User* authdb_get_and_verify(AuthDB *db,
char *user,
char *password,
int *pw);
98
99 #ifdef __cplusplus
100 }
101 #endif
102
103 #endif
104
105