src/server/public/auth.h

changeset 415
d938228c382e
parent 211
2160585200ac
child 467
4d038bc6f86e
equal deleted inserted replaced
414:99a34860c105 415:d938228c382e
47 * get a user from the authentication database 47 * get a user from the authentication database
48 * 48 *
49 * param1: authentication database 49 * param1: authentication database
50 * param2: user 50 * param2: user
51 */ 51 */
52 typedef User*(*authdb_get_user_f)(AuthDB*, char*); 52 typedef User*(*authdb_get_user_f)(AuthDB*, const char*);
53 53
54 struct auth_db { 54 struct auth_db {
55 char *name; 55 char *name;
56 /* User* get_user(AuthDB *db, char *username) */ 56 /* User* get_user(AuthDB *db, char *username) */
57 authdb_get_user_f get_user; 57 authdb_get_user_f get_user;
63 * returns 1 if the password is correct, otherwise 0 63 * returns 1 if the password is correct, otherwise 0
64 * 64 *
65 * param1: user 65 * param1: user
66 * param2: password 66 * param2: password
67 */ 67 */
68 typedef int(*user_verify_passwd_f)(User*, char*); 68 typedef int(*user_verify_passwd_f)(User*, const char*);
69 69
70 /* 70 /*
71 * check if the user is a member of a given group 71 * check if the user is a member of a given group
72 * 72 *
73 * param1: user 73 * param1: user
74 * param2: group 74 * param2: group
75 */ 75 */
76 typedef int(*user_check_group_f)(User*, char*); 76 typedef int(*user_check_group_f)(User*, const char*);
77 77
78 /* 78 /*
79 * free the user object 79 * free the user object
80 */ 80 */
81 typedef void(*user_free_f)(User*); 81 typedef void(*user_free_f)(User*);
91 /* void free(User*) */ 91 /* void free(User*) */
92 user_free_f free; 92 user_free_f free;
93 }; 93 };
94 94
95 95
96 User* authdb_get_user(AuthDB *db, char *user); 96 User* authdb_get_user(AuthDB *db, const char *user);
97 User* authdb_get_and_verify(AuthDB *db, char *user, char *password, int *pw); 97 User* authdb_get_and_verify(AuthDB *db, const char *user, const char *password, int *pw);
98 98
99 #ifdef __cplusplus 99 #ifdef __cplusplus
100 } 100 }
101 #endif 101 #endif
102 102

mercurial