Commit 0ed5c491 0ed5c491cdab5916aa52fbfe22d7ecb5f230ac4d by Sergey Poznyakoff

(enum mu_auth_key_type): New data type.

(mu_get_auth): New function.
1 parent c565bb56
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
21 21
22 #include <mailutils/types.h> 22 #include <mailutils/types.h>
23 23
24 struct mu_auth_data { 24 struct mu_auth_data
25 {
25 /* These are from struct passwd */ 26 /* These are from struct passwd */
26 char *name; /* user name */ 27 char *name; /* user name */
27 char *passwd; /* user password */ 28 char *passwd; /* user password */
...@@ -40,7 +41,8 @@ typedef int (*mu_auth_fp) (struct mu_auth_data **data, ...@@ -40,7 +41,8 @@ typedef int (*mu_auth_fp) (struct mu_auth_data **data,
40 void *func_data, 41 void *func_data,
41 void *call_data); 42 void *call_data);
42 43
43 struct mu_auth_module { 44 struct mu_auth_module
45 {
44 char *name; 46 char *name;
45 struct argp *argp; 47 struct argp *argp;
46 mu_auth_fp authenticate; 48 mu_auth_fp authenticate;
...@@ -51,9 +53,20 @@ struct mu_auth_module { ...@@ -51,9 +53,20 @@ struct mu_auth_module {
51 void *auth_by_uid_data; 53 void *auth_by_uid_data;
52 }; 54 };
53 55
56 enum mu_auth_key_type
57 {
58 mu_auth_key_name,
59 mu_auth_key_uid
60 };
61
62
54 extern int mu_auth_runlist (mu_list_t flist, 63 extern int mu_auth_runlist (mu_list_t flist,
55 struct mu_auth_data **return_data, 64 struct mu_auth_data **return_data,
56 const void *key, void *data); 65 const void *key, void *data);
66
67 extern int mu_get_auth (struct mu_auth_data **auth, enum mu_auth_key_type type,
68 const void *key);
69
57 extern struct mu_auth_data * 70 extern struct mu_auth_data *
58 mu_get_auth_by_name (const char *username); 71 mu_get_auth_by_name (const char *username);
59 72
......