Mercurial > dovecot > core-2.2
annotate src/pop3/main.c @ 9653:ad5d34c9031d HEAD
If imap/pop3 service is tried to be started without being auth_dest_service, log better error.
If login_executable=imap/pop3, give better error message.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 24 Jul 2009 20:59:49 -0400 |
parents | 315a480f9942 |
children | 1780d56a9160 |
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" |
2976
96a4ab34c8f1
Added pop3_uidl_format setting.
Timo Sirainen <tss@iki.fi>
parents:
2952
diff
changeset
|
11 #include "var-expand.h" |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
12 #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
|
13 |
2873
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
14 #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
|
15 #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
|
16 #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
|
17 |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
18 #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
|
19 (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
|
20 |
1646 | 21 void (*hook_client_created)(struct client **client) = NULL; |
22 | |
4149
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
23 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
|
24 |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6019
diff
changeset
|
25 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
|
26 { |
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
|
27 /* 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
|
28 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
|
29 |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
30 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
|
31 } |
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
32 |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
33 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
|
34 { |
7927
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
35 struct client *client; |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
36 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
|
37 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
|
38 |
9002
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
39 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
|
40 /* 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
|
41 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
|
42 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
|
43 } |
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
44 |
9002
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
45 client = client_create(0, 1, user, set); |
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
46 if (client == NULL) |
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
47 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
|
48 |
7928
9e226056a208
Send login command OK reply in IMAP/POP3 process.
Timo Sirainen <tss@iki.fi>
parents:
7927
diff
changeset
|
49 if (!IS_STANDALONE()) |
9e226056a208
Send login command OK reply in IMAP/POP3 process.
Timo Sirainen <tss@iki.fi>
parents:
7927
diff
changeset
|
50 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
|
51 |
7927
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 buf->used)) |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
58 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
|
59 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
|
60 } |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
61 } T_END; |
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
62 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
|
63 } |
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 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
|
66 { |
4149
b10fa8ba01ca
When master dies (by closing log file descriptor), kill ourself also.
Timo Sirainen <tss@iki.fi>
parents:
4074
diff
changeset
|
67 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
|
68 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
|
69 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
|
70 } |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
71 |
9159
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
72 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
|
73 { |
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
74 /* 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
|
75 (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
|
76 } |
6324a79d3ee1
Initial commit for v2.0 master rewrite. Several features are still missing.
Timo Sirainen <tss@iki.fi>
parents:
9147
diff
changeset
|
77 |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
78 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
|
79 { |
9106
fce3926fe910
mail_storage_service_init*() can now take multiple set_roots.
Timo Sirainen <tss@iki.fi>
parents:
9080
diff
changeset
|
80 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
|
81 &pop3_setting_parser_info, |
fce3926fe910
mail_storage_service_init*() can now take multiple set_roots.
Timo Sirainen <tss@iki.fi>
parents:
9080
diff
changeset
|
82 NULL |
fce3926fe910
mail_storage_service_init*() can now take multiple set_roots.
Timo Sirainen <tss@iki.fi>
parents:
9080
diff
changeset
|
83 }; |
9381
315a480f9942
imap, pop3: Fixed assert-crash on exit.
Timo Sirainen <tss@iki.fi>
parents:
9355
diff
changeset
|
84 enum master_service_flags service_flags = |
315a480f9942
imap, pop3: Fixed assert-crash on exit.
Timo Sirainen <tss@iki.fi>
parents:
9355
diff
changeset
|
85 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
|
86 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
|
87 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
|
88 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
|
89 struct mail_user *mail_user; |
9002
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
90 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
|
91 const char *value; |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
92 int c; |
9002
9d0037a997f4
Initial commit for config rewrite.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
93 |
2873
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
94 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
|
95 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
|
96 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
|
97 "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
|
98 return 1; |
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
99 } |
72f28a4b964d
Make sure imap or pop3 processes cannot be started from inetd.
Timo Sirainen <tss@iki.fi>
parents:
2719
diff
changeset
|
100 |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
101 if (IS_STANDALONE()) |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
102 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
|
103 else |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
104 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
|
105 |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
106 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
|
107 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
|
108 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
|
109 exit(FATAL_DEFAULT); |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
110 } |
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
|
111 |
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 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 "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
|
124 } |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
125 } |
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
|
126 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
|
127 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
|
128 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
|
129 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
|
130 |
9348
0c587f108916
lib-master has now a global master_service variable that all binaries use.
Timo Sirainen <tss@iki.fi>
parents:
9263
diff
changeset
|
131 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
|
132 &input, set_roots, |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 |
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
137 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
|
138 |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
139 /* 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
|
140 while initializing */ |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
141 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
|
142 |
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
143 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
|
144 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
|
145 |
1043
cacabd33c68a
Initial code for POP3 server. RETR isn't working right yet, there's some
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
146 main_deinit(); |
9080
e560b92ed763
imap and pop3 now use mail-storage-service API.
Timo Sirainen <tss@iki.fi>
parents:
9059
diff
changeset
|
147 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
|
148 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
|
149 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
|
150 } |