Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/auth/auth-master-connection.c @ 2791:b12e61e55c01 HEAD
Put SPID back, it's needed for standalone dovecot-auth.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 20 Oct 2004 20:49:02 +0300 |
parents | 02c0b8d532c2 |
children | 0b1bef51f207 |
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 /* Copyright (C) 2002 Timo Sirainen */ |
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 |
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 #include "common.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
|
4 #include "buffer.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
|
5 #include "hash.h" |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
6 #include "str.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
|
7 #include "ioloop.h" |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
8 #include "istream.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
|
9 #include "ostream.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
|
10 #include "network.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
|
11 #include "mech.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
|
12 #include "userdb.h" |
2776
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
13 #include "auth-master-interface.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
|
14 #include "auth-client-connection.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
|
15 #include "auth-master-connection.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
|
16 |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
17 #include <unistd.h> |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
18 #include <stdlib.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
|
19 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
20 #define MAX_INBUF_SIZE 1024 |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
21 #define MAX_OUTBUF_SIZE (1024*50) |
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
|
22 |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
23 struct auth_listener { |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
24 struct auth_master_connection *master; |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
25 int client_listener; |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
26 int fd; |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
27 char *path; |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
28 struct io *io; |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
29 }; |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
30 |
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
|
31 struct master_userdb_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
|
32 struct auth_master_connection *conn; |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
33 unsigned int id; |
2754
3c3ac12be307
Created generic asynchronous SQL API and implemented MySQL and PostgreSQL
Timo Sirainen <tss@iki.fi>
parents:
2738
diff
changeset
|
34 struct auth_request *auth_request; |
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 }; |
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 |
2790
02c0b8d532c2
Changed ostream's flush callback to have return value which can tell if
Timo Sirainen <tss@iki.fi>
parents:
2776
diff
changeset
|
37 static int master_output(void *context); |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
38 static void auth_master_connection_close(struct auth_master_connection *conn); |
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 static int auth_master_connection_unref(struct auth_master_connection *conn); |
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 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
41 static void master_send(struct auth_master_connection *conn, |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
42 const char *fmt, ...) __attr_format__(2, 3); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
43 static void master_send(struct auth_master_connection *conn, |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
44 const char *fmt, ...) |
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
|
45 { |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
46 va_list args; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
47 string_t *str; |
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 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
49 t_push(); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
50 va_start(args, fmt); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
51 str = t_str_new(256); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
52 str_vprintfa(str, fmt, args); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
53 str_append_c(str, '\n'); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
54 (void)o_stream_send(conn->output, str_data(str), str_len(str)); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
55 va_end(args); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
56 t_pop(); |
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
|
57 } |
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 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
59 static void append_user_reply(string_t *str, const struct user_data *user) |
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
|
60 { |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
61 const char *p; |
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
|
62 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
63 str_printfa(str, "%s\tuid=%s\tgid=%s", user->virtual_user, |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
64 dec2str(user->uid), dec2str(user->gid)); |
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 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
66 if (user->system_user != NULL) |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
67 str_printfa(str, "\tsystem_user=%s", user->system_user); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
68 if (user->mail != NULL) |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
69 str_printfa(str, "\tmail=%s", user->mail); |
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 |
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 p = user->home != NULL ? strstr(user->home, "/./") : NULL; |
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 if (p == NULL) { |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
73 if (user->home != NULL) |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
74 str_printfa(str, "\thome=%s", user->home); |
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
|
75 } else { |
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
|
76 /* wu-ftpd like <chroot>/./<home> */ |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
77 str_printfa(str, "\thome=%s\tchroot=%s", |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
78 p + 3, t_strdup_until(user->home, p)); |
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
|
79 } |
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 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
82 static void userdb_callback(const struct user_data *user, 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
|
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 struct master_userdb_request *master_request = context; |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
85 string_t *str; |
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
|
86 |
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
|
87 if (auth_master_connection_unref(master_request->conn)) { |
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
|
88 if (user == NULL) { |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
89 master_send(master_request->conn, "NOTFOUND\t%u", |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
90 master_request->id); |
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
|
91 } else { |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
92 str = t_str_new(256); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
93 str_printfa(str, "USER\t%u\t", master_request->id); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
94 append_user_reply(str, user); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
95 master_send(master_request->conn, "%s", str_c(str)); |
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
|
96 } |
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
|
97 } |
2754
3c3ac12be307
Created generic asynchronous SQL API and implemented MySQL and PostgreSQL
Timo Sirainen <tss@iki.fi>
parents:
2738
diff
changeset
|
98 auth_request_destroy(master_request->auth_request); |
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 i_free(master_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
|
100 } |
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
|
101 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
102 static int |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
103 master_input_request(struct auth_master_connection *conn, const char *args) |
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
|
104 { |
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
|
105 struct auth_client_connection *client_conn; |
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
|
106 struct master_userdb_request *master_request; |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
107 struct auth_request *request; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
108 const char *const *list; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
109 unsigned int id, client_pid, client_id; |
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
|
110 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
111 /* <id> <client-pid> <client-id> */ |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
112 list = t_strsplit(args, "\t"); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
113 if (list[0] == NULL || list[1] == NULL || list[2] == NULL) { |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
114 i_error("BUG: Master sent broken REQUEST"); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
115 return FALSE; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
116 } |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
117 |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
118 id = (unsigned int)strtoul(list[0], NULL, 10); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
119 client_pid = (unsigned int)strtoul(list[1], NULL, 10); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
120 client_id = (unsigned int)strtoul(list[2], NULL, 10); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
121 |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
122 client_conn = auth_client_connection_lookup(conn, client_pid); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
123 request = client_conn == NULL ? 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
|
124 hash_lookup(client_conn->auth_requests, |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
125 POINTER_CAST(client_id)); |
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
|
126 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
127 if (request == 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
|
128 if (verbose) { |
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
|
129 i_info("Master request %u.%u not found", |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
130 client_pid, client_id); |
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
|
131 } |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
132 master_send(conn, "NOTFOUND\t%u", id); |
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
|
133 } else { |
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
|
134 master_request = i_new(struct master_userdb_request, 1); |
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
|
135 master_request->conn = conn; |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
136 master_request->id = id; |
2754
3c3ac12be307
Created generic asynchronous SQL API and implemented MySQL and PostgreSQL
Timo Sirainen <tss@iki.fi>
parents:
2738
diff
changeset
|
137 master_request->auth_request = request; |
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
|
138 |
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
|
139 conn->refcount++; |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
140 userdb->lookup(request, userdb_callback, master_request); |
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
|
141 } |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
142 return TRUE; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
143 } |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
144 |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
145 static int |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
146 master_input_die(struct auth_master_connection *conn) |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
147 { |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
148 return TRUE; |
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
|
149 } |
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
|
150 |
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
|
151 static void master_input(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
|
152 { |
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
|
153 struct auth_master_connection *conn = context; |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
154 char *line; |
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
|
155 int ret; |
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
|
156 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
157 switch (i_stream_read(conn->input)) { |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
158 case 0: |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
159 return; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
160 case -1: |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
161 /* disconnected */ |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
162 auth_master_connection_close(conn); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
163 return; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
164 case -2: |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
165 /* buffer full */ |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
166 i_error("BUG: Master sent us more than %d bytes", |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
167 (int)MAX_INBUF_SIZE); |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
168 auth_master_connection_close(conn); |
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
|
169 return; |
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
|
170 } |
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
|
171 |
2776
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
172 if (!conn->version_received) { |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
173 line = i_stream_next_line(conn->input); |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
174 if (line == NULL) |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
175 return; |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
176 |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
177 /* make sure the major version matches */ |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
178 if (strncmp(line, "VERSION\t", 8) != 0 || |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
179 atoi(t_strcut(line + 8, '.')) != |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
180 AUTH_MASTER_PROTOCOL_MAJOR_VERSION) { |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
181 i_error("Master not compatible with this server " |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
182 "(mixed old and new binaries?)"); |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
183 auth_master_connection_close(conn); |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
184 return; |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
185 } |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
186 conn->version_received = TRUE; |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
187 } |
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
188 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
189 while ((line = i_stream_next_line(conn->input)) != NULL) { |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
190 t_push(); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
191 if (strncmp(line, "REQUEST\t", 8) == 0) |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
192 ret = master_input_request(conn, line + 8); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
193 else if (strcmp(line, "DIE") == 0) |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
194 ret = master_input_die(conn); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
195 else { |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
196 /* ignore unknown command */ |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
197 ret = TRUE; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
198 } |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
199 t_pop(); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
200 |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
201 if (!ret) { |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
202 auth_master_connection_close(conn); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
203 return; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
204 } |
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
|
205 } |
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
|
206 } |
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
|
207 |
2790
02c0b8d532c2
Changed ostream's flush callback to have return value which can tell if
Timo Sirainen <tss@iki.fi>
parents:
2776
diff
changeset
|
208 static int master_output(void *context) |
2421
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
209 { |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
210 struct auth_master_connection *conn = context; |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
211 int ret; |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
212 |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
213 if ((ret = o_stream_flush(conn->output)) < 0) { |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
214 /* transmit error, probably master died */ |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
215 auth_master_connection_close(conn); |
2790
02c0b8d532c2
Changed ostream's flush callback to have return value which can tell if
Timo Sirainen <tss@iki.fi>
parents:
2776
diff
changeset
|
216 return 1; |
2421
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
217 } |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
218 |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
219 if (o_stream_get_buffer_used_size(conn->output) <= MAX_OUTBUF_SIZE/2) { |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
220 /* allow input again */ |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
221 conn->io = io_add(conn->fd, IO_READ, master_input, conn); |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
222 } |
2790
02c0b8d532c2
Changed ostream's flush callback to have return value which can tell if
Timo Sirainen <tss@iki.fi>
parents:
2776
diff
changeset
|
223 return 1; |
2421
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
224 } |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
225 |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
226 static void |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
227 auth_master_connection_set_fd(struct auth_master_connection *conn, int fd) |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
228 { |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
229 if (conn->input != NULL) |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
230 i_stream_unref(conn->input); |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
231 if (conn->output != NULL) |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
232 o_stream_unref(conn->output); |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
233 if (conn->io != NULL) |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
234 io_remove(conn->io); |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
235 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
236 conn->input = i_stream_create_file(fd, default_pool, |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
237 MAX_INBUF_SIZE, FALSE); |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
238 conn->output = o_stream_create_file(fd, default_pool, |
2421
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
239 (size_t)-1, FALSE); |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
240 o_stream_set_flush_callback(conn->output, master_output, conn); |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
241 conn->io = io_add(fd, IO_READ, master_input, conn); |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
242 |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
243 conn->fd = fd; |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
244 } |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
245 |
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
|
246 struct auth_master_connection * |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
247 auth_master_connection_create(int fd, unsigned int pid) |
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
|
248 { |
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
|
249 struct auth_master_connection *conn; |
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
|
250 |
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
|
251 conn = i_new(struct auth_master_connection, 1); |
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
|
252 conn->refcount = 1; |
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
|
253 conn->pid = 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
|
254 conn->fd = fd; |
2708
f1e9f3ec8135
Buffer API change: we no longer support limited sized buffers where
Timo Sirainen <tss@iki.fi>
parents:
2421
diff
changeset
|
255 conn->listeners_buf = buffer_create_dynamic(default_pool, 64); |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
256 if (fd != -1) |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
257 auth_master_connection_set_fd(conn, fd); |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
258 return conn; |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
259 } |
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
|
260 |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
261 void auth_master_connection_send_handshake(struct auth_master_connection *conn) |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
262 { |
2776
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
263 if (conn->output != NULL) { |
2791
b12e61e55c01
Put SPID back, it's needed for standalone dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2790
diff
changeset
|
264 master_send(conn, "VERSION\t%u.%u\nSPID\t%u\n", |
2776
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
265 AUTH_MASTER_PROTOCOL_MAJOR_VERSION, |
2791
b12e61e55c01
Put SPID back, it's needed for standalone dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2790
diff
changeset
|
266 AUTH_MASTER_PROTOCOL_MINOR_VERSION, conn->pid); |
2776
150f8151c971
Added VERSION command and checking to authentication protocol.
Timo Sirainen <tss@iki.fi>
parents:
2754
diff
changeset
|
267 } |
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
|
268 } |
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
|
269 |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
270 static void auth_master_connection_close(struct auth_master_connection *conn) |
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
|
271 { |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
272 if (!standalone) |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
273 io_loop_stop(ioloop); |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
274 |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
275 if (close(conn->fd) < 0) |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
276 i_error("close(): %m"); |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
277 conn->fd = -1; |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
278 |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
279 o_stream_close(conn->output); |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
280 conn->output = NULL; |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
281 |
2421
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
282 if (conn->io != NULL) { |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
283 io_remove(conn->io); |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
284 conn->io = NULL; |
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2267
diff
changeset
|
285 } |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
286 } |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
287 |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
288 void auth_master_connection_destroy(struct auth_master_connection *conn) |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
289 { |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
290 struct auth_listener **l; |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
291 size_t i, size; |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
292 |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
293 if (conn->destroyed) |
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
|
294 return; |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
295 conn->destroyed = TRUE; |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
296 |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
297 auth_client_connections_deinit(conn); |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
298 |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
299 if (conn->fd != -1) |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
300 auth_master_connection_close(conn); |
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
|
301 |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
302 l = buffer_get_modifyable_data(conn->listeners_buf, &size); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
303 size /= sizeof(*l); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
304 for (i = 0; i < size; i++) { |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
305 net_disconnect(l[i]->fd); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
306 io_remove(l[i]->io); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
307 if (l[i]->path != NULL) { |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
308 (void)unlink(l[i]->path); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
309 i_free(l[i]->path); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
310 } |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
311 i_free(l[i]); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
312 } |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
313 buffer_free(conn->listeners_buf); |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
2075
diff
changeset
|
314 conn->listeners_buf = 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
|
315 |
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
|
316 auth_master_connection_unref(conn); |
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
|
317 } |
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
|
318 |
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
|
319 static int auth_master_connection_unref(struct auth_master_connection *conn) |
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
|
320 { |
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
|
321 if (--conn->refcount > 0) |
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
|
322 return TRUE; |
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
|
323 |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
324 if (conn->output != NULL) |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
325 o_stream_unref(conn->output); |
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
|
326 i_free(conn); |
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
|
327 return FALSE; |
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
|
328 } |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
329 |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
330 static void auth_accept(void *context) |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
331 { |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
332 struct auth_listener *l = context; |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
333 int fd; |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
334 |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
335 fd = net_accept(l->fd, NULL, NULL); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
336 if (fd < 0) { |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
337 if (fd < -1) |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
338 i_fatal("accept() failed: %m"); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
339 } else { |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
340 net_set_nonblock(fd, TRUE); |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
341 if (l->client_listener) |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
342 (void)auth_client_connection_create(l->master, fd); |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
343 else { |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
344 /* we'll just replace the previous master.. */ |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
345 auth_master_connection_set_fd(l->master, fd); |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
346 auth_master_connection_send_handshake(l->master); |
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
347 } |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
348 } |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
349 } |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
350 |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
351 void auth_master_connection_add_listener(struct auth_master_connection *conn, |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
352 int fd, const char *path, int client) |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
353 { |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
354 struct auth_listener *l; |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
355 |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
356 l = i_new(struct auth_listener, 1); |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
357 l->master = conn; |
2236
43b82a35888d
Dovecot can now connect to externally running dovecot-auth.
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
358 l->client_listener = client; |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
359 l->fd = fd; |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
360 l->path = i_strdup(path); |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
2075
diff
changeset
|
361 l->io = io_add(fd, IO_READ, auth_accept, l); |
2075
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
362 |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
363 buffer_append(conn->listeners_buf, &l, sizeof(l)); |
5138b14889a6
dovecot-auth can now be run by itself, it listens in UNIX sockets specified
Timo Sirainen <tss@iki.fi>
parents:
2057
diff
changeset
|
364 } |