diff options
Diffstat (limited to 'net/openldap22-server')
-rw-r--r-- | net/openldap22-server/Makefile | 13 | ||||
-rw-r--r-- | net/openldap22-server/files/slapd.sh | 60 | ||||
-rw-r--r-- | net/openldap22-server/files/slurpd.sh | 11 | ||||
-rw-r--r-- | net/openldap22-server/pkg-plist | 10 |
4 files changed, 61 insertions, 33 deletions
diff --git a/net/openldap22-server/Makefile b/net/openldap22-server/Makefile index 3b7d758fa2e0..e139a6dd4d00 100644 --- a/net/openldap22-server/Makefile +++ b/net/openldap22-server/Makefile @@ -52,7 +52,7 @@ OPENLDAP_PKGFILESUFX?= .client .error You have `USE_OPENLDAP' defined either in your environment or in make(1) arguments. .endif .else -OPENLDAP_PORTVERSION= 1 +OPENLDAP_PORTVERSION= 2 OPENLDAP_PKGNAMESUFFIX?=-server OPENLDAP_PKGFILESUFX?= @@ -69,15 +69,18 @@ PLIST= ${WRKDIR}/pkg-plist PKGINSTALL= ${WRKDIR}/pkg-install PKGMESSAGE= ${WRKDIR}/pkg-message -LOCALSTATEDIR?= ${DESTDIR}/var/db LDAP_RUN_DIR?= ${DESTDIR}/var/run/openldap +LOCALSTATEDIR?= ${DESTDIR}/var/db +DATABASEDIR?= ${LOCALSTATEDIR}/openldap-data +SLURPDIR?= ${LOCALSTATEDIR}/openldap-slurp -PLIST_SUB+= LOCALSTATEDIR=${LOCALSTATEDIR} \ - LDAP_RUN_DIR=${LDAP_RUN_DIR} +PLIST_SUB+= LDAP_RUN_DIR=${LDAP_RUN_DIR} \ + DATABASEDIR=${DATABASEDIR} \ + SLURPDIR=${SLURPDIR} \ SED_SCRIPT= -e 's,%%PREFIX%%,${PREFIX},g' \ -e 's,%%LDAP_RUN_DIR%%,${LDAP_RUN_DIR},g' \ - -e 's,%%LOCALSTATEDIR%%,${LOCALSTATEDIR},g' + -e 's,%%DATABASEDIR%%,${DATABASEDIR},g' CONFIGURE_ARGS= --with-threads \ --with-tls=openssl \ diff --git a/net/openldap22-server/files/slapd.sh b/net/openldap22-server/files/slapd.sh index f9d970cfbd22..d9c1c63100ef 100644 --- a/net/openldap22-server/files/slapd.sh +++ b/net/openldap22-server/files/slapd.sh @@ -21,7 +21,7 @@ # by default slapd runs under the non-privileged user id `ldap'. If you # want to run slapd as root, override this in /etc/rc.conf with # -#slapd_owner= +#slapd_owner="DEFAULT" # . %%RC_SUBR%% @@ -37,47 +37,67 @@ required_files=%%PREFIX%%/etc/openldap/slapd.conf start_precmd=start_precmd start_postcmd=start_postcmd +# extract user and group, adjust ownership of directories and database + start_precmd() { - if [ x"$slapd_owner" != x ]; then - chown "${slapd_owner}" "%%LDAP_RUN_DIR%%" - chown -RL "${slapd_owner}" "%%LOCALSTATEDIR%%/openldap-data" - chown "${slapd_owner}" "%%PREFIX%%/etc/openldap/slapd.conf" + case x"$slapd_owner" in + x|x[Nn][Oo][Nn][Ee]|x[Dd][Ee][Ff][Aa][Uu][Ll][Tt]) + ;; + x*) + chown "$slapd_owner" "%%LDAP_RUN_DIR%%" + chown -RL "$slapd_owner" "%%DATABASEDIR%%" + chown "$slapd_owner" "%%PREFIX%%/etc/openldap/slapd.conf" slapd_ownername=`expr //"$slapd_owner" : //'\([^:]*\)'` slapd_groupname=`expr //"$slapd_owner" : //'.*:\([^:]*\)'` - if [ x"$slapd_ownername" != x ]; then + if [ -n "$slapd_ownername" ]; then rc_flags="$rc_flags -u $slapd_ownername" fi - if [ x"$slapd_groupname" != x ]; then + if [ -n "$slapd_groupname" ]; then rc_flags="$rc_flags -g $slapd_groupname" fi - fi + ;; + esac } +# adjust ownership of created unix sockets + start_postcmd() { - for socket in ${slapd_sockets}; do + for socket in $slapd_sockets; do for seconds in 1 2 3 4 5; do - test -e ${socket} && break + [ -e "$socket" ] && break sleep 1 done - if [ -S ${socket} ]; then - if [ x"$slapd_owner" != x ]; then - chown "${slapd_owner}" ${socket} - fi - chmod "${slapd_sockets_mode}" ${socket} + if [ -S "$socket" ]; then + case x"$slapd_owner" in + x|x[Nn][Oo][Nn][Ee]|x[Dd][Ee][Ff][Aa][Uu][Ll][Tt]) + ;; + x*) + chown "$slapd_owner" "$socket" + ;; + esac + chmod "$slapd_sockets_mode" "$socket" fi done } -slapd_enable="NO" -slapd_flags= +# set defaults + +[ -z "$slapd_enable" ] && slapd_enable=NO +[ -z "$slapd_flags" ] && slapd_flags= -slapd_owner=ldap:ldap -slapd_sockets= -slapd_sockets_mode=666 +[ -z "$slapd_owner" ] && slapd_owner=ldap:ldap +[ -z "$slapd_sockets" ] && slapd_sockets= +[ -z "$slapd_sockets_mode" ] && slapd_sockets_mode=666 load_rc_config $name + +if [ -n "$slapd_args" ]; then + warn "slapd_args is deprecated, use slapd_flags" + slapd_flags="$slapd_args" +end + run_rc_command "$1" diff --git a/net/openldap22-server/files/slurpd.sh b/net/openldap22-server/files/slurpd.sh index ba2f2944c6e2..434dca3d130f 100644 --- a/net/openldap22-server/files/slurpd.sh +++ b/net/openldap22-server/files/slurpd.sh @@ -23,9 +23,14 @@ rcvar=`set_rcvar` command=%%PREFIX%%/libexec/slurpd required_files=%%PREFIX%%/etc/openldap/slapd.conf - -slurpd_enable="NO" -slurpd_args= +[ -z "$slurpd_enable" ] && slurpd_enable="NO" +[ -z "$slurpd_flags" ] && slurpd_flags= load_rc_config $name + +if [ -n "$slurpd_args" ]; then + warn "slurpd_args is deprecated, use slurpd_flags" + slurpd_flags="$slurpd_args" +end + run_rc_command "$1" diff --git a/net/openldap22-server/pkg-plist b/net/openldap22-server/pkg-plist index d283b88ee117..d2c94faf8fe7 100644 --- a/net/openldap22-server/pkg-plist +++ b/net/openldap22-server/pkg-plist @@ -40,12 +40,12 @@ sbin/slapadd sbin/slapcat sbin/slapindex sbin/slappasswd -@exec mkdir -p %%LOCALSTATEDIR%%/openldap-slurp -@unexec rmdir %%LOCALSTATEDIR%%/openldap-slurp 2>/dev/null || true -@exec mkdir -p %%LOCALSTATEDIR%%/openldap-data -@unexec rmdir %%LOCALSTATEDIR%%/openldap-data 2>/dev/null || true @exec mkdir -p %%LDAP_RUN_DIR%% -@unexec rmdir %%LDAP_RUN_DIR%% 2>/dev/null || true +@exec mkdir -p %%DATABASEDIR%% +@exec mkdir -p %%SLURPDIR%% +@unexec rmdir %%LDAP_RUN_DIR%% +@unexec rmdir %%DATABASEDIR%% 2>/dev/null || true +@unexec rmdir %%SLURPDIR%% 2>/dev/null || true @cwd %%RC_DIR%% slapd%%RC_SUFX%% slurpd%%RC_SUFX%% |