ports/103170: [Maintainer Update] Some fixes to the net/samba3 port

Timur I. Bakeyev timur at gnu.org
Mon Sep 11 23:50:15 UTC 2006


>Number:         103170
>Category:       ports
>Synopsis:       [Maintainer Update] Some fixes to the net/samba3 port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 11 23:50:14 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Timur I. Bakeyev
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
>Environment:


System: FreeBSD 6.1-STABLE #0: Sun Jul  2 02:36:16 CEST 2006
    root at timur.home.bat.ru:/usr/src/sys/i386/compile/COMMON



>Description:


After recent release of Samba 3.0.23c and corresponding version of port several problems with it were reported back by the users.

None of them critical and don't change any relevant parts of the port, neither pkg-plist (at least, file list), so no need for REVISION version bumping. But that's left on the judgement of the commiter.

Changes are:

o Fix for the broken OPTIONS menu due overlong line. That address PR misc/103158 and ports/102980
o Fix build on FreeBSD 7. PR ports/102919
o Several fixes to the rc.d/samba script, as well as a new code. Should handle 'restart' properly now.
o Remove enforcement of a daemon shutdown during deinstallation due several requests.
o SAMBA_PRIVATEDIR is now can be redefined.


>How-To-Repeat:





>Fix:


--- samba3.diff begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/net/samba3/Makefile,v
retrieving revision 1.152
diff -u -r1.152 Makefile
--- Makefile	4 Sep 2006 19:00:17 -0000	1.152
+++ Makefile	10 Sep 2006 13:40:10 -0000
@@ -1,6 +1,6 @@
 # New ports collection makefile for:	samba
 # Date created:				11th Feb 1995
-# Whom:					Gary Palmer <gpalmer at FreeBSD.org>
+# Whom:					Gary Palmer <gpalmer>
 #
 # $FreeBSD: ports/net/samba3/Makefile,v 1.152 2006/09/04 19:00:17 garga Exp $
 #
@@ -36,7 +36,7 @@
 # DEPRECATED: This is an old location of the private dir
 SAMBA_PRIVATE?=		${PREFIX}/private
 SAMBA_CONFDIR?=		${PREFIX}/etc
-SAMBA_PRIVATEDIR=	${SAMBA_CONFDIR}/samba
+SAMBA_PRIVATEDIR?=	${SAMBA_CONFDIR}/samba
 SAMBA_CONFIG=		smb.conf
 SAMBA_LIB=		lib
 SAMBA_LIBDIR=		${PREFIX}/${SAMBA_LIB}
@@ -71,8 +71,8 @@
 		UTMP		"With UTMP accounting support" on \
 		MSDFS		"With MSDFS support" off \
 		SMBSH		"With SMBSH wrapper for UNIX commands" off \
-		PAM_SMBPASS	"With PAM authentication against passdb backend(s)" off \
-		EXP_MODULES	"With experimental module(s)" off \
+		PAM_SMBPASS	"With PAM authentication vs passdb backends" off \
+		EXP_MODULES	"With experimental modules" off \
 		POPT		"With system-wide POPT library" on
 .endif
 
@@ -372,16 +372,6 @@
 	@for d in `${FIND} ${SAMBA_MODULEDIR} -type d | ${SORT} -r`; do \
 	    ${ECHO_CMD} "@unexec ${RMDIR} $$d 2>/dev/null || true" >> ${TMPPLIST}; \
 	done
-# Taken from bsd.port.mk
-.if (${OSVERSION} >= 700007 || ( ${OSVERSION} < 700000 && ${OSVERSION} >= 600101 ))
-	@for i in ${USE_RC_SUBR}; do \
-	    ${ECHO_CMD} "@unexec %D/etc/rc.d/$${i%.sh} forcestop 2>/dev/null || true" >> ${TMPPLIST}; \
-	done
-.else
-	@for i in ${USE_RC_SUBR}; do \
-	    ${ECHO_CMD} "@unexec %D/etc/rc.d/$${i%.sh}.sh forcestop 2>/dev/null || true" >> ${TMPPLIST}; \
-	done
-.endif
 # Documentation
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
Index: files/patch-include_includes.h
===================================================================
RCS file: files/patch-include_includes.h
diff -N files/patch-include_includes.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-include_includes.h	7 Sep 2006 22:13:39 -0000
@@ -0,0 +1,16 @@
+--- include/includes.h.orig	Wed Aug 23 18:16:38 2006
++++ include/includes.h	Fri Sep  8 00:12:44 2006
+@@ -475,10 +475,10 @@
+ #undef HAVE_LDAP
+ #endif
+ 
+-#if HAVE_GSSAPI_H
+-#include <gssapi.h>
+-#elif HAVE_GSSAPI_GSSAPI_H
++#if HAVE_GSSAPI_GSSAPI_H
+ #include <gssapi/gssapi.h>
++#elif HAVE_GSSAPI_H
++#include <gssapi.h>
+ #elif HAVE_GSSAPI_GSSAPI_GENERIC_H
+ #include <gssapi/gssapi_generic.h>
+ #endif
Index: files/samba.in
===================================================================
RCS file: /home/ncvs/ports/net/samba3/files/samba.in,v
retrieving revision 1.2
diff -u -r1.2 samba.in
--- files/samba.in	4 Sep 2006 19:00:17 -0000	1.2
+++ files/samba.in	11 Sep 2006 01:38:14 -0000
@@ -9,109 +9,145 @@
 %%CUPSD%%# REQUIRE: cupsd
 # BEFORE: LOGIN
 # KEYWORD: shutdown
-
 #
-# Add the following lines to /etc/rc.conf to enable samba:
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
 #
 #samba_enable="YES"
-#
-# or, for fine grain control
-#
+# or, for fine grain control:
 #nmbd_enable="YES"
 #smbd_enable="YES"
 %%WINBIND%%# You need to enable winbindd separately, by adding:
 %%WINBIND%%#winbindd_enable="YES"
 #
+# Configuration file can be set with:
+#samba_config="%%SAMBA_CONFDIR%%/%%SAMBA_CONFIG%%"
+#
 
 . %%RC_SUBR%%
 
-name=samba
-rcvar=`set_rcvar`
-samba_enable=${samba_enable="NO"}
-testparm_command="%%PREFIX%%/bin/testparm"
-samba_parm="${testparm_command} -s -v --parameter-name"
+name="samba"
+rcvar=$(set_rcvar)
 
-load_rc_config $name
-# Set defaults
+load_rc_config "${name}"
+# Custom commands
+extra_commands="reload status"
+start_precmd="samba_start_precmd"
+start_cmd="samba_cmd"
+stop_cmd="samba_cmd"
+status_cmd="samba_cmd"
+restart_precmd="samba_checkconfig"
+reload_precmd="samba_checkconfig"
+reload_cmd="samba_reload_cmd"
+rcvar_cmd="samba_rcvar_cmd"
+# Defaults
+samba_enable=${samba_enable:="NO"}
 samba_config=${samba_config="%%SAMBA_CONFDIR%%/%%SAMBA_CONFIG%%"}
-# Config file is required
-if [ ! -r ${samba_config} ]; then
-    warn "${samba_config} is not readable."
-    case $1 in
-	force*) : ;;
-	*) exit 1 ;;
-    esac
-fi
-
-samba_idmap=`${samba_parm} 'idmap uid' ${samba_config} 2>/dev/null`
-samba_lockdir=`${samba_parm} 'lock directory' ${samba_config} 2>/dev/null`
-
-if test -n ${samba_enable="NO"} && checkyesno samba_enable; then
+samba_daemons="nmbd smbd"
+%%WINBIND%%samba_daemons="${samba_daemons} winbindd"
+testparm_command="%%PREFIX%%/bin/testparm"
+smbcontrol_command="%%PREFIX%%/bin/smbcontrol"
+# Fetch parameters from configuration file
+samba_parm="${testparm_command} -s -v --parameter-name"
+%%WINBIND%%samba_idmap=$(${samba_parm} 'idmap uid' ${samba_config} 2>/dev/null)
+samba_lockdir=$(${samba_parm} 'lock directory' ${samba_config} 2>/dev/null)
+# Setup slave variables
+if [ -n "${samba_enable}" ] && checkyesno samba_enable; then
     nmbd_enable=${nmbd_enable="YES"}
     smbd_enable=${smbd_enable="YES"}
-%%WINBIND%%    # Check that winbind is actually configured
-%%WINBIND%%    if [ -n ${samba_idmap} ]; then
-%%WINBIND%%	winbindd_enable="YES"
+%%WINBIND%%    # Check that winbindd is actually configured
+%%WINBIND%%    if [ -n "${samba_idmap}" ]; then
+%%WINBIND%%	winbindd_enable=${winbindd_enable="YES"}
 %%WINBIND%%    fi
 fi
+# Defaults for slave variables
+nmbd_enable=${nmbd_enable:="NO"}
+nmbd_flags=${nmbd_flags="-D"}
+smbd_enable=${smbd_enable:="NO"}
+smbd_flags=${smbd_flags="-D"}
+%%WINBIND%%winbindd_enable=${winbindd_enable:="NO"}
+%%WINBIND%%winbindd_flags=${winbindd_flags=""}
+# Requirements
+required_files="${samba_config}"
+required_dirs="${samba_lockdir}"
+command_args="${samba_config:+"-s ${samba_config}"}"
+#"
+samba_checkconfig() {
+    echo -n "Performing sanity check on Samba configuration: "
+    if ${testparm_command} -s ${samba_config} >/dev/null 2>&1; then
+	echo "OK"
+    else
+	echo "FAILED"
+	return 1
+    fi
+}
 
-nmbd_precmd() {
+samba_start_precmd() {
     # XXX: Never delete winbindd_idmap, winbindd_cache and group_mapping
-    echo -n "Starting Samba "
-    if [ -d ${samba_lockdir} ]; then
-	echo -n "- removing stale tdbs: "
-	for file in connections.tdb messages.tdb sessionid.tdb \
-		    unexpected.tdb brlock.tdb locking.tdb namelist.debug
+    if [ -d "${samba_lockdir}" ]; then
+	echo -n "Removing stale Samba tdb files: "
+	for file in brlock.tdb browse.dat connections.tdb gencache.tdb \
+		    locking.tdb messages.tdb namelist.debug sessionid.tdb \
+		    unexpected.tdb
 	do
-	    rm -vf "${samba_lockdir}/${file}"
+	    rm "${samba_lockdir}/${file}" </dev/null 2>/dev/null && echo -n '.'
 	done
+	echo " done"
     fi
-    echo '.'
 }
 
-# nmbd
-name=nmbd
-rcvar=`set_rcvar`
-command="%%PREFIX%%/sbin/${name}"
-required_dirs="${samba_lockdir}"
-pidfile="%%SAMBA_RUNDIR%%/${name}.pid"
-start_precmd="nmbd_precmd"
-# Defaults
-nmbd_enable=${nmbd_enable="NO"}
-nmbd_flags=${nmbd_flags="-D"}
-command_args="-s ${samba_config}"
+samba_rcvar_cmd() {
+    # Prevent recursive calling
+    unset ${rc_arg}_cmd ${rc_arg}_precmd ${rc_arg}_postcmd
+    # Check master variable
+    echo "# ${name}"
+    if [ -n "${rcvar}" ]; then
+	if checkyesno ${rcvar}; then
+	    echo "\$${rcvar}=YES"
+	else
+	    echo "\$${rcvar}=NO"
+	fi
+    fi
+    # Check slave variables
+    samba_cmd "${_rc_prefix}${rc_arg}" ${rc_extra_args}
+}
 
-load_rc_config $name
-run_rc_command "$1"
-_rc_restart_done=false
+samba_reload_cmd() {
+    local name rcvar
+    # Prevent recursive calling
+    unset ${rc_arg}_cmd ${rc_arg}_precmd ${rc_arg}_postcmd
+    # Apply to all the daemons
+    for name in ${samba_daemons}; do
+    	rcvar=$(set_rcvar)
+	command="%%PREFIX%%/sbin/${name}"
+	pidfile="%%SAMBA_RUNDIR%%/${name}.pid"
+	# Daemon should be enabled and running
+	if [ -n "${rcvar}" ] && checkyesno ${rcvar}; then
+	    if [ -n "$(check_pidfile "${pidfile}" "${command}")" ]; then
+		debug "reloading ${name} configuration"
+		echo "Reloading ${name}."
+		${smbcontrol_command} "${name}" 'reload-config' ${command_args}
+	    fi
+	fi
+    done
+}
 
-# smbd
-name=smbd
-rcvar=`set_rcvar`
-command="%%PREFIX%%/sbin/${name}"
-required_dirs="${samba_lockdir}"
-pidfile="%%SAMBA_RUNDIR%%/${name}.pid"
-start_precmd=":"
-# Defaults
-smbd_enable=${smbd_enable="NO"}
-smbd_flags=${smbd_flags="-D"}
-command_args="-s ${samba_config}"
+samba_cmd() {
+    local name rcvar
+    # Prevent recursive calling
+    unset ${rc_arg}_cmd ${rc_arg}_precmd ${rc_arg}_postcmd
+    # Stop processes in the reverse to order
+    if [ "${rc_arg}" = "stop" ] ; then
+	samba_daemons=$(reverse_list ${samba_daemons})
+    fi
+    # Apply to all the daemons
+    for name in ${samba_daemons}; do
+	rcvar=$(set_rcvar)
+	command="%%PREFIX%%/sbin/${name}"
+	pidfile="%%SAMBA_RUNDIR%%/${name}.pid"
+	
+	run_rc_command "${_rc_prefix}${rc_arg}" ${rc_extra_args}
+    done
+}
 
-load_rc_config $name
 run_rc_command "$1"
-%%WINBIND%%_rc_restart_done=false
-%%WINBIND%%
-%%WINBIND%%# winbindd
-%%WINBIND%%name=winbindd
-%%WINBIND%%rcvar=`set_rcvar`
-%%WINBIND%%command="%%PREFIX%%/sbin/${name}"
-%%WINBIND%%required_dirs="${samba_lockdir}"
-%%WINBIND%%pidfile="%%SAMBA_RUNDIR%%/${name}.pid"
-%%WINBIND%%start_precmd=":"
-%%WINBIND%%# Defaults
-%%WINBIND%%winbindd_enable=${winbindd_enable="NO"}
-%%WINBIND%%winbindd_flags=${winbindd_flags=""}
-%%WINBIND%%command_args="-s ${samba_config}"
-%%WINBIND%%
-%%WINBIND%%load_rc_config $name
-%%WINBIND%%run_rc_command "$1"
--- samba3.diff ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list