Commit 46173d9f 46173d9f8e815e978c2138430628eaff6e679cbc by Sergey Poznyakoff

Prototypes for mailutils authentication/authorization functions.

1 parent 3373f208
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 2002 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 typedef int (*mu_auth_fp) __P((void *return_data,
19 void *key,
20 void *func_data,
21 void *call_data));
22
23 struct mu_auth_data {
24 /* These are from struct passwd */
25 char *name; /* user name */
26 char *passwd; /* user password */
27 uid_t uid; /* user id */
28 gid_t gid; /* group id */
29 char *gecos; /* real name */
30 char *dir; /* home directory */
31 char *shell; /* shell program */
32 /* */
33 char *mailbox;
34 int change_uid;
35 };
36
37 struct mu_auth_module {
38 char *name;
39 struct argp *argp;
40 mu_auth_fp authenticate;
41 void *authenticate_data;
42 mu_auth_fp auth_by_name;
43 void *auth_by_name_data;
44 mu_auth_fp auth_by_uid;
45 void *auth_by_uid_data;
46 };
47
48 extern int mu_auth_runlist __P((list_t flist, void *return_data,
49 void *key, void *data));
50 extern struct mu_auth_data *
51 mu_get_auth_by_name __P ((const char *username));
52
53 extern struct mu_auth_data *
54 mu_get_auth_by_uid __P((uid_t uid));
55
56 extern int
57 mu_authenticate __P((struct mu_auth_data *auth_data, char *pass));
58
59 extern void mu_auth_data_free __P((struct mu_auth_data *ptr));
60
61
62 extern int mu_auth_nosupport __P((void *return_data,
63 void *key,
64 void *func_data,
65 void *call_data));
66
67
68 extern void mu_auth_register_module __P((struct mu_auth_module *mod));
69
70 extern void mu_authorization_add_module_list __P((const char *modlist));
71 extern void mu_authentication_add_module_list __P((const char *modlist));
72
73 extern void mu_auth_init __P((void));
74 extern int mu_auth_data_alloc __P((struct mu_auth_data **ptr,
75 const char *name,
76 const char *passwd,
77 uid_t uid,
78 gid_t gid,
79 const char *gecos,
80 const char *dir,
81 const char *shell,
82 const char *mailbox,
83 int change_uid));
84 extern void mu_auth_data_free __P((struct mu_auth_data *ptr));
85
86
87 extern struct mu_auth_module mu_auth_system_module;
88 extern struct mu_auth_module mu_auth_generic_module;
89 extern struct mu_auth_module mu_auth_pam_module;
90 extern struct mu_auth_module mu_auth_sql_module;
91 extern struct mu_auth_module mu_auth_virtual_module;
92
93 #define MU_AUTH_REGISTER_ALL_MODULES() do {\
94 mu_auth_register_module (&mu_auth_generic_module); \
95 mu_auth_register_module (&mu_auth_system_module); \
96 mu_auth_register_module (&mu_auth_pam_module);\
97 mu_auth_register_module (&mu_auth_sql_module);\
98 mu_auth_register_module (&mu_auth_virtual_module);\
99 mu_auth_init (); } while (0)