r25177: if configured using --enable-socket-wrapper
authorStefan Metzmacher <metze@samba.org>
Sat, 15 Sep 2007 18:55:04 +0000 (18:55 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:30:48 +0000 (12:30 -0500)
allow overwritting the location of the WINBINDD_SOCKET_DIR
via an environment variable

metze
(This used to be commit 93bdd2724cc711005a5f2f223b499199394e78e7)

source3/nsswitch/wb_common.c
source3/nsswitch/winbind_struct_protocol.h

index bc65239b1b90d067735ec848059aedfcbb118ae2..2ae85dcb1ebb68ebdb0c6434645b101ac6c2e40c 100644 (file)
@@ -280,6 +280,20 @@ static int winbind_named_pipe_sock(const char *dir)
        return -1;
 }
 
+static const char *winbindd_socket_dir(void)
+{
+#ifdef SOCKET_WRAPPER
+       const char *env_dir;
+
+       env_dir = getenv(WINBINDD_SOCKET_DIR_ENVVAR);
+       if (env_dir) {
+               return env_dir;
+       }
+#endif
+
+       return WINBINDD_SOCKET_DIR;
+}
+
 /* Connect to winbindd socket */
 
 static int winbind_open_pipe_sock(int recursing, int need_priv)
@@ -308,7 +322,7 @@ static int winbind_open_pipe_sock(int recursing, int need_priv)
                return -1;
        }
 
-       if ((winbindd_fd = winbind_named_pipe_sock(WINBINDD_SOCKET_DIR)) == -1) {
+       if ((winbindd_fd = winbind_named_pipe_sock(winbindd_socket_dir())) == -1) {
                return -1;
        }
 
index fb09f3f75fbb70db02cf1b8babf215561439f134..645534b836a43f2824c2563dc217c3e3f06ec246 100644 (file)
 #define WINBINDD_SOCKET_DIR  "/tmp/.winbindd"  /* Name of PF_UNIX dir */
 #endif
 
+/*
+ * when compiled with socket_wrapper support
+ * the location of the WINBINDD_SOCKET_DIR
+ * can be overwritten via an environment variable
+ */
+#define WINBINDD_SOCKET_DIR_ENVVAR "WINBINDD_SOCKET_DIR"
+
 #define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged" /* name of subdirectory of lp_lockdir() to hold the 'privileged' pipe */
 #define WINBINDD_DOMAIN_ENV  "WINBINDD_DOMAIN" /* Environment variables */
 #define WINBINDD_DONT_ENV    "_NO_WINBINDD"