Mercurial > dovecot > core-2.2
annotate src/pop3/main.c @ 9661:1780d56a9160 HEAD
imap/pop3: Compiling fix.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 26 Jul 2009 16:06:20 -0400 |
parents | ad5d34c9031d |
children | e11bd2547bb2 |
rev | line source |
---|---|
8590
b9faf4db2a9f
Updated copyright notices to include year 2009.
Timo Sirainen <tss@iki.fi>
parents:
8467
diff
changeset
|
1 /* Copyright (c) 2002-2009 Dovecot authors, see the included COPYING file */ |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
2 |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
9177
diff
changeset
|
3 #include "pop3-common.h" |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
4 #include "ioloop.h" |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
5 #include "istream.h" |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
6 #include "buffer.h" |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
7 #include "base64.h" |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
8 #include "restrict-access.h" |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
9 #include "process-title.h" |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
10 #include "master-service.h" |
9661 | 11 #include "master-interface.h" |
2976
96a4ab34c8f1
Added pop3_uidl_format setting.
Timo Sirainen <tss@iki.fi>
parents:
2952
diff
changeset
|
12 #include "var-expand.h" |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
13 #include "mail-storage-service.h" |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
14 |
2873
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
15 #include <stdio.h> |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
16 #include <stdlib.h> |
2873
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
17 #include <unistd.h> |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
18 |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
19 #define IS_STANDALONE() \ |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
20 (getenv("LOGGED_IN") == NULL) |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
21 |
1646 | 22 void (*hook_client_created)(struct client **client) = NULL; |
23 | |
4149
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
24 static struct io *log_io = NULL; |
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
25 |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6019
diff
changeset
|
26 static void log_error_callback(void *context ATTR_UNUSED) |
4149
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
27 { |
8741
d74fdb84ab8b
pop3/imap: When master closes our log fd, don't die when trying to log disconnect reason.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
28 /* the log fd is closed, don't die when trying to log later */ |
d74fdb84ab8b
pop3/imap: When master closes our log fd, don't die when trying to log disconnect reason.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
29 i_set_failure_ignore_errors(TRUE); |
d74fdb84ab8b
pop3/imap: When master closes our log fd, don't die when trying to log disconnect reason.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
30 |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
31 master_service_stop(master_service); |
4149
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
32 } |
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
33 |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
34 static bool main_init(const struct pop3_settings *set, struct mail_user *user) |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
35 { |
7927
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
36 struct client *client; |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
37 const char *str; |
7927
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
38 bool ret = TRUE; |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
39 |
9002
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
40 if (set->shutdown_clients) { |
4149
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
41 /* If master dies, the log fd gets closed and we'll quit */ |
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
42 log_io = io_add(STDERR_FILENO, IO_ERROR, |
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
43 log_error_callback, NULL); |
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
44 } |
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
45 |
9002
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
46 client = client_create(0, 1, user, set); |
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
47 if (client == NULL) |
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
48 return FALSE; |
7927
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
49 |
7928
9e226056a208
Send login command OK reply in IMAP/POP3 process.
Timo Sirainen <tss@iki.fi>
parents:
7927
diff
changeset
|
50 if (!IS_STANDALONE()) |
9e226056a208
Send login command OK reply in IMAP/POP3 process.
Timo Sirainen <tss@iki.fi>
parents:
7927
diff
changeset
|
51 client_send_line(client, "+OK Logged in."); |
9e226056a208
Send login command OK reply in IMAP/POP3 process.
Timo Sirainen <tss@iki.fi>
parents:
7927
diff
changeset
|
52 |
7927
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
53 str = getenv("CLIENT_INPUT"); |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
54 if (str != NULL) T_BEGIN { |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
55 buffer_t *buf = t_base64_decode_str(str); |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
56 if (buf->used > 0) { |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
57 if (!i_stream_add_data(client->input, buf->data, |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
58 buf->used)) |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
59 i_panic("Couldn't add client input to stream"); |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
60 ret = client_handle_input(client); |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
61 } |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
62 } T_END; |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
63 return ret; |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
64 } |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
65 |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
66 static void main_deinit(void) |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
67 { |
4149
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
68 if (log_io != NULL) |
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
69 io_remove(&log_io); |
9355
d6d4ec8ac06d
imap, pop3 no longer assume that there's only a single client in process.
Timo Sirainen <tss@iki.fi>
parents:
9348
diff
changeset
|
70 clients_destroy_all(); |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
71 } |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
72 |
9159
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
73 static void client_connected(const struct master_service_connection *conn) |
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
74 { |
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
75 /* we can't handle this yet */ |
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
76 (void)close(conn->fd); |
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
77 } |
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
78 |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
79 int main(int argc, char *argv[], char *envp[]) |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
80 { |
9106
fce3926fe910
mail_storage_service_init*() can now take multiple set_roots.
Timo Sirainen <tss@iki.fi>
parents:
9080
diff
changeset
|
81 const struct setting_parser_info *set_roots[] = { |
fce3926fe910
mail_storage_service_init*() can now take multiple set_roots.
Timo Sirainen <tss@iki.fi>
parents:
9080
diff
changeset
|
82 &pop3_setting_parser_info, |
fce3926fe910
mail_storage_service_init*() can now take multiple set_roots.
Timo Sirainen <tss@iki.fi>
parents:
9080
diff
changeset
|
83 NULL |
fce3926fe910
mail_storage_service_init*() can now take multiple set_roots.
Timo Sirainen <tss@iki.fi>
parents:
9080
diff
changeset
|
84 }; |
9381
315a480f9942
imap, pop3: Fixed assert-crash on exit.
Timo Sirainen <tss@iki.fi>
parents:
9355
diff
changeset
|
85 enum master_service_flags service_flags = |
315a480f9942
imap, pop3: Fixed assert-crash on exit.
Timo Sirainen <tss@iki.fi>
parents:
9355
diff
changeset
|
86 MASTER_SERVICE_FLAG_STD_CLIENT; |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
87 enum mail_storage_service_flags storage_service_flags = |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
88 MAIL_STORAGE_SERVICE_FLAG_DISALLOW_ROOT; |
9147
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
89 struct mail_storage_service_input input; |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
90 struct mail_user *mail_user; |
9002
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
91 const struct pop3_settings *set; |
9147
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
92 const char *value; |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
93 int c; |
9002
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
94 |
2873
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
95 if (IS_STANDALONE() && getuid() == 0 && |
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
96 net_getpeername(1, NULL, NULL) == 0) { |
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
97 printf("-ERR pop3 binary must not be started from " |
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
98 "inetd, use pop3-login instead.\n"); |
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
99 return 1; |
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
100 } |
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
101 |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
102 if (IS_STANDALONE()) |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
103 service_flags |= MASTER_SERVICE_FLAG_STANDALONE; |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
104 else |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
105 service_flags |= MAIL_STORAGE_SERVICE_FLAG_DISALLOW_ROOT; |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
106 |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
107 master_service = master_service_init("pop3", service_flags, argc, argv); |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
108 while ((c = getopt(argc, argv, master_service_getopt_string())) > 0) { |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
109 if (!master_service_parse_option(master_service, c, optarg)) |
9159
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
110 exit(FATAL_DEFAULT); |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
111 } |
9147
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
112 |
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
113 memset(&input, 0, sizeof(input)); |
9263
5d0a69504867
config handling fixes and improvements. Separated module/service lookups. Added support for per-lip/rip settings.
Timo Sirainen <tss@iki.fi>
parents:
9221
diff
changeset
|
114 input.module = "pop3"; |
5d0a69504867
config handling fixes and improvements. Separated module/service lookups. Added support for per-lip/rip settings.
Timo Sirainen <tss@iki.fi>
parents:
9221
diff
changeset
|
115 input.service = "pop3"; |
9147
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
116 input.username = getenv("USER"); |
9653
ad5d34c9031d
If imap/pop3 service is tried to be started without being auth_dest_service, log better error.
Timo Sirainen <tss@iki.fi>
parents:
9381
diff
changeset
|
117 if (input.username == NULL && IS_STANDALONE()) |
ad5d34c9031d
If imap/pop3 service is tried to be started without being auth_dest_service, log better error.
Timo Sirainen <tss@iki.fi>
parents:
9381
diff
changeset
|
118 input.username = getlogin(); |
9147
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
119 if (input.username == NULL) { |
9653
ad5d34c9031d
If imap/pop3 service is tried to be started without being auth_dest_service, log better error.
Timo Sirainen <tss@iki.fi>
parents:
9381
diff
changeset
|
120 if (getenv(MASTER_UID_ENV) == NULL) |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
121 i_fatal("USER environment missing"); |
9653
ad5d34c9031d
If imap/pop3 service is tried to be started without being auth_dest_service, log better error.
Timo Sirainen <tss@iki.fi>
parents:
9381
diff
changeset
|
122 else { |
ad5d34c9031d
If imap/pop3 service is tried to be started without being auth_dest_service, log better error.
Timo Sirainen <tss@iki.fi>
parents:
9381
diff
changeset
|
123 i_fatal("login_executable setting must be pop3-login, " |
ad5d34c9031d
If imap/pop3 service is tried to be started without being auth_dest_service, log better error.
Timo Sirainen <tss@iki.fi>
parents:
9381
diff
changeset
|
124 "not pop3"); |
ad5d34c9031d
If imap/pop3 service is tried to be started without being auth_dest_service, log better error.
Timo Sirainen <tss@iki.fi>
parents:
9381
diff
changeset
|
125 } |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
126 } |
9147
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
127 if ((value = getenv("IP")) != NULL) |
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
128 net_addr2ip(value, &input.remote_ip); |
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
129 if ((value = getenv("LOCAL_IP")) != NULL) |
bf448752f6c4
Pass remote/local IPs to mail_users. Standalone mail programs now log with mail_log_prefix.
Timo Sirainen <tss@iki.fi>
parents:
9106
diff
changeset
|
130 net_addr2ip(value, &input.local_ip); |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
131 |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
132 mail_user = mail_storage_service_init_user(master_service, |
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
133 &input, set_roots, |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
134 storage_service_flags); |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
135 set = mail_storage_service_get_settings(master_service); |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
136 restrict_access_allow_coredumps(TRUE); |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
137 |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
138 process_title_init(argv, envp); |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
139 |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
140 /* fake that we're running, so we know if client was destroyed |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
141 while initializing */ |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
142 io_loop_set_running(current_ioloop); |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
143 |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
144 if (main_init(set, mail_user)) |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
145 master_service_run(master_service, client_connected); |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
146 |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
147 main_deinit(); |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
148 mail_storage_service_deinit_user(); |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
149 master_service_deinit(&master_service); |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
150 return 0; |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
151 } |