annotate src/lib-auth/auth-master.h @ 22652:09523ad05bef

director: Log whenever HOST-RESET-USERS is used
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sun, 05 Nov 2017 22:53:23 +0200
parents 5a4b25374acd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8365
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
1 #ifndef AUTH_MASTER_H
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
2 #define AUTH_MASTER_H
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
3
15187
02451e967a06 Renamed network.[ch] to net.[ch].
Timo Sirainen <tss@iki.fi>
parents: 14840
diff changeset
4 #include "net.h"
9830
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
5
10497
3907cc4ecc4b Idle-disconnecting auth master connections is now optional. LMTP no longer does it.
Timo Sirainen <tss@iki.fi>
parents: 10098
diff changeset
6 enum auth_master_flags {
3907cc4ecc4b Idle-disconnecting auth master connections is now optional. LMTP no longer does it.
Timo Sirainen <tss@iki.fi>
parents: 10098
diff changeset
7 /* Enable logging debug information */
3907cc4ecc4b Idle-disconnecting auth master connections is now optional. LMTP no longer does it.
Timo Sirainen <tss@iki.fi>
parents: 10098
diff changeset
8 AUTH_MASTER_FLAG_DEBUG = 0x01,
3907cc4ecc4b Idle-disconnecting auth master connections is now optional. LMTP no longer does it.
Timo Sirainen <tss@iki.fi>
parents: 10098
diff changeset
9 /* Don't disconnect from auth socket when idling */
3907cc4ecc4b Idle-disconnecting auth master connections is now optional. LMTP no longer does it.
Timo Sirainen <tss@iki.fi>
parents: 10098
diff changeset
10 AUTH_MASTER_FLAG_NO_IDLE_TIMEOUT = 0x02
3907cc4ecc4b Idle-disconnecting auth master connections is now optional. LMTP no longer does it.
Timo Sirainen <tss@iki.fi>
parents: 10098
diff changeset
11 };
3907cc4ecc4b Idle-disconnecting auth master connections is now optional. LMTP no longer does it.
Timo Sirainen <tss@iki.fi>
parents: 10098
diff changeset
12
9830
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
13 struct auth_user_info {
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
14 const char *service;
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
15 struct ip_addr local_ip, remote_ip;
19035
aabfe48db1cf Changed type of internet port values to in_port_t everywhere.
Stephan Bosch <stephan@rename-it.nl>
parents: 18274
diff changeset
16 in_port_t local_port, remote_port;
19924
5a4b25374acd doveadm-auth: If auth_debug setting is enabled, send "debug" field to auth lookups.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 19035
diff changeset
17 bool debug;
9830
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
18 };
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
19
8365
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
20 struct auth_user_reply {
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
21 uid_t uid;
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
22 gid_t gid;
10098
15a71c18a0f8 lib-auth: Changed auth_master_user_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9830
diff changeset
23 const char *home, *chroot;
8368
9babcdc6f4f7 Cleanups and fixes to auth-master API.
Timo Sirainen <tss@iki.fi>
parents: 8365
diff changeset
24 ARRAY_TYPE(const_string) extra_fields;
14593
e445670e7332 Adds 'anonymous' field to struct mail_user; derived indirectly from userdb extra fields.
Stephan Bosch <stephan@rename-it.nl>
parents: 13761
diff changeset
25 unsigned int anonymous:1;
8365
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
26 };
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
27
8373
9524ec6e14fc auth-master API cleanups.
Timo Sirainen <tss@iki.fi>
parents: 8369
diff changeset
28 struct auth_master_connection *
10497
3907cc4ecc4b Idle-disconnecting auth master connections is now optional. LMTP no longer does it.
Timo Sirainen <tss@iki.fi>
parents: 10098
diff changeset
29 auth_master_init(const char *auth_socket_path, enum auth_master_flags flags);
8373
9524ec6e14fc auth-master API cleanups.
Timo Sirainen <tss@iki.fi>
parents: 8369
diff changeset
30 void auth_master_deinit(struct auth_master_connection **conn);
8365
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
31
15534
755a2f08cde5 lib-auth: Added auth_master_get_socket_path()
Timo Sirainen <tss@iki.fi>
parents: 14778
diff changeset
32 /* Returns the auth_socket_path */
755a2f08cde5 lib-auth: Added auth_master_get_socket_path()
Timo Sirainen <tss@iki.fi>
parents: 14778
diff changeset
33 const char *auth_master_get_socket_path(struct auth_master_connection *conn);
755a2f08cde5 lib-auth: Added auth_master_get_socket_path()
Timo Sirainen <tss@iki.fi>
parents: 14778
diff changeset
34
18274
bcad7792a0fc lib-auth: auth_master_pass/user_lookup() now returns -2 for user-specific errors.
Timo Sirainen <tss@iki.fi>
parents: 16610
diff changeset
35 /* Do a USER lookup. Returns -2 = user-specific error, -1 = internal error,
bcad7792a0fc lib-auth: auth_master_pass/user_lookup() now returns -2 for user-specific errors.
Timo Sirainen <tss@iki.fi>
parents: 16610
diff changeset
36 0 = user not found, 1 = ok. When returning -1 and fields[0] isn't NULL, it
bcad7792a0fc lib-auth: auth_master_pass/user_lookup() now returns -2 for user-specific errors.
Timo Sirainen <tss@iki.fi>
parents: 16610
diff changeset
37 contains an error message that should be shown to user. */
8373
9524ec6e14fc auth-master API cleanups.
Timo Sirainen <tss@iki.fi>
parents: 8369
diff changeset
38 int auth_master_user_lookup(struct auth_master_connection *conn,
9830
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
39 const char *user, const struct auth_user_info *info,
10098
15a71c18a0f8 lib-auth: Changed auth_master_user_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9830
diff changeset
40 pool_t pool, const char **username_r,
15a71c18a0f8 lib-auth: Changed auth_master_user_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9830
diff changeset
41 const char *const **fields_r);
9830
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
42 /* Do a PASS lookup (the actual password isn't returned). */
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
43 int auth_master_pass_lookup(struct auth_master_connection *conn,
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
44 const char *user, const struct auth_user_info *info,
0919ab922086 Added auth_master_pass_lookup() and changed auth_master_used_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9299
diff changeset
45 pool_t pool, const char *const **fields_r);
14778
1093c74f54af doveadm: Added "auth cache flush" command.
Timo Sirainen <tss@iki.fi>
parents: 13761
diff changeset
46 /* Flush authentication cache for everyone (users=NULL) or only for specified
1093c74f54af doveadm: Added "auth cache flush" command.
Timo Sirainen <tss@iki.fi>
parents: 13761
diff changeset
47 users. Returns number of users flushed from cache. */
1093c74f54af doveadm: Added "auth cache flush" command.
Timo Sirainen <tss@iki.fi>
parents: 13761
diff changeset
48 int auth_master_cache_flush(struct auth_master_connection *conn,
1093c74f54af doveadm: Added "auth cache flush" command.
Timo Sirainen <tss@iki.fi>
parents: 13761
diff changeset
49 const char *const *users, unsigned int *count_r);
8365
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
50
10098
15a71c18a0f8 lib-auth: Changed auth_master_user_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9830
diff changeset
51 /* Parse userdb extra fields into auth_user_reply structure. */
15a71c18a0f8 lib-auth: Changed auth_master_user_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9830
diff changeset
52 void auth_user_fields_parse(const char *const *fields, pool_t pool,
15a71c18a0f8 lib-auth: Changed auth_master_user_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9830
diff changeset
53 struct auth_user_reply *reply_r);
15a71c18a0f8 lib-auth: Changed auth_master_user_lookup() API.
Timo Sirainen <tss@iki.fi>
parents: 9830
diff changeset
54
13761
59e25ebc976f lib-auth: auth_master_user_list_init() now takes user_mask and info parameters.
Timo Sirainen <tss@iki.fi>
parents: 11018
diff changeset
55 /* Iterate through all users. If user_mask is non-NULL, it contains a string
59e25ebc976f lib-auth: auth_master_user_list_init() now takes user_mask and info parameters.
Timo Sirainen <tss@iki.fi>
parents: 11018
diff changeset
56 with wildcards ('*', '?') that the auth server MAY use to limit what users
59e25ebc976f lib-auth: auth_master_user_list_init() now takes user_mask and info parameters.
Timo Sirainen <tss@iki.fi>
parents: 11018
diff changeset
57 are returned (but it may as well return all users anyway). */
9288
77d6b5eb0963 lib-auth: Added support for iterating through all users.
Timo Sirainen <tss@iki.fi>
parents: 9059
diff changeset
58 struct auth_master_user_list_ctx *
13761
59e25ebc976f lib-auth: auth_master_user_list_init() now takes user_mask and info parameters.
Timo Sirainen <tss@iki.fi>
parents: 11018
diff changeset
59 auth_master_user_list_init(struct auth_master_connection *conn,
59e25ebc976f lib-auth: auth_master_user_list_init() now takes user_mask and info parameters.
Timo Sirainen <tss@iki.fi>
parents: 11018
diff changeset
60 const char *user_mask,
14629
c93ca5e46a8a Marked functions parameters that are allowed to be NULL. Some APIs were also changed.
Timo Sirainen <tss@iki.fi>
parents: 14593
diff changeset
61 const struct auth_user_info *info) ATTR_NULL(3);
9288
77d6b5eb0963 lib-auth: Added support for iterating through all users.
Timo Sirainen <tss@iki.fi>
parents: 9059
diff changeset
62 const char *auth_master_user_list_next(struct auth_master_user_list_ctx *ctx);
77d6b5eb0963 lib-auth: Added support for iterating through all users.
Timo Sirainen <tss@iki.fi>
parents: 9059
diff changeset
63 /* Returns -1 if anything failed, 0 if ok */
77d6b5eb0963 lib-auth: Added support for iterating through all users.
Timo Sirainen <tss@iki.fi>
parents: 9059
diff changeset
64 int auth_master_user_list_deinit(struct auth_master_user_list_ctx **ctx);
77d6b5eb0963 lib-auth: Added support for iterating through all users.
Timo Sirainen <tss@iki.fi>
parents: 9059
diff changeset
65
8365
f97099eb4dee New generic userdb lookup api `auth-master' in lib-auth.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
66 #endif