]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2959: remove SAMBAPREFIX dependency
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 11 Jan 2011 07:33:27 +0000 (00:33 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 11 Jan 2011 07:33:27 +0000 (00:33 -0700)
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.

helpers/basic_auth/SMB/Makefile.am
helpers/basic_auth/SMB/basic_smb_auth.cc
helpers/basic_auth/SMB/basic_smb_auth.sh
helpers/basic_auth/SMB/config.test
helpers/external_acl/wbinfo_group/config.test

index 0d52e7b3de8a923a9c2c6faf74dc37f6534d6dd9..561c3bca55017047165fde2f3a20fc3446ccc93b 100644 (file)
@@ -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) \
index 1f84f7f386dec51b1398ebc2380427d2128d7b78..bdaf3ca4863feabf4904a8a86299e8da5255e1b1 100644 (file)
@@ -197,10 +197,6 @@ main(int argc, char *argv[])
 
     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)
index 99f86150b361e405029169890245f1df1e998152..2a1abb3b6e970fde01ace15997453cd405dc1d76 100755 (executable)
@@ -47,13 +47,13 @@ else
   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 @@ export USER
 
 # 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
index f41b21fd12ec709d7b79571bfcdd0f2c1cf9e8f3..ece056001df8a0c5a60dcbbdd6687662070324e2 100755 (executable)
@@ -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
index fdaf038639ae1e918d170258b7d18808eb74697d..ea9995da349130e8088e5fca6a58c4fe6056cd9d 100755 (executable)
@@ -1,12 +1,18 @@
 #!/bin/sh
-
-for sambaprefix in ${SAMBAPREFIX} /usr/local /opt /opt/samba /usr/local/samba /usr
+samba_found="no"
+for sambaprefix in /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
+    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