]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Look up sockets from base_dir rather than hardcoded PKG_RUNDIR.
authorTimo Sirainen <tss@iki.fi>
Thu, 20 May 2010 16:12:20 +0000 (18:12 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 20 May 2010 16:12:20 +0000 (18:12 +0200)
--HG--
branch : HEAD

src/doveadm/doveadm-auth.c
src/doveadm/doveadm-director.c
src/doveadm/doveadm-kick.c
src/doveadm/doveadm-penalty.c
src/doveadm/doveadm-settings.c
src/doveadm/doveadm-settings.h
src/doveadm/doveadm-who.c
src/doveadm/doveadm.h

index 0a944379908e5e5d9c1bff4f5f359f5f36d560c9..a9914553e330ed51928f52f5c4fd93d43ccac630 100644 (file)
@@ -29,8 +29,10 @@ cmd_user_input(const char *auth_socket_path, const struct authtest_input *input)
        const char *username, *const *fields, *p;
        int ret;
 
-       if (auth_socket_path == NULL)
-               auth_socket_path = PKG_RUNDIR"/auth-userdb";
+       if (auth_socket_path == NULL) {
+               auth_socket_path = t_strconcat(doveadm_settings->base_dir,
+                                              "/auth-userdb", NULL);
+       }
 
        pool = pool_alloconly_create("auth master lookup", 1024);
 
@@ -127,8 +129,10 @@ cmd_auth_input(const char *auth_socket_path, struct authtest_input *input)
 {
        struct auth_client *client;
 
-       if (auth_socket_path == NULL)
-               auth_socket_path = PKG_RUNDIR"/auth-client";
+       if (auth_socket_path == NULL) {
+               auth_socket_path = t_strconcat(doveadm_settings->base_dir,
+                                              "/auth-client", NULL);
+       }
 
        client = auth_client_init(auth_socket_path, getpid(), FALSE);
        auth_client_set_connect_notify(client, auth_connected, input);
index a90815efa1c83d25faaf02bb407f53282c03cd69..9aef7cbc150de7d35b6550691835a8f9fb6a0f91 100644 (file)
@@ -62,7 +62,8 @@ cmd_director_init(int argc, char *argv[], unsigned int cmd_idx)
        int c;
 
        ctx = t_new(struct director_context, 1);
-       ctx->socket_path = PKG_RUNDIR"/director-admin";
+       ctx->socket_path = t_strconcat(doveadm_settings->base_dir,
+                                      "/director-admin", NULL);
 
        while ((c = getopt(argc, argv, "a:")) > 0) {
                switch (c) {
index 9b85979190e42037e107d9a56a996a59ec1ada63..3159ccc284811b1b5529e20e20997e2345aa8a08 100644 (file)
@@ -175,7 +175,7 @@ static void cmd_kick(int argc, char *argv[])
        int c;
 
        memset(&ctx, 0, sizeof(ctx));
-       ctx.who.anvil_path = PKG_RUNDIR"/anvil";
+       ctx.who.anvil_path = t_strconcat(doveadm_settings->base_dir, "/anvil", NULL);
        ctx.force_kick = FALSE;
        ctx.who.pool = pool_alloconly_create("kick pids", 10240);
        ctx.pids = hash_table_create(default_pool, ctx.who.pool, 0, NULL, NULL);
index c81cf6fda003926e6c776caefa1ee365515b1c4d..cddda375fda227639b380c04aa798a35e782a1f6 100644 (file)
@@ -98,7 +98,7 @@ static void cmd_penalty(int argc, char *argv[])
        int c;
 
        memset(&ctx, 0, sizeof(ctx));
-       ctx.anvil_path = PKG_RUNDIR"/anvil";
+       ctx.anvil_path = t_strconcat(doveadm_settings->base_dir, "/anvil", NULL);
        while ((c = getopt(argc, argv, "a:")) > 0) {
                switch (c) {
                case 'a':
index 2b41918a6dfee6ca5dfef839094fe9b741083aa6..7d086752c3458ba1e6bb196ea81e3e0463ed5ca2 100644 (file)
@@ -9,6 +9,7 @@
        { type, #name, offsetof(struct doveadm_settings, name), NULL }
 
 static const struct setting_define doveadm_setting_defines[] = {
+       DEF(SET_STR, base_dir),
        DEF(SET_STR, mail_plugins),
        DEF(SET_STR, mail_plugin_dir),
 
@@ -16,6 +17,7 @@ static const struct setting_define doveadm_setting_defines[] = {
 };
 
 const struct doveadm_settings doveadm_default_settings = {
+       .base_dir = PKG_RUNDIR,
        .mail_plugins = "",
        .mail_plugin_dir = MODULEDIR
 };
index 8611042ca4a8b3b1fc9ed10f571f35a965632840..622ab46d7f85dfbcc8076e4406137bac4e331246 100644 (file)
@@ -2,6 +2,7 @@
 #define DOVEADM_SETTINGS_H
 
 struct doveadm_settings {
+       const char *base_dir;
        const char *mail_plugins;
        const char *mail_plugin_dir;
 };
index a61ddd0936e02e206940534c97d42876ef93471e..25bdeb41fe94360f74a7e531df52bdb82b0ca5a9 100644 (file)
@@ -261,7 +261,7 @@ static void cmd_who(int argc, char *argv[])
        int c;
 
        memset(&ctx, 0, sizeof(ctx));
-       ctx.anvil_path = PKG_RUNDIR"/anvil";
+       ctx.anvil_path = t_strconcat(doveadm_settings->base_dir, "/anvil", NULL);
        ctx.pool = pool_alloconly_create("who users", 10240);
        ctx.users = hash_table_create(default_pool, ctx.pool, 0,
                                      who_user_hash, who_user_cmp);
index 4ec0e46e2ebd10ea8ab8ef984809b636bdf7011a..7579cb79943b868a324cccdc453a54873977d9dc 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef DOVEADM_H
 #define DOVEADM_H
 
+#include "doveadm-settings.h"
+
 #define USAGE_CMDNAME_FMT "  %-12s"
 
 typedef void doveadm_command_t(int argc, char *argv[]);