[PC-BSD Commits] r19334 - in pcbsd/current/src-sh/pc-adctl: bin rc scripts
svn at pcbsd.org
svn at pcbsd.org
Tue Sep 18 15:46:38 PDT 2012
Author: johnh
Date: 2012-09-18 22:46:37 +0000 (Tue, 18 Sep 2012)
New Revision: 19334
Added:
pcbsd/current/src-sh/pc-adctl/scripts/pc-ad-ldap
Modified:
pcbsd/current/src-sh/pc-adctl/bin/pc-adctl
pcbsd/current/src-sh/pc-adctl/bin/pc-ldapctl
pcbsd/current/src-sh/pc-adctl/rc/rc.activedirectory
pcbsd/current/src-sh/pc-adctl/rc/rc.ldap
pcbsd/current/src-sh/pc-adctl/scripts/Makefile
pcbsd/current/src-sh/pc-adctl/scripts/pc-activedirectory
pcbsd/current/src-sh/pc-adctl/scripts/pc-kerberos
pcbsd/current/src-sh/pc-adctl/scripts/pc-kinit
pcbsd/current/src-sh/pc-adctl/scripts/pc-ldap
pcbsd/current/src-sh/pc-adctl/scripts/pc-nssldap
pcbsd/current/src-sh/pc-adctl/scripts/pc-nsswitch
pcbsd/current/src-sh/pc-adctl/scripts/pc-pam
pcbsd/current/src-sh/pc-adctl/scripts/pc-samba
Log:
mark AD and LDAP as configured once everything is ran to avoid configuring things more than once. Also fixup boot order to be proper.
Modified: pcbsd/current/src-sh/pc-adctl/bin/pc-adctl
===================================================================
--- pcbsd/current/src-sh/pc-adctl/bin/pc-adctl 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/bin/pc-adctl 2012-09-18 22:46:37 UTC (rev 19334)
@@ -59,6 +59,7 @@
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
@@ -90,6 +91,8 @@
else
adctl_cmd service samba start
fi
+
+ adctl_cmd service pc-ad-ldap stop
fi
}
Modified: pcbsd/current/src-sh/pc-adctl/bin/pc-ldapctl
===================================================================
--- pcbsd/current/src-sh/pc-adctl/bin/pc-ldapctl 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/bin/pc-ldapctl 2012-09-18 22:46:37 UTC (rev 19334)
@@ -40,6 +40,8 @@
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
@@ -69,6 +71,8 @@
else
ldapctl_assert service samba start
fi
+
+ ldapctl_assert service pc-ad-ldap stop
fi
}
Modified: pcbsd/current/src-sh/pc-adctl/rc/rc.activedirectory
===================================================================
--- pcbsd/current/src-sh/pc-adctl/rc/rc.activedirectory 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/rc/rc.activedirectory 2012-09-18 22:46:37 UTC (rev 19334)
@@ -31,6 +31,7 @@
#
: ${AD_CONF:="/usr/local/etc/pc-activedirectory.conf"}
: ${AD_NET_CONF:="/usr/local/etc/pc-activedirectory-net.conf"}
+: ${AD_VAR_FILE:="/var/run/activedirectory"}
#
@@ -862,6 +863,28 @@
return ${ret}
}
+AD_configured()
+{
+ if [ -f "${AD_VAR_FILE}" ]
+ then
+ return 0
+ fi
+
+ return 1
+}
+
+AD_set_configured()
+{
+ touch "${AD_VAR_FILE}"
+ return $?
+}
+
+AD_unset_configured()
+{
+ rm -f "${AD_VAR_FILE}"
+ return $?
+}
+
AD_log()
{
local args="$*"
Modified: pcbsd/current/src-sh/pc-adctl/rc/rc.ldap
===================================================================
--- pcbsd/current/src-sh/pc-adctl/rc/rc.ldap 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/rc/rc.ldap 2012-09-18 22:46:37 UTC (rev 19334)
@@ -4,6 +4,7 @@
# LDAP config
#
: ${PC_LDAP_CONF:="/usr/local/etc/pc-ldap.conf"}
+: ${PC_LDAP_VAR_FILE:="/var/run/pcldap"}
__ldap_escape()
@@ -68,6 +69,28 @@
__do_ldap_set "${prefix}" "${var}" "${val}"
}
+ldap_configured()
+{
+ if [ -f "${PC_LDAP_VAR_FILE}" ]
+ then
+ return 0
+ fi
+
+ return 1
+}
+
+ldap_set_configured()
+{
+ touch "${PC_LDAP_VAR_FILE}"
+ return $?
+}
+
+ldap_unset_configured()
+{
+ rm -f "${PC_LDAP_VAR_FILE}"
+ return $?
+}
+
ldap_init()
{
local conf="${PC_LDAP_CONF}"
Modified: pcbsd/current/src-sh/pc-adctl/scripts/Makefile
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/Makefile 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/Makefile 2012-09-18 22:46:37 UTC (rev 19334)
@@ -1,5 +1,5 @@
FILES=pc-activedirectory pc-kerberos pc-kinit pc-nsswitch pc-pam \
- pc-samba pc-ldap pc-nssldap
+ pc-samba pc-ldap pc-nssldap pc-ad-ldap
FILESMODE=0555
FILESDIR=/usr/local/etc/rc.d
Modified: pcbsd/current/src-sh/pc-adctl/scripts/pc-activedirectory
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-activedirectory 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-activedirectory 2012-09-18 22:46:37 UTC (rev 19334)
@@ -14,6 +14,10 @@
if checkyesno activedirectory_enable 2>/dev/null
then
AD_init
+ if AD_configured
+ then
+ return 0
+ fi
AD_log "activedirectory_start: trying to join domain"
if ! AD_join_domain; then
@@ -30,6 +34,8 @@
AD_log "activedirectory_status: checking status"
AD_status_domain >/dev/null
+
+ return $?
}
activedirectory_stop()
@@ -38,6 +44,8 @@
AD_log "activedirectory_stop: leaving domain"
AD_leave_domain
+
+ return 0
}
Index: pcbsd/current/src-sh/pc-adctl/scripts/pc-ad-ldap
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-ad-ldap 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-ad-ldap 2012-09-18 22:46:37 UTC (rev 19334)
Property changes on: pcbsd/current/src-sh/pc-adctl/scripts/pc-ad-ldap
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
Modified: pcbsd/current/src-sh/pc-adctl/scripts/pc-kerberos
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-kerberos 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-kerberos 2012-09-18 22:46:37 UTC (rev 19334)
@@ -86,8 +86,16 @@
{
if checkyesno activedirectory_enable 2>/dev/null
then
+ if AD_configured
+ then
+ return 0
+ fi
+
generate_krb5_conf
+ return $?
fi
+
+ return 0
}
ad_krb5conf_stop()
Modified: pcbsd/current/src-sh/pc-adctl/scripts/pc-kinit
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-kinit 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-kinit 2012-09-18 22:46:37 UTC (rev 19334)
@@ -97,6 +97,7 @@
fi
AD_log "kerberos_stop: ${ok}"
+ return 0
}
name="pc-kinit"
Modified: pcbsd/current/src-sh/pc-adctl/scripts/pc-ldap
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-ldap 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-ldap 2012-09-18 22:46:37 UTC (rev 19334)
@@ -192,9 +192,17 @@
if checkyesno ldapclient_enable 2>/dev/null
then
ldap_init
+ if ldap_configured
+ then
+ return 0
+ fi
+
backup_openldap_conf
generate_openldap_conf
+ return $?
fi
+
+ return 0
}
ldap_stop()
@@ -202,7 +210,10 @@
if checkyesno ldapclient_enable 2>/dev/null
then
restore_openldap_conf
+ return $?
fi
+
+ return 0
}
Modified: pcbsd/current/src-sh/pc-adctl/scripts/pc-nssldap
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-nssldap 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-nssldap 2012-09-18 22:46:37 UTC (rev 19334)
@@ -332,15 +332,29 @@
if checkyesno ldapclient_enable 2>/dev/null
then
ldap_init
+ if ldap_configured
+ then
+ return 0
+ fi
+
backup_nss_ldap_conf
generate_LDAP_nss_ldap_conf
+ return $?
elif checkyesno activedirectory_enable 2>/dev/null
then
AD_init
+ if AD_configured
+ then
+ return 0
+ fi
+
backup_nss_ldap_conf
generate_AD_nss_ldap_conf
+ return $?
fi
+
+ return 0
}
nssldap_stop()
@@ -348,11 +362,15 @@
if checkyesno ldapclient_enable 2>/dev/null
then
restore_nss_ldap_conf
+ return $?
elif checkyesno activedirectory_enable 2>/dev/null
then
restore_nss_ldap_conf
+ return $?
fi
+
+ return 0
}
name="pc-nssldap"
Modified: pcbsd/current/src-sh/pc-adctl/scripts/pc-nsswitch
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-nsswitch 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-nsswitch 2012-09-18 22:46:37 UTC (rev 19334)
@@ -25,6 +25,10 @@
doconf=1
AD_init
+ if AD_configured
+ then
+ return 0
+ fi
if AD_UNIX_extensions
then
@@ -35,6 +39,12 @@
then
conftype='ldap'
doconf=1
+
+ ldap_init
+ if ldap_configured
+ then
+ return 0
+ fi
fi
if [ -f "${PATH_NS_CONF}" ]
Modified: pcbsd/current/src-sh/pc-adctl/scripts/pc-pam
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-pam 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-pam 2012-09-18 22:46:37 UTC (rev 19334)
@@ -301,6 +301,10 @@
if checkyesno activedirectory_enable 2>/dev/null
then
AD_init
+ if AD_configured
+ then
+ return 0
+ fi
if ! AD_UNIX_extensions
then
@@ -330,6 +334,12 @@
elif checkyesno ldapclient_enable 2>/dev/null
then
+ ldap_init
+ if ldap_configured
+ then
+ return 0
+ fi
+
auth="+2auth:sufficient:${pam_ldap}:silent:no_warn:try_first_pass"
account="+2account:sufficient:${pam_ldap}:ignore_authinfo_unavail"
session="+session:required:${pam_mkhomedir}"
Modified: pcbsd/current/src-sh/pc-adctl/scripts/pc-samba
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-samba 2012-09-18 21:14:45 UTC (rev 19333)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-samba 2012-09-18 22:46:37 UTC (rev 19334)
@@ -163,11 +163,23 @@
{
if checkyesno activedirectory_enable 2>/dev/null
then
+ Ad_init
+ if AD_configured
+ then
+ return 0
+ fi
+
ad_smbconf_start
return $?
elif checkyesno ldapclient_enable 2>/dev/null
then
+ ldap_init
+ if ldap_configured
+ then
+ return 0
+ fi
+
ldap_smbconf_start
return $?
fi
More information about the Commits
mailing list