Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/dict/main.c @ 9287:d7251058200c HEAD
maildir+deliver: Add all existing messages to uidlist if it doesn't exist yet.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 07 Aug 2009 13:24:13 -0400 |
parents | eed86bcc33aa |
children | 00cd9aacd03c |
rev | line source |
---|---|
8590
b9faf4db2a9f
Updated copyright notices to include year 2009.
Timo Sirainen <tss@iki.fi>
parents:
8231
diff
changeset
|
1 /* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */ |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
2 |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
3 #include "lib.h" |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
4 #include "lib-signals.h" |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
5 #include "ioloop.h" |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
6 #include "fd-close-on-exec.h" |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
7 #include "restrict-access.h" |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
8 #include "randgen.h" |
3967
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
9 #include "sql-api.h" |
4517
e661182eab75
Berkeley DB dict support is now enabled only when using --with-db configure option.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4390
diff
changeset
|
10 #include "dict.h" |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
11 #include "dict-client.h" |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
12 #include "dict-server.h" |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
13 #include "module-dir.h" |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
14 |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
15 #include <stdlib.h> |
4390
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
16 #include <unistd.h> |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
17 #include <syslog.h> |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
18 |
3853
b3e18b51c205
Start dict server automatically when a client tries to connect to it.
Timo Sirainen <tss@iki.fi>
parents:
3791
diff
changeset
|
19 #define DICT_MASTER_LISTENER_FD 3 |
b3e18b51c205
Start dict server automatically when a client tries to connect to it.
Timo Sirainen <tss@iki.fi>
parents:
3791
diff
changeset
|
20 |
8027
62cf70991cf2
extern/static fixes (from a sparse check by Diego Liziero)
Timo Sirainen <tss@iki.fi>
parents:
7109
diff
changeset
|
21 static struct ioloop *ioloop; |
4390
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
22 static struct io *log_io; |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
23 static struct module *modules; |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
24 static struct dict_server *dict_server; |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
25 |
8882
9f3968f49ceb
lib-signals: Changed callback API to return siginfo_t.
Timo Sirainen <tss@iki.fi>
parents:
8741
diff
changeset
|
26 static void sig_die(const siginfo_t *si, void *context ATTR_UNUSED) |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
27 { |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
28 /* warn about being killed because of some signal, except SIGINT (^C) |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
29 which is too common at least while testing :) */ |
8883
5361cb6afe9e
When a process is killed, show the signal code and the sending process's pid and uid.
Timo Sirainen <tss@iki.fi>
parents:
8882
diff
changeset
|
30 if (si->si_signo != SIGINT) { |
5361cb6afe9e
When a process is killed, show the signal code and the sending process's pid and uid.
Timo Sirainen <tss@iki.fi>
parents:
8882
diff
changeset
|
31 i_warning("Killed with signal %d (by pid=%s uid=%s code=%s)", |
5361cb6afe9e
When a process is killed, show the signal code and the sending process's pid and uid.
Timo Sirainen <tss@iki.fi>
parents:
8882
diff
changeset
|
32 si->si_signo, dec2str(si->si_pid), |
5361cb6afe9e
When a process is killed, show the signal code and the sending process's pid and uid.
Timo Sirainen <tss@iki.fi>
parents:
8882
diff
changeset
|
33 dec2str(si->si_uid), |
5361cb6afe9e
When a process is killed, show the signal code and the sending process's pid and uid.
Timo Sirainen <tss@iki.fi>
parents:
8882
diff
changeset
|
34 lib_signal_code_to_str(si->si_signo, si->si_code)); |
5361cb6afe9e
When a process is killed, show the signal code and the sending process's pid and uid.
Timo Sirainen <tss@iki.fi>
parents:
8882
diff
changeset
|
35 } |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
36 io_loop_stop(ioloop); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
37 } |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
38 |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6191
diff
changeset
|
39 static void log_error_callback(void *context ATTR_UNUSED) |
4390
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
40 { |
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
|
41 /* 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
|
42 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
|
43 |
4390
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
44 io_loop_stop(ioloop); |
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
45 } |
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
46 |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
47 static void drop_privileges(void) |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
48 { |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
49 /* Log file or syslog opening probably requires roots */ |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
50 i_set_failure_internal(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
51 |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
52 /* Maybe needed. Have to open /dev/urandom before possible |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
53 chrooting. */ |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
54 random_init(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
55 |
3967
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
56 /* Load built-in SQL drivers (if any) */ |
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
57 sql_drivers_init(); |
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
58 sql_drivers_register_all(); |
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
59 |
7109
e6823d781317
Reverted "environment array" changes. It broke overriding imap/pop3 settings
Timo Sirainen <tss@iki.fi>
parents:
7091
diff
changeset
|
60 restrict_access_by_env(FALSE); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
61 } |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
62 |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
63 static void main_init(void) |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
64 { |
5186
a7627141ec7f
Don't compare to PACKAGE_VERSION in lib/ core directly, rather make
Timo Sirainen <tss@iki.fi>
parents:
5148
diff
changeset
|
65 const char *version, *path; |
3853
b3e18b51c205
Start dict server automatically when a client tries to connect to it.
Timo Sirainen <tss@iki.fi>
parents:
3791
diff
changeset
|
66 int fd; |
b3e18b51c205
Start dict server automatically when a client tries to connect to it.
Timo Sirainen <tss@iki.fi>
parents:
3791
diff
changeset
|
67 |
5186
a7627141ec7f
Don't compare to PACKAGE_VERSION in lib/ core directly, rather make
Timo Sirainen <tss@iki.fi>
parents:
5148
diff
changeset
|
68 version = getenv("DOVECOT_VERSION"); |
a7627141ec7f
Don't compare to PACKAGE_VERSION in lib/ core directly, rather make
Timo Sirainen <tss@iki.fi>
parents:
5148
diff
changeset
|
69 if (version != NULL && strcmp(version, PACKAGE_VERSION) != 0) { |
4553
d1c0514754d5
Require that master's version number matches the child's, unless
Timo Sirainen <tss@iki.fi>
parents:
4517
diff
changeset
|
70 i_fatal("Dovecot version mismatch: " |
d1c0514754d5
Require that master's version number matches the child's, unless
Timo Sirainen <tss@iki.fi>
parents:
4517
diff
changeset
|
71 "Master is v%s, dict is v"PACKAGE_VERSION" " |
5186
a7627141ec7f
Don't compare to PACKAGE_VERSION in lib/ core directly, rather make
Timo Sirainen <tss@iki.fi>
parents:
5148
diff
changeset
|
72 "(if you don't care, set version_ignore=yes)", version); |
4553
d1c0514754d5
Require that master's version number matches the child's, unless
Timo Sirainen <tss@iki.fi>
parents:
4517
diff
changeset
|
73 } |
d1c0514754d5
Require that master's version number matches the child's, unless
Timo Sirainen <tss@iki.fi>
parents:
4517
diff
changeset
|
74 |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
75 lib_signals_init(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
76 lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
77 lib_signals_set_handler(SIGTERM, TRUE, sig_die, NULL); |
4903
204d7edc7cdc
Added context parameter type safety checks for most callback APIs.
Timo Sirainen <tss@iki.fi>
parents:
4553
diff
changeset
|
78 lib_signals_ignore(SIGPIPE, TRUE); |
204d7edc7cdc
Added context parameter type safety checks for most callback APIs.
Timo Sirainen <tss@iki.fi>
parents:
4553
diff
changeset
|
79 lib_signals_ignore(SIGALRM, FALSE); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
80 |
4390
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
81 /* If master dies, the log fd gets closed and we'll quit */ |
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
82 log_io = io_add(STDERR_FILENO, IO_ERROR, log_error_callback, NULL); |
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
83 |
6191
6793d8d934a8
Load plugins from $moduledir/dict/.
Timo Sirainen <tss@iki.fi>
parents:
5249
diff
changeset
|
84 modules = module_dir_load(DICT_MODULE_DIR, NULL, TRUE, version); |
5148
7f2c39d7a2cc
module_dir_load() doesn't call init() functions anymore. Added a new
Timo Sirainen <tss@iki.fi>
parents:
4903
diff
changeset
|
85 module_dir_init(modules); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
86 |
8231
5ed1662b3f5e
dict: Register dicts only after loading modules. This allows using SQL drivers from modules.
Timo Sirainen <tss@iki.fi>
parents:
8027
diff
changeset
|
87 /* Register only after loading modules. They may contain SQL drivers, |
5ed1662b3f5e
dict: Register dicts only after loading modules. This allows using SQL drivers from modules.
Timo Sirainen <tss@iki.fi>
parents:
8027
diff
changeset
|
88 which we'll need to register. */ |
5ed1662b3f5e
dict: Register dicts only after loading modules. This allows using SQL drivers from modules.
Timo Sirainen <tss@iki.fi>
parents:
8027
diff
changeset
|
89 dict_drivers_register_all(); |
5ed1662b3f5e
dict: Register dicts only after loading modules. This allows using SQL drivers from modules.
Timo Sirainen <tss@iki.fi>
parents:
8027
diff
changeset
|
90 |
3853
b3e18b51c205
Start dict server automatically when a client tries to connect to it.
Timo Sirainen <tss@iki.fi>
parents:
3791
diff
changeset
|
91 path = getenv("DICT_LISTEN_FROM_FD"); |
b3e18b51c205
Start dict server automatically when a client tries to connect to it.
Timo Sirainen <tss@iki.fi>
parents:
3791
diff
changeset
|
92 fd = path == NULL ? -1 : DICT_MASTER_LISTENER_FD; |
9174
eed86bcc33aa
dict proxy: Use base_dir as the default dict-server location.
Timo Sirainen <tss@iki.fi>
parents:
8883
diff
changeset
|
93 if (path == NULL) { |
eed86bcc33aa
dict proxy: Use base_dir as the default dict-server location.
Timo Sirainen <tss@iki.fi>
parents:
8883
diff
changeset
|
94 path = t_strconcat(getenv("BASE_DIR"), |
eed86bcc33aa
dict proxy: Use base_dir as the default dict-server location.
Timo Sirainen <tss@iki.fi>
parents:
8883
diff
changeset
|
95 DEFAULT_DICT_SERVER_SOCKET_FNAME, NULL); |
eed86bcc33aa
dict proxy: Use base_dir as the default dict-server location.
Timo Sirainen <tss@iki.fi>
parents:
8883
diff
changeset
|
96 } |
3853
b3e18b51c205
Start dict server automatically when a client tries to connect to it.
Timo Sirainen <tss@iki.fi>
parents:
3791
diff
changeset
|
97 |
b3e18b51c205
Start dict server automatically when a client tries to connect to it.
Timo Sirainen <tss@iki.fi>
parents:
3791
diff
changeset
|
98 dict_server = dict_server_init(path, fd); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
99 } |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
100 |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
101 static void main_deinit(void) |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
102 { |
4390
f0ac35961ae2
Make sure the process dies when the master process dies.
Timo Sirainen <tss@iki.fi>
parents:
4253
diff
changeset
|
103 io_remove(&log_io); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
104 dict_server_deinit(dict_server); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
105 |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
3853
diff
changeset
|
106 module_dir_unload(&modules); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
107 |
4517
e661182eab75
Berkeley DB dict support is now enabled only when using --with-db configure option.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4390
diff
changeset
|
108 dict_drivers_unregister_all(); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
109 |
3967
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
110 sql_drivers_deinit(); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
111 random_deinit(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
112 lib_signals_deinit(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
113 closelog(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
114 } |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
115 |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
116 int main(void) |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
117 { |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
118 #ifdef DEBUG |
3791 | 119 if (getenv("GDB") == NULL) |
3853
b3e18b51c205
Start dict server automatically when a client tries to connect to it.
Timo Sirainen <tss@iki.fi>
parents:
3791
diff
changeset
|
120 fd_debug_verify_leaks(DICT_MASTER_LISTENER_FD+1, 1024); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
121 #endif |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
122 |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
123 /* NOTE: we start rooted, so keep the code minimal until |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
124 restrict_access_by_env() is called */ |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
125 lib_init(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
126 drop_privileges(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
127 |
5249
784dc7224718
Removed pool parameter from io_loop_create()
Timo Sirainen <tss@iki.fi>
parents:
5186
diff
changeset
|
128 ioloop = io_loop_create(); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
129 |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
130 main_init(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
131 io_loop_run(ioloop); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
132 main_deinit(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
133 |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
3853
diff
changeset
|
134 io_loop_destroy(&ioloop); |
3787
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
135 lib_deinit(); |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
136 |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
137 return 0; |
40600601502e
Added dictinary lookup server and a "proxy" dict implementation to talk to
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
138 } |