while (true) {
const filter_hook_t *hook = filter_run(filter, query);
if (hook == NULL) {
- syslog(LOG_WARNING, "request aborted");
+ syslog(LOG_WARNING, "request client=%s, from=<%s>, to=<%s>: aborted",
+ query->client_name,
+ query->sender == NULL ? "undefined" : query->sender,
+ query->recipient == NULL ? "undefined" : query->recipient);
return false;
} else if (hook->postfix) {
+ syslog(LOG_INFO, "request client=%s, from=<%s>, to=<%s>: "
+ "awswer %s from filter %s",
+ query->client_name,
+ query->sender == NULL ? "undefined" : query->sender,
+ query->recipient == NULL ? "undefined" : query->recipient,
+ htokens[hook->type], filter->name);
policy_answer(pcy, "%s", hook->value);
return true;
} else {
return EXIT_FAILURE;
}
+ if (drop_privileges(RUNAS_USER, RUNAS_GROUP) < 0) {
+ syslog(LOG_CRIT, "unable to drop privileges");
+ return EXIT_FAILURE;
+ }
+
config_t *config = config_read(argv[optind]);
if (config == NULL) {
return EXIT_FAILURE;
config->port = port;
}
- if (common_setup(pidfile, false, RUNAS_USER, RUNAS_GROUP,
- daemonize) != EXIT_SUCCESS
+ if (common_setup(pidfile, true, NULL, NULL, daemonize) != EXIT_SUCCESS
|| start_listener(config->port) < 0) {
config_delete(&config);
return EXIT_FAILURE;
- }
- {
+ } else {
int res = server_loop(query_starter, (delete_client_t)query_delete,
policy_run, config_refresh, config);
config_delete(&config);