annotate src/lib-auth/auth-client.h @ 4891:6ab2712f1a93 HEAD

Only imap binary was actually working.
author Timo Sirainen <tss@iki.fi>
date Sun, 10 Dec 2006 14:35:02 +0200
parents 9e2a96d7e9ae
children 204d7edc7cdc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 #ifndef __AUTH_CLIENT_H
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 #define __AUTH_CLIENT_H
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
2097
4e77cb0aff21 Added %l, %r and %P variables and mail_log_prefix setting.
Timo Sirainen <tss@iki.fi>
parents: 2082
diff changeset
4 #include "network.h"
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5 #include "../auth/auth-client-interface.h"
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7 struct auth_client;
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8 struct auth_request;
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
9
2736
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
10 enum auth_request_flags {
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
11 AUTH_REQUEST_FLAG_SECURED = 0x01,
4048
9e2a96d7e9ae More comma removals
Timo Sirainen <tss@iki.fi>
parents: 3879
diff changeset
12 AUTH_REQUEST_FLAG_VALID_CLIENT_CERT = 0x02
2736
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
13 };
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
14
2077
d5b20d679b8a Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents: 2076
diff changeset
15 struct auth_mech_desc {
d5b20d679b8a Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents: 2076
diff changeset
16 char *name;
2736
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
17 enum mech_security_flags flags;
2077
d5b20d679b8a Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents: 2076
diff changeset
18 };
d5b20d679b8a Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents: 2076
diff changeset
19
2267
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
20 struct auth_connect_id {
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
21 unsigned int server_pid;
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
22 unsigned int connect_uid;
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
23 };
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
24
2097
4e77cb0aff21 Added %l, %r and %P variables and mail_log_prefix setting.
Timo Sirainen <tss@iki.fi>
parents: 2082
diff changeset
25 struct auth_request_info {
4e77cb0aff21 Added %l, %r and %P variables and mail_log_prefix setting.
Timo Sirainen <tss@iki.fi>
parents: 2082
diff changeset
26 const char *mech;
2781
e44a84dc947c s/protocol/service/ in authentication
Timo Sirainen <tss@iki.fi>
parents: 2736
diff changeset
27 const char *service;
3635
c12df370e1b2 Added ssl_username_from_cert setting. Not actually tested yet..
Timo Sirainen <tss@iki.fi>
parents: 2781
diff changeset
28 const char *cert_username;
2736
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
29 enum auth_request_flags flags;
2097
4e77cb0aff21 Added %l, %r and %P variables and mail_log_prefix setting.
Timo Sirainen <tss@iki.fi>
parents: 2082
diff changeset
30
4e77cb0aff21 Added %l, %r and %P variables and mail_log_prefix setting.
Timo Sirainen <tss@iki.fi>
parents: 2082
diff changeset
31 struct ip_addr local_ip, remote_ip;
4e77cb0aff21 Added %l, %r and %P variables and mail_log_prefix setting.
Timo Sirainen <tss@iki.fi>
parents: 2082
diff changeset
32
2736
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
33 const char *initial_resp_base64;
2097
4e77cb0aff21 Added %l, %r and %P variables and mail_log_prefix setting.
Timo Sirainen <tss@iki.fi>
parents: 2082
diff changeset
34 };
4e77cb0aff21 Added %l, %r and %P variables and mail_log_prefix setting.
Timo Sirainen <tss@iki.fi>
parents: 2082
diff changeset
35
2736
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
36 typedef void auth_request_callback_t(struct auth_request *request, int status,
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
37 const char *data_base64,
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
38 const char *const *args, void *context);
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
39
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
40 typedef void auth_connect_notify_callback_t(struct auth_client *client,
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3635
diff changeset
41 bool connected, void *context);
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
42
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
43 /* Create new authentication client. */
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
44 struct auth_client *auth_client_new(unsigned int client_pid);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
45 void auth_client_free(struct auth_client **client);
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
46
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3635
diff changeset
47 bool auth_client_is_connected(struct auth_client *client);
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
48 void auth_client_set_connect_notify(struct auth_client *client,
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
49 auth_connect_notify_callback_t *callback,
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
50 void *context);
2077
d5b20d679b8a Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents: 2076
diff changeset
51 const struct auth_mech_desc *
d5b20d679b8a Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents: 2076
diff changeset
52 auth_client_get_available_mechs(struct auth_client *client,
d5b20d679b8a Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents: 2076
diff changeset
53 unsigned int *mech_count);
d5b20d679b8a Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents: 2076
diff changeset
54 const struct auth_mech_desc *
d5b20d679b8a Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents: 2076
diff changeset
55 auth_client_find_mech(struct auth_client *client, const char *name);
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
56
2267
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
57 /* Reserve connection for specific mechanism. The id can be given to
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
58 auth_client_request_new() to force it to use the same connection, or fail.
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
59 This is currently useful only for APOP authentication. Returns TRUE if
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
60 successfull. */
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3635
diff changeset
61 bool auth_client_reserve_connection(struct auth_client *client,
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3635
diff changeset
62 const char *mech,
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3635
diff changeset
63 struct auth_connect_id *id_r);
2267
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
64
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
65 /* Create a new authentication request. callback is called whenever something
2267
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
66 happens for the request. id can be NULL. */
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
67 struct auth_request *
2267
d2e186f716d8 Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2097
diff changeset
68 auth_client_request_new(struct auth_client *client, struct auth_connect_id *id,
2097
4e77cb0aff21 Added %l, %r and %P variables and mail_log_prefix setting.
Timo Sirainen <tss@iki.fi>
parents: 2082
diff changeset
69 const struct auth_request_info *request_info,
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
70 auth_request_callback_t *callback, void *context,
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
71 const char **error_r);
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
72
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
73 /* Continue authentication. Call when
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74 reply->result == AUTH_CLIENT_REQUEST_CONTINUE */
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
75 void auth_client_request_continue(struct auth_request *request,
2736
0f31778d3c34 Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents: 2267
diff changeset
76 const char *data_base64);
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
77
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
78 /* Abort ongoing authentication request. */
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
79 void auth_client_request_abort(struct auth_request *request);
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
80
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
81 /* Return ID of this request. */
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
82 unsigned int auth_client_request_get_id(struct auth_request *request);
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
83
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
84 /* Return the PID of the server that handled this request. */
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
85 unsigned int auth_client_request_get_server_pid(struct auth_request *request);
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
86
2082
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
87 /* -- Using lib-auth with external I/O loop -- */
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
88
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
89 typedef void *input_func_add_t(int fd, void (*cb)(void *), void *context);
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
90 typedef void *input_func_remove_t(void *io);
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
91
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
92 struct auth_client *auth_client_new_external(unsigned int client_pid,
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
93 const char *socket_paths,
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
94 input_func_add_t *add_func,
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
95 input_func_remove_t *remove_func);
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
96 /* Call every few seconds. */
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
97 void auth_client_connect_missing_servers(struct auth_client *client);
e22e3827a5f3 Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents: 2077
diff changeset
98
1702
43815588dd6b Moved client side code for auth process handling to lib-auth. Some other login process cleanups.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
99 #endif