Author: metze
Date: 2007-09-15 18:55:04 +0000 (Sat, 15 Sep 2007)
New Revision: 25177

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25177

Log:
if configured using --enable-socket-wrapper
allow overwritting the location of the WINBINDD_SOCKET_DIR
via an environment variable

metze
Modified:
   branches/SAMBA_3_2/source/nsswitch/wb_common.c
   branches/SAMBA_3_2/source/nsswitch/winbind_struct_protocol.h


Changeset:
Modified: branches/SAMBA_3_2/source/nsswitch/wb_common.c
===================================================================
--- branches/SAMBA_3_2/source/nsswitch/wb_common.c      2007-09-15 15:31:54 UTC 
(rev 25176)
+++ branches/SAMBA_3_2/source/nsswitch/wb_common.c      2007-09-15 18:55:04 UTC 
(rev 25177)
@@ -280,6 +280,20 @@
        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 @@
                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;
        }
 

Modified: branches/SAMBA_3_2/source/nsswitch/winbind_struct_protocol.h
===================================================================
--- branches/SAMBA_3_2/source/nsswitch/winbind_struct_protocol.h        
2007-09-15 15:31:54 UTC (rev 25176)
+++ branches/SAMBA_3_2/source/nsswitch/winbind_struct_protocol.h        
2007-09-15 18:55:04 UTC (rev 25177)
@@ -27,6 +27,13 @@
 #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"

Reply via email to