dovecot-2.0: doveadm: Look up sockets from base_dir rather than ...

dovecot at dovecot.org dovecot at dovecot.org
Thu May 20 19:12:23 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/43a5acc09eb8
changeset: 11357:43a5acc09eb8
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 20 18:12:20 2010 +0200
description:
doveadm: Look up sockets from base_dir rather than hardcoded PKG_RUNDIR.

diffstat:

 src/doveadm/doveadm-auth.c     |  12 ++++++++----
 src/doveadm/doveadm-director.c |   3 ++-
 src/doveadm/doveadm-kick.c     |   2 +-
 src/doveadm/doveadm-penalty.c  |   2 +-
 src/doveadm/doveadm-settings.c |   2 ++
 src/doveadm/doveadm-settings.h |   1 +
 src/doveadm/doveadm-who.c      |   2 +-
 src/doveadm/doveadm.h          |   2 ++
 8 files changed, 18 insertions(+), 8 deletions(-)

diffs (120 lines):

diff -r 348eb4754085 -r 43a5acc09eb8 src/doveadm/doveadm-auth.c
--- a/src/doveadm/doveadm-auth.c	Thu May 20 17:16:39 2010 +0200
+++ b/src/doveadm/doveadm-auth.c	Thu May 20 18:12:20 2010 +0200
@@ -29,8 +29,10 @@
 	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 @@
 {
 	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);
diff -r 348eb4754085 -r 43a5acc09eb8 src/doveadm/doveadm-director.c
--- a/src/doveadm/doveadm-director.c	Thu May 20 17:16:39 2010 +0200
+++ b/src/doveadm/doveadm-director.c	Thu May 20 18:12:20 2010 +0200
@@ -62,7 +62,8 @@
 	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) {
diff -r 348eb4754085 -r 43a5acc09eb8 src/doveadm/doveadm-kick.c
--- a/src/doveadm/doveadm-kick.c	Thu May 20 17:16:39 2010 +0200
+++ b/src/doveadm/doveadm-kick.c	Thu May 20 18:12:20 2010 +0200
@@ -175,7 +175,7 @@
 	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);
diff -r 348eb4754085 -r 43a5acc09eb8 src/doveadm/doveadm-penalty.c
--- a/src/doveadm/doveadm-penalty.c	Thu May 20 17:16:39 2010 +0200
+++ b/src/doveadm/doveadm-penalty.c	Thu May 20 18:12:20 2010 +0200
@@ -98,7 +98,7 @@
 	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':
diff -r 348eb4754085 -r 43a5acc09eb8 src/doveadm/doveadm-settings.c
--- a/src/doveadm/doveadm-settings.c	Thu May 20 17:16:39 2010 +0200
+++ b/src/doveadm/doveadm-settings.c	Thu May 20 18:12:20 2010 +0200
@@ -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 @@
 };
 
 const struct doveadm_settings doveadm_default_settings = {
+	.base_dir = PKG_RUNDIR,
 	.mail_plugins = "",
 	.mail_plugin_dir = MODULEDIR
 };
diff -r 348eb4754085 -r 43a5acc09eb8 src/doveadm/doveadm-settings.h
--- a/src/doveadm/doveadm-settings.h	Thu May 20 17:16:39 2010 +0200
+++ b/src/doveadm/doveadm-settings.h	Thu May 20 18:12:20 2010 +0200
@@ -2,6 +2,7 @@
 #define DOVEADM_SETTINGS_H
 
 struct doveadm_settings {
+	const char *base_dir;
 	const char *mail_plugins;
 	const char *mail_plugin_dir;
 };
diff -r 348eb4754085 -r 43a5acc09eb8 src/doveadm/doveadm-who.c
--- a/src/doveadm/doveadm-who.c	Thu May 20 17:16:39 2010 +0200
+++ b/src/doveadm/doveadm-who.c	Thu May 20 18:12:20 2010 +0200
@@ -261,7 +261,7 @@
 	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);
diff -r 348eb4754085 -r 43a5acc09eb8 src/doveadm/doveadm.h
--- a/src/doveadm/doveadm.h	Thu May 20 17:16:39 2010 +0200
+++ b/src/doveadm/doveadm.h	Thu May 20 18:12:20 2010 +0200
@@ -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[]);


More information about the dovecot-cvs mailing list