Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib-auth/auth-server-connection.h @ 9638:9a50a9dc905f HEAD
dotlocks: Refresh current time after having waited for a lock.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 20 Jan 2011 23:17:05 +0200 |
parents | 5c25f5d7b29d |
children |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
4966
diff
changeset
|
1 #ifndef AUTH_SERVER_CONNECTION_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
4966
diff
changeset
|
2 #define AUTH_SERVER_CONNECTION_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
|
3 |
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
|
4 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
|
5 unsigned int pid; |
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_server_connection *connections; |
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 timeout *to_reconnect; |
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 |
4966
5df66ce64c0c
If no auth sockets are found in 10 seconds, kill ourself.
Timo Sirainen <tss@iki.fi>
parents:
4904
diff
changeset
|
10 time_t missing_sockets_start_time; |
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
|
11 unsigned int conn_waiting_handshake_count; |
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
|
12 |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1710
diff
changeset
|
13 buffer_t *available_auth_mechs; |
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
|
14 unsigned int request_id_counter; |
2970
e2876940968e
Connect to available auth sockets by round robin.
Timo Sirainen <tss@iki.fi>
parents:
2776
diff
changeset
|
15 unsigned int last_used_auth_process; |
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
|
16 |
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
|
17 auth_connect_notify_callback_t *connect_notify_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
|
18 void *connect_notify_context; |
2082
e22e3827a5f3
Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
19 |
e22e3827a5f3
Allow using more easily outside dovecot.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
20 unsigned int reconnect:1; |
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
|
21 }; |
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
|
22 |
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
|
23 struct auth_server_connection { |
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
|
24 struct auth_server_connection *next; |
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
|
25 |
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
|
26 pool_t pool; |
1710 | 27 int refcount; |
28 | |
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
|
29 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
|
30 const char *path; |
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
|
31 int fd; |
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
|
32 |
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
|
33 struct io *io; |
6626
5c25f5d7b29d
If auth server hasn't responded to handshake in 30 seconds, log an error and
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
34 struct timeout *to; |
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
|
35 struct istream *input; |
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
|
36 struct ostream *output; |
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
|
37 |
2267
d2e186f716d8
Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents:
2082
diff
changeset
|
38 unsigned int server_pid; |
d2e186f716d8
Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents:
2082
diff
changeset
|
39 unsigned int connect_uid; |
d2e186f716d8
Added APOP authentication for POP3. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents:
2082
diff
changeset
|
40 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
41 buffer_t *auth_mechs_buf; |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1710
diff
changeset
|
42 const struct auth_mech_desc *available_auth_mechs; |
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1710
diff
changeset
|
43 unsigned int available_auth_mechs_count; |
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
|
44 |
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
|
45 struct hash_table *requests; |
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 |
2776
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2736
diff
changeset
|
47 unsigned int version_received:1; |
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 unsigned int handshake_received:1; |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1710
diff
changeset
|
49 unsigned int has_plain_mech:1; |
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
|
50 }; |
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
|
51 |
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
|
52 struct auth_server_connection * |
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
|
53 auth_server_connection_new(struct auth_client *client, const char *path); |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
3863
diff
changeset
|
54 void auth_server_connection_destroy(struct auth_server_connection **conn, |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
2970
diff
changeset
|
55 bool reconnect); |
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 |
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
|
57 struct auth_server_connection * |
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
|
58 auth_server_connection_find_path(struct auth_client *client, const char *path); |
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
|
59 |
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
|
60 struct auth_server_connection * |
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
|
61 auth_server_connection_find_mech(struct auth_client *client, |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1710
diff
changeset
|
62 const char *name, const char **error_r); |
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
|
63 |
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
|
64 #endif |