#include "dovecot-version.h"
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
+#include <sysexits.h>
struct prefix_stack {
unsigned int prefix_idx;
}
}
+static void failure_exit_callback(int *status)
+{
+ /* don't use EX_CONFIG, because it often causes MTAs to bounce
+ the mails back. */
+ *status = EX_TEMPFAIL;
+}
+
int main(int argc, char *argv[])
{
enum config_dump_scope scope = CONFIG_DUMP_SCOPE_ALL;
int c, ret, ret2;
bool config_path_specified, expand_vars = FALSE, hide_key = FALSE;
+ if (getenv("USE_SYSEXITS") != NULL) {
+ /* we're coming from (e.g.) LDA */
+ i_set_failure_exit_callback(failure_exit_callback);
+ }
+
memset(&filter, 0, sizeof(filter));
master_service = master_service_init("config",
MASTER_SERVICE_FLAG_STANDALONE,
service_input.service = "lda";
service_input.username = user;
- service_flags |= MAIL_STORAGE_SERVICE_FLAG_DISALLOW_ROOT;
+ service_flags |= MAIL_STORAGE_SERVICE_FLAG_DISALLOW_ROOT |
+ MAIL_STORAGE_SERVICE_FLAG_USE_SYSEXITS;
storage_service = mail_storage_service_init(master_service, set_roots,
service_flags);
ret = mail_storage_service_lookup_next(storage_service, &service_input,
#include "write-full.h"
#include "str.h"
#include "eacces-error.h"
+#include "env-util.h"
#include "execv-const.h"
#include "settings-parser.h"
#include "master-service-private.h"
if (!service->keep_environment)
master_service_env_clean(input->preserve_home);
+ if (input->use_sysexits)
+ env_put("USE_SYSEXITS=1");
/* @UNSAFE */
conf_argv = t_new(const char *, 8 + (service->argc + 1) + 1);
const char *config_path;
bool preserve_home;
bool never_exec;
+ bool use_sysexits;
const char *module;
const char *service;
use $HOME */
set_input.preserve_home =
(ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) == 0;
+ set_input.use_sysexits =
+ (ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USE_SYSEXITS) != 0;
if (input != NULL) {
set_input.module = input->module;
/* Don't load plugins in _service_lookup() */
MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS = 0x100,
/* Don't close auth connections because of idling. */
- MAIL_STORAGE_SERVICE_FLAG_NO_IDLE_TIMEOUT = 0x200
+ MAIL_STORAGE_SERVICE_FLAG_NO_IDLE_TIMEOUT = 0x200,
+ /* When executing doveconf, tell it to use sysexits codes */
+ MAIL_STORAGE_SERVICE_FLAG_USE_SYSEXITS = 0x400
};
struct mail_storage_service_input {