main.c revision d11344383ad0a57379ec435bca21e0378af0b672
a8c5a86d183db25a57bf193c06b41e092ec2e151Timo Sirainen/* Copyright (C) 2002 Timo Sirainen */
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainenstatic void sig_quit(int signo __attr_unused__)
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainenstatic void auth_accept(void *context __attr_unused__, int listen_fd,
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainenstatic void main_init(void)
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainen /* open the syslog immediately so chroot() won't
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainen break logging */
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainen i_set_warning_handler(i_syslog_warning_handler);
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainen /* log failures into specified log file */
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainen i_set_failure_timestamp_format(getenv("IMAP_LOGSTAMP"));
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainen /* open /dev/urandom before chrooting */
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainen io_listen = io_add(LOGIN_LISTEN_FD, IO_READ, auth_accept, NULL);
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainenstatic void main_deinit(void)
dee43975a70bcdb9dc83d34d6a2b177d37bb7194Timo Sirainen i_warning("Killed with signal %d", lib_signal_kill);
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainenint main(int argc __attr_unused__, char *argv[] __attr_unused__)
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainen /* NOTE: we start rooted, so keep the code minimal until
24e5e4526d8f5cbc056ab97fd0d154d0936d7a5eTimo Sirainen restrict_access_by_env() is called */