[PC-BSD Commits] r20159 - in pcbsd/branches/9.1/src-sh/pc-adctl: . bin rc scripts

svn at pcbsd.org svn at pcbsd.org
Sat Nov 10 16:21:01 PST 2012


Author: kris
Date: 2012-11-11 00:21:01 +0000 (Sun, 11 Nov 2012)
New Revision: 20159

Added:
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-directory
Modified:
   pcbsd/branches/9.1/src-sh/pc-adctl/Makefile
   pcbsd/branches/9.1/src-sh/pc-adctl/bin/pc-adctl
   pcbsd/branches/9.1/src-sh/pc-adctl/bin/pc-ldapctl
   pcbsd/branches/9.1/src-sh/pc-adctl/rc/rc.activedirectory
   pcbsd/branches/9.1/src-sh/pc-adctl/rc/rc.ldap
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/Makefile
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-activedirectory
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-kerberos
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-kinit
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-ldap
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-nssldap
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-nsswitch
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-pam
   pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-samba
Log:

MFC recent changes to pc-adctl that John added to current



Modified: pcbsd/branches/9.1/src-sh/pc-adctl/Makefile
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/Makefile	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/Makefile	2012-11-11 00:21:01 UTC (rev 20159)
@@ -1,4 +1,4 @@
-SUBDIR=krb ldap nss nssldap pam samba scripts conf rc
+SUBDIR=pc-krbconf pc-ldapconf pc-nssconf pc-nssldapconf pc-pamconf pc-sambaconf scripts conf rc
 
 .include <bsd.subdir.mk>
 

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/bin/pc-adctl
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/bin/pc-adctl	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/bin/pc-adctl	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,10 +3,16 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-adctl
+# PROVIDE: pc_adctl
 
+. /etc/rc.conf
 . /usr/local/etc/rc.activedirectory
 
+pc_adctl_enable=${pc_activedirectory_enable-"NO"}
+
+name="pc_adctl"
+rcvar="pc_adctl_enable"
+
 adctl_cmd()
 {
 	local args="$*"
@@ -36,7 +42,7 @@
 
 adctl_start()
 {
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		adctl_cmd service pc-kerberos start
 		adctl_cmd service pc-nsswitch start
@@ -59,7 +65,6 @@
 		adctl_cmd service pc-activedirectory start
 		adctl_cmd service pc-activedirectory status
 		adctl_cmd service samba restart
-		adctl_cmd service pc-ad-ldap start
 	fi
 	
 	return 0
@@ -73,7 +78,7 @@
 
 adctl_stop()
 {
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		service pc-kerberos stop
 		service pc-nsswitch stop
@@ -91,13 +96,10 @@
 		else
 			adctl_cmd service samba start
 		fi
-
-		adctl_cmd service pc-ad-ldap stop
 	fi
 }
 
 
-name="pc-adctl"
 start_cmd='adctl_start'
 status_cmd='adctl_status'
 stop_cmd='adctl_stop'

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/bin/pc-ldapctl
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/bin/pc-ldapctl	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/bin/pc-ldapctl	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,10 +3,16 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-ldapctl
+# PROVIDE: pc_ldapctl
 
+. /etc/rc.conf
 . /usr/local/etc/rc.ldap
 
+pc_ldapctl_enable=${pc_ldap_enable-"NO"}
+
+name="pc_ldapctl"
+rcvar="pc_ldapctl_enable"
+
 ldapctl_assert()
 {
 	local args="$*"
@@ -21,7 +27,7 @@
 
 ldapctl_start()
 {
-	if checkyesno ldapclient_enable 2>/dev/null
+	if checkyesno pc_ldap_enable 2>/dev/null
 	then
 		ldapctl_assert service pc-nsswitch start
 		ldapctl_assert service pc-pam start
@@ -40,8 +46,6 @@
 		ldapctl_assert service pc-ldap start
 		ldapctl_assert service pc-nssldap start
 		ldapctl_assert service pc-ldap status
-
-		ldapctl_assert service pc-ad-ldap start
 	fi
 	
 	return 0
@@ -55,7 +59,7 @@
 
 ldapctl_stop()
 {
-	if checkyesno ldapclient_enable 2>/dev/null
+	if checkyesno pc_ldap_enable 2>/dev/null
 	then
 		service pc-nsswitch stop
 		service pc-pam stop
@@ -71,13 +75,10 @@
 		else
 			ldapctl_assert service samba start
 		fi
-
-		ldapctl_assert service pc-ad-ldap stop
 	fi
 }
 
 
-name="pc-ldapctl"
 start_cmd='ldapctl_start'
 status_cmd='ldapctl_status'
 stop_cmd='ldapctl_stop'

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/rc/rc.activedirectory
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/rc/rc.activedirectory	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/rc/rc.activedirectory	2012-11-11 00:21:01 UTC (rev 20159)
@@ -29,6 +29,7 @@
 #
 #	Active Directory config
 #
+: ${pc_activedirectory_enable:="NO"}
 : ${AD_CONF:="/usr/local/etc/pc-activedirectory.conf"}
 : ${AD_NET_CONF:="/usr/local/etc/pc-activedirectory-net.conf"}
 : ${AD_VAR_FILE:="/var/run/activedirectory"}

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/rc/rc.ldap
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/rc/rc.ldap	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/rc/rc.ldap	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,6 +3,7 @@
 #
 #	LDAP config
 #
+: ${pc_ldap_enable:="NO"}
 : ${PC_LDAP_CONF:="/usr/local/etc/pc-ldap.conf"}
 : ${PC_LDAP_VAR_FILE:="/var/run/pcldap"}
 

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/Makefile
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/Makefile	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/Makefile	2012-11-11 00:21:01 UTC (rev 20159)
@@ -1,5 +1,5 @@
 FILES=pc-activedirectory pc-kerberos pc-kinit pc-nsswitch pc-pam \
-	pc-samba pc-ldap pc-nssldap pc-ad-ldap
+	pc-samba pc-ldap pc-nssldap pc-directory
 
 FILESMODE=0555
 FILESDIR=/usr/local/etc/rc.d

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-activedirectory
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-activedirectory	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-activedirectory	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,22 +3,25 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-activedirectory
-# REQUIRE: pc-samba pc-kinit
+# PROVIDE: pc_activedirectory
+# REQUIRE: pc_samba pc_kinit
 # BEFORE: winbindd
 
+. /etc/rc.conf
 . /usr/local/etc/rc.activedirectory
 
+pc_activedirectory_join_enable=${pc_activedirectory_enable-"NO"}
+
+name="pc_activedirectory_join"
+rcvar="pc_activedirectory_join_enable"
+
 activedirectory_start()
 {
-	if checkyesno activedirectory_enable 2>/dev/null
-	then
-		AD_init
+	AD_init
 
-		AD_log "activedirectory_start: trying to join domain"
-		if ! AD_join_domain; then
-			return 1
-		fi
+	AD_log "activedirectory_start: trying to join domain"
+	if ! AD_join_domain; then
+		return 1
 	fi
 	
 	return 0
@@ -45,7 +48,7 @@
 }
 
 
-name="pc-activedirectory"
+extra_commands="status"
 start_cmd='activedirectory_start'
 status_cmd='activedirectory_status'
 stop_cmd='activedirectory_stop'

Index: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-directory
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-directory	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-directory	2012-11-11 00:21:01 UTC (rev 20159)

Property changes on: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-directory
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
Modified: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-kerberos
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-kerberos	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-kerberos	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,11 +3,17 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-kerberos
+# PROVIDE: pc_kerberos
 # BEFORE: kerberos
 
+. /etc/rc.conf
 . /usr/local/etc/rc.activedirectory
 
+pc_kerberos_enable=${pc_activedirectory_enable-"NO"}
+
+name="pc_kerberos"
+rcvar="pc_kerberos_enable"
+
 : ${PATH_KRB5_CONFIG:="/etc/krb5.conf"}
 : ${KRBCONF:="/usr/local/bin/pc-krbconf"}
 
@@ -89,32 +95,21 @@
 
 ad_krb5conf_start()
 {
-	if checkyesno activedirectory_enable 2>/dev/null
+	if AD_configured
 	then
-		if AD_configured
-		then
-			return 0
-		fi
-
-		generate_krb5_conf
-		return $?
+		return 0
 	fi
 
-	return 0
+	generate_krb5_conf
+	return $?
 }
 
 ad_krb5conf_stop()
 {
-	if checkyesno activedirectory_enable 2>/dev/null
-	then
-		cp "${PATH_KRB5_CONFIG}.orig" "${PATH_KRB5_CONFIG}"
-		return $?
-	fi
-
-	return 0
+	cp "${PATH_KRB5_CONFIG}.orig" "${PATH_KRB5_CONFIG}"
+	return $?
 }
 
-name="pc-kerberos"
 start_cmd='ad_krb5conf_start'
 stop_cmd='ad_krb5conf_stop'
         

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-kinit
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-kinit	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-kinit	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,91 +3,90 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-kinit
+# PROVIDE: pc_kinit
 # REQUIRE: kerberos
-# REQUIRE: pc-samba
+# REQUIRE: pc_samba
 # REQUIRE: ntpd
 
+. /etc/rc.conf
 . /usr/local/etc/rc.activedirectory
 
+pc_kinit_enable=${pc_activedirectory_enable-"NO"}
 
-kerberos_start()
+name="pc_kinit"
+rcvar="pc_kinit_enable"
+
+kinit_start()
 {
 	local re=1
 	local pwfile
 
-	if checkyesno activedirectory_enable 2>/dev/null
-	then
-		AD_init
+	AD_init
 
-		domainname=$(AD_get domainname)
-		adminname=$(AD_get adminname)
-		adminpw=$(AD_get adminpw)
+	local domainname=$(AD_get domainname)
+	local adminname=$(AD_get adminname)
+	local adminpw=$(AD_get adminpw)
 
-		if [ -n "${adminname}" -a -n "${domainname}" -a -n "${adminpw}" ]
-		then
-			domainname=$(echo "${domainname}" | tr a-z A-Z)
+	if [ -n "${adminname}" -a -n "${domainname}" -a -n "${adminpw}" ]
+	then
+		domainname=$(echo "${domainname}" | tr a-z A-Z)
 
-			pwfile=$(mktemp /tmp/tmp.XXXXXXXX)
-			printf "${adminpw}" > ${pwfile}
+		pwfile=$(mktemp /tmp/tmp.XXXXXXXX)
+		printf "${adminpw}" > ${pwfile}
 
-			AD_log "kerberos_start: kinit --password-file=${pwfile} " \
-			    "${adminname}@${domainname}"
-			kinit --password-file="${pwfile}" \
-			    "${adminname}@${domainname}"
-			res=$?
+		AD_log "kinit_start: kinit --password-file=${pwfile} " \
+		    "${adminname}@${domainname}"
+		kinit --password-file="${pwfile}" \
+		    "${adminname}@${domainname}"
+		res=$?
 
-			local ok="Failed"
-			if [ "${res}" = "0" ]
-			then
-				ok="Successful"
-			fi
+		local ok="Failed"
+		if [ "${res}" = "0" ]
+		then
+			ok="Successful"
+		fi
 
-			AD_log "kerberos_start: ${ok}"
-			rm -f "${pwfile}"
-			sleep 10
-		fi
+		AD_log "kinit_start: ${ok}"
+		rm -f "${pwfile}"
+		sleep 10
 	fi
 
 	return ${res}
 }
 
-kerberos_status()
+kinit_status()
 {
 	local res=1
 
-	if checkyesno activedirectory_enable 2>/dev/null
+	AD_init
+
+	local domainname=$(AD_get domainname)
+	local adminname=$(AD_get adminname)
+	local adminpw=$(AD_get adminpw)
+
+	if [ -n "${adminname}" -a -n "${domainname}" -a -n "${adminpw}" ]
 	then
-		AD_init
+		domainname=$(echo "${domainname}"|tr a-z A-Z)
 
-		domainname=$(AD_get domainname)
-		adminname=$(AD_get adminname)
-		adminpw=$(AD_get adminpw)
+		AD_log "kinit_status: klist -l | grep -q ^${adminname}@${domainname}"
+		klist -l | grep -q "^${adminname}@${domainname}"
+		res=$?
 
-		if [ -n "${adminname}" -a -n "${domainname}" -a -n "${adminpw}" ]
+		local ok="Failed"
+		if [ "${res}" = "0" ]
 		then
-			domainname=$(echo "${domainname}"|tr a-z A-Z)
+			ok="Successful"
+		fi
 
-			AD_log "kerberos_status: klist -l | grep -q ^${adminname}@${domainname}"
-			klist -l | grep -q "^${adminname}@${domainname}"
-			res=$?
-
-			local ok="Failed"
-			if [ "${res}" = "0" ]
-			then
-				ok="Successful"
-			fi
-
-			AD_log "kerberos_status: ${ok}"
-		fi
+		AD_log "kinit_status: ${ok}"
 	fi
 
 	return ${res}
 }
 
-kerberos_stop()
+kinit_stop()
 {
-	AD_log "kerberos_stop: kdestroy"
+	AD_log "kinit_stop: kdestroy"
 
 	kdestroy
 	local ok="Failed"
@@ -96,14 +95,14 @@
 		ok="Successful"
 	fi
 
-	AD_log "kerberos_stop: ${ok}"
+	AD_log "kinit_stop: ${ok}"
 	return 0
 }
 
-name="pc-kinit"
-start_cmd='kerberos_start'
-status_cmd='kerberos_status'
-stop_cmd='kerberos_stop'
+extra_commands="status"
+start_cmd='kinit_start'
+status_cmd='kinit_status'
+stop_cmd='kinit_stop'
 
 load_rc_config $name
 run_rc_command "$1"

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-ldap
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-ldap	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-ldap	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,11 +3,17 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-ldap
+# PROVIDE: pc_ldapconf
 # REQUIRE: root
 # BEFORE: NETWORK
 
+. /etc/rc.conf
 . /usr/local/etc/rc.ldap
+
+pc_ldapconf_enable=${pc_ldap_enable-"NO"}
+
+name="pc_ldapconf"
+rcvar="pc_ldapconf_enable"
     
 : ${OPENLDAP_CONF:="/usr/local/etc/openldap/ldap.conf"}
 : ${LDAPCONF:="/usr/local/bin/pc-ldapconf"}
@@ -126,7 +132,7 @@
 	return 0
 }
 
-ldap_status()
+ldapconf_status()
 {
 	local ret=0
 	local res=1
@@ -187,40 +193,30 @@
 	return ${ret}
 }
 
-ldap_start()
+ldapconf_start()
 {
-	if checkyesno ldapclient_enable 2>/dev/null
+	ldap_init
+	if ldap_configured
 	then
-		ldap_init
-		if ldap_configured
-		then
-			return 0
-		fi
-
-		backup_openldap_conf
-		generate_openldap_conf
-		return $?
+		return 0
 	fi
 
-	return 0
+	backup_openldap_conf
+	generate_openldap_conf
+	return $?
 }
 
-ldap_stop()
+ldapconf_stop()
 {
-	if  checkyesno ldapclient_enable 2>/dev/null
-	then
-		restore_openldap_conf
-		return $?
-	fi
+	restore_openldap_conf
+	return $?
 
-	return 0
 }
 
-
-name="pc-ldap"
-start_cmd='ldap_start'
-status_cmd='ldap_status'
-stop_cmd='ldap_stop'
+extra_commands="status"
+start_cmd='ldapconf_start'
+status_cmd='ldapconf_status'
+stop_cmd='ldapconf_stop'
             
 load_rc_config $name
 run_rc_command "$1"

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-nssldap
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-nssldap	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-nssldap	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,12 +3,18 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-nssldap
+# PROVIDE: pc_nssldapconf
 # REQUIRE: root
 # BEFORE: NETWORK
 
+. /etc/rc.conf
 . /usr/local/etc/rc.ldap
 . /usr/local/etc/rc.activedirectory
+
+: ${pc_nssldapconf_enable:="NO"}
+
+name="pc_nssldapconf"
+rcvar="pc_nssldapconf_enable"
     
 : ${NSS_LDAP_CONF:="/usr/local/etc/nss_ldap.conf"}
 : ${NSS_LDAP_SECRET:="/usr/local/etc/nss_ldap.secret"}
@@ -327,9 +333,9 @@
 	return 0
 }
 
-nssldap_start()
+nssldapconf_start()
 {
-	if checkyesno ldapclient_enable 2>/dev/null
+	if checkyesno pc_ldap_enable 2>/dev/null
 	then
 		ldap_init
 		if ldap_configured
@@ -341,7 +347,7 @@
 		generate_LDAP_nss_ldap_conf
 		return $?
 
-	elif checkyesno activedirectory_enable 2>/dev/null
+	elif checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		AD_init
 		if AD_configured
@@ -357,14 +363,14 @@
 	return 0
 }
 
-nssldap_stop()
+nssldapconf_stop()
 {
-	if  checkyesno ldapclient_enable 2>/dev/null
+	if  checkyesno pc_ldap_enable 2>/dev/null
 	then
 		restore_nss_ldap_conf
 		return $?
 
-	elif checkyesno activedirectory_enable 2>/dev/null
+	elif checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		restore_nss_ldap_conf
 		return $?
@@ -373,10 +379,20 @@
 	return 0
 }
 
-name="pc-nssldap"
-start_cmd='nssldap_start'
+extra_commands="status"
+start_cmd='nssldapconf_start'
 status_cmd=':'
-stop_cmd='nssldap_stop'
+stop_cmd='nssldapconf_stop'
             
 load_rc_config $name
+
+if [ "${pc_ldap_enable}" = "YES" ]
+then
+	pc_nssldapconf_enable="YES"
+
+elif [ "${pc_activedirectory_enable}" = "YES" ]
+then
+	pc_nssldapconf_enable="YES"
+fi
+
 run_rc_command "$1"

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-nsswitch
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-nsswitch	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-nsswitch	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,13 +3,19 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-nsswitch
+# PROVIDE: pc_nsswitch
 # REQUIRE: root
 # BEFORE: nsswitch
 
+. /etc/rc.conf
 . /usr/local/etc/rc.ldap
 . /usr/local/etc/rc.activedirectory
 
+: ${pc_nsswitch_enable:="NO"}
+
+name="pc_nsswitch"
+rcvar="pc_nsswitch_enable"
+
 : ${PATH_NS_CONF:="/etc/nsswitch.conf"}
 : ${NSSCONF:="/usr/local/bin/pc-nssconf"}
 
@@ -19,7 +25,7 @@
 	local conftype
 	local cmd="${NSSCONF}"
 
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		conftype='winbind'
 		doconf=1
@@ -30,7 +36,7 @@
 			return 0
 		fi
 
-	elif checkyesno ldapclient_enable 2>/dev/null
+	elif checkyesno pc_ldap_enable 2>/dev/null
 	then
 		conftype='ldap'
 		doconf=1
@@ -78,14 +84,14 @@
 	local conftype
 	local cmd="${NSSCONF}"
 
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		conftype='winbind'
 		doconf=1
 
 		AD_init
 
-	elif checkyesno ldapclient_enable 2>/dev/null
+	elif checkyesno pc_ldap_enable 2>/dev/null
 	then
 		conftype='ldap'
 		doconf=1
@@ -123,9 +129,18 @@
 }
 
 
-name="pc-nsswitch"
 start_cmd='nsswitch_conf_start'
 stop_cmd='nsswitch_conf_stop'
         
 load_rc_config $name
+
+if [ "${pc_ldap_enable}" = "YES" ]
+then
+	pc_nsswitch_enable="YES"
+
+elif [ "${pc_activedirectory_enable}" = "YES" ]
+then
+	pc_nsswitch_enable="YES"
+fi
+
 run_rc_command "$1"

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-pam
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-pam	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-pam	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,14 +3,20 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-pam
+# PROVIDE: pc_pam
 # REQUIRE: root
-# REQUIRE: pc-nsswitch
+# REQUIRE: pc_nsswitch
 # BEFORE: NETWORK
 
+. /etc/rc.conf
 . /usr/local/etc/rc.ldap
 . /usr/local/etc/rc.activedirectory
 
+: ${pc_pam_enable:="NO"}
+
+name="pc_pam"
+rcvar="pc_pam_enable"
+
 : ${DEFAULT_PAM_SERVICES:="gdm-autologin kde kde-np login sshd su xdm gdm sudo xscreensaver"}
 
 : ${PAMDIRS:="/etc/pam.d /usr/local/etc/pam.d"}
@@ -22,23 +28,55 @@
 : ${pam_krb5:="pam_krb5.so"}
 
 #
-# The default pam classes for the specified services is auth and session.
+# The default pam facilities for the specified services is auth and session.
 #
 # This can be further and fine tuned using this format:
-# activedirectory_pam_${service}="${classes}"
+# (activedirectory|ldap)_pam_${service}="${facilities}"
 #
 # eg:
 # activedirectory_pam_sshd="auth account session password"
 #
-# If you want all classes use ALL, if you want no classes, use NONE.
+# If you want all facilities use ALL, if you want no facilities , use NONE.
 #
+# More good stuff: 
+#
+# To specify specific placement of pam modules in pam files, you
+# can use this format:
+# 
+# (activedirectory|ldap)_pam_${service}_${facility}_index="${index}"
+#
+# eg:
+# activedirectory_pam_sshd_auth_index="2"
+#
+# This will place the pam_winbind.so module at index 2 in the auth
+# section (if it exists, otherwise, it will be placed less than 2
+# at the end, or the beginning of no modules are specified.
+#
+# (activedirectory|ldap)_pam_${service}_${facility}_before="${module}"
+#
+# eg:
+# activedirectory_pam_sshd_auth_before="pam_unix.so"
+#
+# This places pam_winbind.so right before pam_unix.so
+#
+# (activedirectory|ldap)_pam_${service}_${facility}_after="${module}"
+#
+# eg:
+# activedirectory_pam_sshd_auth_after="pam_krb5.so"
+#
+# This places pam_winbind.so right after pam_krb5.so
+#
 
-: ${activedirectory_pam_classes:="auth session"}
+: ${activedirectory_pam_facilities:="auth session"}
 : ${activedirectory_pam_services:="${DEFAULT_PAM_SERVICES}"}
 
-: ${ldapclient_pam_classes:="auth session"}
-: ${ldapclient_pam_services:="${DEFAULT_PAM_SERVICES}"}
+: ${ldap_pam_facilities:="auth session"}
+: ${ldap_pam_services:="${DEFAULT_PAM_SERVICES}"}
 
+#
+# PC-BSD specifics
+#
+activedirectory_pam_gdm_auth_before="pam_unix.so"
 
 in_pam_services()
 {
@@ -68,21 +106,83 @@
 	return ${res}
 }
 
+__getvar()
+{
+	local name="${1}"
+	local tmp="$(echo ${name}|tr '.-' _)"
+	local var=""
 
+	if checkyesno pc_activedirectory_enable 2>/dev/null
+	then
+		var="\$$(printf "activedirectory_pam_${tmp}")"
+
+	elif checkyesno pc_ldap_enable 2>/dev/null
+	then
+		var="\$$(printf "ldap_pam_${tmp}")"
+
+	else
+		var="${tmp}"	
+	fi
+
+	echo "${var}"
+}
+
+__getval()
+{
+	local var="${1}"
+	local val="$(eval "echo ${var} 2>/dev/null")"
+
+	echo "${val}"
+}
+
+__pam_var_isset()
+{
+	local service="${1}"
+	local var
+	local val
+
+	if checkyesno pc_activedirectory_enable 2>/dev/null
+	then
+		local tmp="$(echo ${service}|tr '.-' _)"
+
+		var=\$$(printf "activedirectory_pam_${tmp}")
+		val=$(eval "echo ${var} 2>/dev/null")
+
+		if [ -n "${val}" ]
+		then
+			return 0
+		fi
+
+	elif checkyesno pc_ldap_enable 2>/dev/null
+	then
+		local tmp="$(echo ${service}|tr '.-' _)"
+
+		var=\$$(printf "ldap_pam_${tmp}")
+		val=$(eval "echo ${var} 2>/dev/null")
+
+		if [ -n "${val}" ]
+		then
+			return 0
+		fi
+	fi
+
+	return 1
+}
+
 do_pam_var_isset()
 {
 	local service="${1}"
-	local class="${2}"
+	local facility="${2}"
 	local check=0
 	local var
 	local val
 
-	if [ -z "${service}" -o -z "${class}" ]
+	if [ -z "${service}" -o -z "${facility}" ]
 	then
 		return 1
 	fi
 
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		local tmp="$(echo ${service}|tr '.-' _)"
 
@@ -91,21 +191,21 @@
 
 		if [ -z "${val}" ]
 		then
-			val="${activedirectory_pam_classes}"
+			val="${activedirectory_pam_facilities}"
 		fi
 
 		check=1
 
-	elif checkyesno ldapclient_enable 2>/dev/null
+	elif checkyesno pc_ldap_enable 2>/dev/null
 	then
 		local tmp="$(echo ${service}|tr '.-' _)"
 
-		var=\$$(printf "ldapclient_pam_${tmp}")
+		var=\$$(printf "ldap_pam_${tmp}")
 		val=$(eval "echo ${var} 2>/dev/null")
 
 		if [ -z "${val}" ]
 		then
-			val="${ldapclient_pam_classes}"
+			val="${ldap_pam_facilities}"
 		fi
 
 		check=1
@@ -130,7 +230,7 @@
 
 		for s in ${val}
 		do
-			if [ "${s}" = "${class}" ]
+			if [ "${s}" = "${facility}" ]
 			then
 				return 0
 			fi
@@ -143,10 +243,15 @@
 get_index()
 {
 	local file="${1}"
-	local class="${2}"
+	local facility="${2}"
 	local index
 
-	index="$(egrep "^${class}" "${file}"|awk '{ printf("%d %s\n", n++, $0); }'|egrep sufficient|awk '{ print $1 }'|tail -1)"
+	index="$(egrep "^${facility}" "${file}" | \
+		awk '{ printf("%d %s\n", n++, $0); }' | \
+		egrep sufficient | \
+		awk '{ print $1 }' | \
+		tail -1)"
+
 	if [ -z "${index}" ]
 	then
 		index=0
@@ -156,6 +261,25 @@
 	echo "${index}"
 }
 
+get_module_index()
+{
+	local file="${1}"
+	local facility="${2}"
+	local module="${3}"
+
+	if [ -z "${file}" -o -z "${facility}" -o -z "${module}" ]
+	then
+		return 1
+	fi
+
+	egrep "^${facility}" "${file}" | \
+		awk '{ printf("%d %s\n", n++, $0); }' | \
+		egrep "${module}" | \
+		awk '{ print $1 }'
+
+	return 0
+}
+
 get_auth_index()
 {
 	get_index "${1}" "auth"
@@ -176,30 +300,182 @@
 	get_index "${1}" "password"
 }
 
+get_pam_auth()
+{
+	__getval $(__getvar "${1}_auth")
+}
+
 pam_auth_isset()
 {
 	do_pam_var_isset "${1}" "auth"
 	return $?
 }
 
+get_pam_auth_index()
+{
+	__getval $(__getvar "${1}_auth_index")
+}
+
+pam_auth_index_isset()
+{
+	__pam_var_isset "${1}_auth_index"
+	return $?
+}
+
+get_pam_auth_before()
+{
+	__getval $(__getvar "${1}_auth_before")
+}
+
+pam_auth_before_isset()
+{
+	__pam_var_isset "${1}_auth_before"
+	return $?
+}
+
+get_pam_auth_after()
+{
+	__getval $(__getvar "${1}_auth_after")
+}
+
+pam_auth_after_isset()
+{
+	__pam_var_isset "${1}_auth_after"
+	return $?
+}
+
+get_pam_account()
+{
+	__getval $(__getvar "${1}_account")
+}
+
 pam_account_isset()
 {
 	do_pam_var_isset "${1}" "account"
 	return $?
 }
 
+get_pam_account_index()
+{
+	__getval $(__getvar "${1}_account_index")
+}
+
+pam_account_index_isset()
+{
+	__pam_var_isset "${1}_account_index"
+	return $?
+}
+
+get_pam_account_before()
+{
+	__getval $(__getvar "${1}_account_before")
+}
+
+pam_account_before_isset()
+{
+	__pam_var_isset "${1}_account_before"
+	return $?
+}
+
+get_pam_account_after()
+{
+	__getval $(__getvar "${1}_account_after")
+}
+
+pam_account_after_isset()
+{
+	__pam_var_isset "${1}_account_after"
+	return $?
+}
+
+get_pam_session()
+{
+	__getval $(__getvar "${1}_session")
+}
+
 pam_session_isset()
 {
 	do_pam_var_isset "${1}" "session"
 	return $?
 }
 
+get_pam_session_index()
+{
+	__getval $(__getvar "${1}_session_index")
+}
+
+pam_session_index_isset()
+{
+	__pam_var_isset "${1}_session_index"
+	return $?
+}
+
+get_pam_session_before()
+{
+	__getval $(__getvar "${1}_session_before")
+}
+
+pam_session_before_isset()
+{
+	__pam_var_isset "${1}_session_before"
+	return $?
+}
+
+get_pam_session_after()
+{
+	__getval $(__getvar "${1}_session_after")
+}
+
+pam_session_after_isset()
+{
+	__pam_var_isset "${1}_session_after"
+	return $?
+}
+
+get_pam_password()
+{
+	__getval $(__getvar "${1}_password")
+}
+
 pam_password_isset()
 {
 	do_pam_var_isset "${1}" "password"
 	return $?
 }
 
+get_pam_password_index()
+{
+	__getval $(__getvar "${1}_password_index")
+}
+
+pam_password_index_isset()
+{
+	__pam_var_isset "${1}_password_index"
+	return $?
+}
+
+get_pam_password_before()
+{
+	__getval $(__getvar "${1}_password_before")
+}
+
+pam_password_before_isset()
+{
+	__pam_var_isset "${1}_password_before"
+	return $?
+}
+
+get_pam_password_after()
+{
+	__getval $(__getvar "${1}_password_after")
+}
+
+pam_password_after_isset()
+{
+	__pam_var_isset "${1}_password_after"
+	return $?
+}
+
 pam_service_configured()
 {
 	local pam_file="${1}"
@@ -215,6 +491,210 @@
 	return $?
 }
 
+do_pam_auth_conf()
+{
+	local pam_file="${1}"
+	local s="${2}"
+	local auth="${3}"
+	local __auth
+
+	if pam_auth_isset "${s}"
+	then
+		if pam_auth_index_isset "${s}"
+		then
+			local index="$(get_pam_auth_index "${s}")"
+			__auth="-m "$(echo "${auth}" | sed -E "s|^\+|+${index}|")""
+
+		elif pam_auth_before_isset "${s}"
+		then
+			local before="$(get_pam_auth_before "${s}")"
+			local index="$(get_module_index "${pam_file}" auth "${before}")"
+
+			if [ "${index}" -gt "0" ]
+			then
+				index=$(( index -= 1 ))
+			fi
+			__auth="-m "$(echo "${auth}" | sed -E "s|^\+|+${index}|")""
+
+		elif pam_auth_after_isset "${s}"
+		then
+			local before="$(get_pam_auth_after "${s}")"
+			local index="$(get_module_index "${pam_file}" auth "${after}")"
+
+			index=$(( index += 1 ))
+			__auth="-m "$(echo "${auth}" | sed -E "s|^\+|+${index}|")""
+
+		elif echo "${auth}" | egrep -q '^(+|^)' && \
+			! pam_service_configured "${pam_file}" "${auth}"
+		then
+			local index="$(get_auth_index "${pam_file}")"
+			__auth="-m "$(echo "${auth}" | sed -E "s|^\+|+${index}|")""
+
+		elif echo "${auth}" | egrep -q '^-'
+		then
+			__auth="-m "${auth}""
+		fi
+	else
+		__auth=""
+	fi
+
+	echo "${__auth}"
+}
+
+do_pam_account_conf()
+{
+	local pam_file="${1}"
+	local s="${2}"
+	local account="${3}"
+	local __account
+
+	if pam_account_isset "${s}"
+	then
+		if pam_account_index_isset "${s}"
+		then
+			local index="$(get_pam_account_index "${s}")"
+			__account="-m "$(echo "${account}" | sed -E "s|^\+|+${index}|")""
+
+		elif pam_account_before_isset "${s}"
+		then
+			local before="$(get_pam_account_before "${s}")"
+			local index="$(get_module_index "${pam_file}" account "${before}")"
+
+			if [ "${index}" -gt "0" ]
+			then
+				index=$(( index -= 1 ))
+			fi
+			__auth="-m "$(echo "${account}" | sed -E "s|^\+|+${index}|")""
+
+		elif pam_account_after_isset "${s}"
+		then
+			local before="$(get_pam_account_after "${s}")"
+			local index="$(get_module_index "${pam_file}" account "${after}")"
+
+			index=$(( index += 1 ))
+			__account="-m "$(echo "${account}" | sed -E "s|^\+|+${index}|")""
+
+		elif echo "${account}" | egrep -q '^(+|^)' && \
+			! pam_service_configured "${pam_file}" "${account}"
+		then
+			local index="$(get_account_index "${pam_file}")"
+			__account="-m "$(echo "${account}" | sed -E "s|^\+|+${index}|")""
+
+		elif echo "${account}" | egrep -q '^-'
+		then
+			__auth="-m "${account}""
+		fi
+	else
+		__account=""
+	fi
+
+	echo "${__account}"
+}
+
+do_pam_session_conf()
+{
+	local pam_file="${1}"
+	local s="${2}"
+	local session="${3}"
+	local __session
+
+	if pam_session_isset "${s}"
+	then
+		if pam_session_index_isset "${s}"
+		then
+			local index="$(get_pam_session_index "${s}")"
+			__session="-m "$(echo "${session}" | sed -E "s|^\+|+${index}|")""
+
+		elif pam_session_before_isset "${s}"
+		then
+			local before="$(get_pam_session_before "${s}")"
+			local index="$(get_module_index "${pam_file}" session "${before}")"
+
+			if [ "${index}" -gt "0" ]
+			then
+				index=$(( index -= 1 ))
+			fi
+			__session="-m "$(echo "${session}" | sed -E "s|^\+|+${index}|")""
+
+		elif pam_session_after_isset "${s}"
+		then
+			local before="$(get_pam_session_after "${s}")"
+			local index="$(get_module_index "${pam_file}" session "${after}")"
+
+			index=$(( index += 1 ))
+			__session="-m "$(echo "${session}" | sed -E "s|^\+|+${index}|")""
+
+		elif echo "${session}" | egrep -q '^(+|^)' && \
+			! pam_service_configured "${pam_file}" "${session}"
+		then
+			local index="$(get_session_index "${pam_file}")"
+			__session="-m "$(echo "${session}" | sed -E "s|^\+|+${index}|")""
+
+		elif echo "${session}" | egrep -q '^-'
+		then
+			__session="-m "${session}""
+		fi
+	else
+		__session=""
+	fi
+
+	echo "${__session}"
+}
+
+do_pam_password_conf()
+{
+	local pam_file="${1}"
+	local s="${2}"
+	local password="${3}"
+	local __password
+
+	if pam_password_isset "${s}"
+	then
+		if pam_password_index_isset "${s}"
+		then
+			local index="$(get_pam_password_index "${s}")"
+			__password="-m "$(echo "${password}" | sed -E "s|^\+|+${index}|")""
+
+		elif pam_password_before_isset "${s}"
+		then
+			local before="$(get_pam_password_before "${s}")"
+			local index="$(get_module_index "${pam_file}" password "${before}")"
+
+			if [ "${index}" -gt "0" ]
+			then
+				index=$(( index -= 1 ))
+			fi
+			__password="-m "$(echo "${password}" | sed -E "s|^\+|+${index}|")""
+
+		elif pam_password_after_isset "${s}"
+		then
+			local before="$(get_pam_password_after "${s}")"
+			local index="$(get_module_index "${pam_file}" password "${after}")"
+
+			index=$(( index += 1 ))
+			__password="-m "$(echo "${password}" | sed -E "s|^\+|+${index}|")""
+
+		elif echo "${password}" | egrep -q '^(+|^)' && \
+			! pam_service_configured "${pam_file}" "${password}"
+		then
+			local index="$(get_password_index "${pam_file}")"
+			__password="-m "$(echo "${password}" | sed -E "s|^\+|+${index}|")""
+
+		elif echo "${password}" | egrep -q '^-'
+		then
+			__password="-m "${password}""
+		fi
+	else
+		__password=""
+	fi
+
+	echo "${__password}"
+}
+
+do_pam_facility_conf()
+{
+}
+
 do_pam_conf()
 {
 	local auth="${1}"
@@ -227,13 +707,13 @@
 	local tmpdirs=""
 	local pam_dir
 
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		services="${activedirectory_pam_services}"
 
-	elif checkyesno ldapclient_enable 2>/dev/null
+	elif checkyesno pc_ldap_enable 2>/dev/null
 	then
-		services="${ldapclient_pam_services}"
+		services="${ldap_pam_services}"
 	fi
 
 	for pam_dir in ${PAMDIRS}
@@ -257,69 +737,45 @@
 
 			if in_pam_services "${s}" "${services}"
 			then
-				if pam_auth_isset "${s}" && [ -n "${auth}" ]
+
+				__auth=""
+				if pam_auth_isset "${s}"
 				then
-					if echo "${auth}" | egrep -q '^(+|^)' && \
-						! pam_service_configured "${pam_file}" "${auth}"
+					__auth="$(do_pam_auth_conf "${pam_file}" "${s}" "${auth}")"
+					if [ -n "${__auth}" ]
 					then
-						local index="$(get_auth_index "${pam_file}")"
-						__auth="-m "$(echo "${auth}" | sed -E "s|^\+|+${index}|")""
-
-					elif echo "${auth}" | egrep -q '^-'
-					then
-						__auth="-m "${auth}""
+						doconf=1
 					fi
-					doconf=1
-				else
-					__auth=""
 				fi
-				if pam_account_isset "${s}" && [ -n "${account}" ]
+
+				__account=""
+				if pam_account_isset "${s}"
 				then
-					if echo "${account}" | egrep -q '^(+|^)' && \
-						! pam_service_configured "${pam_file}" "${account}"
+					__account="$(do_pam_account_conf "${pam_file}" "${s}" "${account}")"
+					if [ -n "${__account}" ]
 					then
-						local index="$(get_account_index "${pam_file}")"
-						__account="-m "$(echo "${account}" | sed -E "s|^\+|+${index}|")""
-
-					elif echo "${account}" | egrep -q '^-'
-					then
-						__account="-m "${account}""
+						doconf=1
 					fi
-					doconf=1
-				else
-					__account=""
 				fi
-				if pam_session_isset "${s}" && [ -n "${session}" ]
+
+				__session=""
+				if pam_session_isset "${s}"
 				then
-					if echo "${session}" | egrep -q '^(+|^)' && \
-						! pam_service_configured "${pam_file}" "${session}"
+					__session="$(do_pam_session_conf "${pam_file}" "${s}" "${session}")"
+					if [ -n "${__session}" ]
 					then
-						local index="$(get_session_index "${pam_file}")"
-						__session="-m "$(echo "${session}" | sed -E "s|^\+|+${index}|")""
-
-					elif echo "${session}" | egrep -q '^-'
-					then
-						__session="-m "${session}""
+						doconf=1
 					fi
-					doconf=1
-				else
-					__session=""
 				fi
-				if pam_password_isset "${s}" && [ -n "${password}" ]
+
+				__password=""
+				if pam_password_isset "${s}"
 				then
-					if echo "${password}" | egrep -q '^(+|^)' && \
-						! pam_service_configured "${pam_file}" "${password}"
+					__password="$(do_pam_password_conf "${pam_file}" "${s}" "${password}")"
+					if [ -n "${__password}" ]
 					then
-						local index="$(get_password_index "${pam_file}")"
-						__password="-m "$(echo "${password}" | sed -E "s|^\+|+${index}|")""
-
-					elif echo "${password}" | egrep -q '^-'
-					then
-						__password="-m "${password}""
+						doconf=1
 					fi
-					doconf=1
-				else
-					__password=""
 				fi
 
 				if [ "${doconf}" = "1" ]
@@ -383,7 +839,7 @@
 	local session
 	local password
 
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		auth="+auth:sufficient:${pam_winbind}:silent:try_first_pass:krb5_auth:krb5_ccache_type=FILE"
 		account="+account:sufficient:${pam_winbind}:krb5_auth:krb5_ccache_type=FILE"
@@ -393,7 +849,7 @@
 		do_pam_conf "${auth}" "${account}" "${session}" "${password}"
 		return $?
 
-	elif checkyesno ldapclient_enable 2>/dev/null
+	elif checkyesno pc_ldap_enable 2>/dev/null
 	then
 		auth="+auth:sufficient:${pam_ldap}:silent:no_warn:try_first_pass"
 		account="+account:sufficient:${pam_ldap}:ignore_authinfo_unavail"
@@ -415,7 +871,7 @@
 	local password
 	local doconf=0
 
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		auth="-auth:sufficient:${pam_winbind}"
 		account="-account:sufficient:${pam_winbind}"
@@ -425,7 +881,7 @@
 		do_pam_conf "${auth}" "${account}" "${session}" "${password}"
 		return $?
 
-	elif checkyesno ldapclient_enable 2>/dev/null
+	elif checkyesno pc_ldap_enable 2>/dev/null
 	then
 		auth='-auth:sufficient:${pam_ldap}'
 		account='-account:sufficient:${pam_ldap}'
@@ -440,9 +896,18 @@
 }
 
 
-name="pc-pam"
 start_cmd='pam_start'
 stop_cmd='pam_stop'
         
 load_rc_config $name
+
+if [ "${pc_ldap_enable}" = "YES" ]
+then
+	pc_pam_enable="YES"
+
+elif [ "${pc_activedirectory_enable}" = "YES" ]
+then
+	pc_pam_enable="YES"
+fi
+
 run_rc_command "$1"

Modified: pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-samba
===================================================================
--- pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-samba	2012-11-10 18:33:16 UTC (rev 20158)
+++ pcbsd/branches/9.1/src-sh/pc-adctl/scripts/pc-samba	2012-11-11 00:21:01 UTC (rev 20159)
@@ -3,14 +3,20 @@
 # $FreeBSD$
 #
 
-# PROVIDE: pc-samba
+# PROVIDE: pc_samba
 # REQUIRE: FILESYSTEMS mountlate
-# REQUIRE: pc-pam
+# REQUIRE: pc_pam
 # BEFORE: smbd
 
+. /etc/rc.conf
 . /usr/local/etc/rc.ldap
 . /usr/local/etc/rc.activedirectory
 
+: ${pc_samba_enable:="NO"}
+
+name="pc_samba"
+rcvar="pc_samba_enable"
+
 : ${SMB_CONF:="/usr/local/etc/smb.conf"}
 : ${SAMBACONF:="/usr/local/bin/pc-sambaconf"}
 
@@ -23,7 +29,7 @@
 		cmd="${SAMBACONF} -f ${SMB_CONF}"
 	fi
 
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		local tmp=$(mktemp /tmp/samba.XXXXXX)
 		local cmdstr
@@ -107,7 +113,7 @@
 		cmd="${SAMBACONF} -f ${SMB_CONF}"
 	fi
 
-	if checkyesno ldapclient_enable 2>/dev/null
+	if checkyesno pc_ldap_enable 2>/dev/null
 	then
 		local tmp=$(mktemp /tmp/samba.XXXXXX)
 
@@ -169,7 +175,7 @@
 
 smbconf_start()
 {
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		AD_init
 		if AD_configured
@@ -180,7 +186,7 @@
 		ad_smbconf_start
 		return $?
 
-	elif checkyesno ldapclient_enable 2>/dev/null
+	elif checkyesno pc_ldap_enable 2>/dev/null
 	then
 		ldap_init
 		if ldap_configured
@@ -197,12 +203,12 @@
 
 smbconf_stop()
 {
-	if checkyesno activedirectory_enable 2>/dev/null
+	if checkyesno pc_activedirectory_enable 2>/dev/null
 	then
 		cp "${SMB_CONF}.orig" "${SMB_CONF}"
 		return $?
 
-	elif checkyesno ldapclient_enable 2>/dev/null
+	elif checkyesno pc_ldap_enable 2>/dev/null
 	then
 		cp "${SMB_CONF}.orig" "${SMB_CONF}"
 		return $?
@@ -211,9 +217,18 @@
 	return 0
 }
 
-name="pc-samba"
 start_cmd='smbconf_start'
 stop_cmd='smbconf_stop'
 
 load_rc_config $name
+
+if [ "${pc_ldap_enable}" = "YES" ]
+then
+	pc_samba_enable="YES"
+
+elif [ "${pc_activedirectory_enable}" = "YES" ]
+then
+	pc_samba_enable="YES"
+fi
+
 run_rc_command "$1"



More information about the Commits mailing list