This removes the tricky SAMBAPREFIX variable which passes full-path information from the squid build machine down to the run-time host helper.

Such information is not always correct when crossing machines, and the binaries being run can easily be added to PATH in the run-time host environment instead.

The net result of doing this is removal of Samba from the build dependencies and increased availability of the basic_smb_auth and ext_wbinfo_group_acl helpers.

Amos
=== modified file 'helpers/basic_auth/SMB/Makefile.am'
--- helpers/basic_auth/SMB/Makefile.am	2010-11-01 23:54:02 +0000
+++ helpers/basic_auth/SMB/Makefile.am	2011-01-06 23:40:53 +0000
@@ -1,21 +1,9 @@
 include $(top_srcdir)/src/Common.am
 
-# SAMBAPREFIX must point to the directory where Samba has been installed.
-# By default, Samba is installed in /usr/local/samba. If you changed this
-# by using the --prefix option when configuring Samba, you need to change
-# SAMBAPREFIX accordingly.
-
-## FIXME: autoconf should test for the samba path.
-
-SMB_AUTH_HELPER	= basic_smb_auth.sh
-SAMBAPREFIX=/usr/local/samba
-SMB_AUTH_HELPER_PATH = $(libexecdir)/$(SMB_AUTH_HELPER)
-
-libexec_SCRIPTS	= $(SMB_AUTH_HELPER)
-
+libexec_SCRIPTS	= basic_smb_auth.sh
 libexec_PROGRAMS = basic_smb_auth
 basic_smb_auth_SOURCES= basic_smb_auth.cc
-basic_smb_auth_CXXFLAGS = -DSAMBAPREFIX=\"$(SAMBAPREFIX)\" -DHELPERSCRIPT=\"$(SMB_AUTH_HELPER_PATH)\"
+basic_smb_auth_CXXFLAGS = -DHELPERSCRIPT=\"$(libexecdir)/basic_smb_auth.sh\"
 basic_smb_auth_LDADD = \
 		$(top_builddir)/lib/libmiscencoding.la \
 		$(COMPAT_LIB) \

=== modified file 'helpers/basic_auth/SMB/basic_smb_auth.cc'
--- helpers/basic_auth/SMB/basic_smb_auth.cc	2010-09-14 03:19:52 +0000
+++ helpers/basic_auth/SMB/basic_smb_auth.cc	2011-01-06 23:38:59 +0000
@@ -197,10 +197,6 @@
 
     shcmd = debug_enabled ? HELPERSCRIPT : HELPERSCRIPT " > /dev/null 2>&1";
 
-    /* pass to helper script */
-    if (putenv((char *)"SAMBAPREFIX=" SAMBAPREFIX) != 0)
-        return 1;
-
     while (fgets(buf, HELPER_INPUT_BUFFER, stdin) != NULL) {
 
         if ((s = strchr(buf, '\n')) == NULL)

=== modified file 'helpers/basic_auth/SMB/basic_smb_auth.sh'
--- helpers/basic_auth/SMB/basic_smb_auth.sh	2010-01-02 12:06:08 +0000
+++ helpers/basic_auth/SMB/basic_smb_auth.sh	2011-01-06 23:38:35 +0000
@@ -47,13 +47,13 @@
   addropt=""
 fi
 echo "Query address options: $addropt"
-dcip=`$SAMBAPREFIX/bin/nmblookup $addropt "$PASSTHROUGH#1c" | awk '/^[0-9.]+ / { print $1 ; exit }'`
+dcip=`nmblookup $addropt "$PASSTHROUGH#1c" | awk '/^[0-9.]+ / { print $1 ; exit }'`
 echo "Domain controller IP address: $dcip"
 [ -n "$dcip" ] || exit 1
 
 # All right, we have the IP address of a domain controller,
 # but we need its name too
-dcname=`$SAMBAPREFIX/bin/nmblookup -A $dcip | awk '$2 == "<00>" { print $1 ; exit }'`
+dcname=`nmblookup -A $dcip | awk '$2 == "<00>" { print $1 ; exit }'`
 echo "Domain controller NETBIOS name: $dcname"
 [ -n "$dcname" ] || exit 1
 
@@ -63,7 +63,7 @@
 
 # Read the contents of the file $AUTHFILE on the $AUTHSHARE share
 authfilebs=`echo "$AUTHFILE" | tr / '\\\\'`
-authinfo=`$SAMBAPREFIX/bin/smbclient "//$dcname/$AUTHSHARE" -I $dcip -d 0 -E -W "$DOMAINNAME" -c "get $authfilebs -" 2>/dev/null`
+authinfo=`smbclient "//$dcname/$AUTHSHARE" -I $dcip -d 0 -E -W "$DOMAINNAME" -c "get $authfilebs -" 2>/dev/null`
 echo "Contents of //$dcname/$AUTHSHARE/$AUTHFILE: $authinfo"
 
 # Allow for both \n and \r\n end-of-line termination

=== modified file 'helpers/basic_auth/SMB/config.test'
--- helpers/basic_auth/SMB/config.test	2010-03-23 11:09:45 +0000
+++ helpers/basic_auth/SMB/config.test	2011-01-07 00:08:53 +0000
@@ -1,8 +1,10 @@
 #!/bin/sh
-for prefix in ${SAMBAPREFIX} /usr/local /opt /opt/samba /usr/local/samba /usr
+for prefix in /usr/local /opt /opt/samba /usr/local/samba /usr
 do
     if [ -x ${prefix}/bin/smbclient ]; then
         exit 0
     fi
 done
-exit 1
+echo "WARNING: Samba smbclient not found in default location. basic_smb_auth may not work on this machine"
+# allow script install anyway.
+exit 0

=== modified file 'helpers/external_acl/wbinfo_group/config.test'
--- helpers/external_acl/wbinfo_group/config.test	2010-03-23 15:45:39 +0000
+++ helpers/external_acl/wbinfo_group/config.test	2011-01-07 00:08:26 +0000
@@ -1,12 +1,18 @@
 #!/bin/sh
-
-for sambaprefix in ${SAMBAPREFIX} /usr/local /opt /opt/samba /usr/local/samba /usr
-do
-    for perlprefix in /usr /usr/local /opt /opt/perl
-    do
-        if [ -x $sambaprefix/bin/wbinfo -a -x $perlprefix/bin/perl ]; then
-            exit 0
-        fi
-    done
+samba_found="no"
+for sambaprefix in /usr/local /opt /opt/samba /usr/local/samba /usr
+do
+    if [ -x $sambaprefix/bin/wbinfo ]; then
+      samba_found="yes"
+    fi
+done
+if test "$samba_found" = "no"; then
+    echo "WARNING: Samba wbinfo not found in default location. ext_wbinfo_group_acl may not work on this machine"
+fi
+for perlprefix in /usr /usr/local /opt /opt/perl
+do
+    if [ -x $perlprefix/bin/perl ]; then
+        exit 0
+    fi
 done
 exit 1

Reply via email to