diff options
21 files changed, 327 insertions, 165 deletions
diff --git a/net/openldap20-server/Makefile b/net/openldap20-server/Makefile index 77c2dc25b736..c74e015862cf 100644 --- a/net/openldap20-server/Makefile +++ b/net/openldap20-server/Makefile @@ -51,7 +51,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?= @@ -68,15 +68,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-ldbm +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/openldap20-server/files/slapd.sh b/net/openldap20-server/files/slapd.sh index 8e25fb7d667f..d9c1c63100ef 100644 --- a/net/openldap20-server/files/slapd.sh +++ b/net/openldap20-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-ldbm" - 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/openldap20-server/files/slurpd.sh b/net/openldap20-server/files/slurpd.sh index ba2f2944c6e2..434dca3d130f 100644 --- a/net/openldap20-server/files/slurpd.sh +++ b/net/openldap20-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/openldap20-server/pkg-plist b/net/openldap20-server/pkg-plist index 60ee299e00cd..0a4d061c8e97 100644 --- a/net/openldap20-server/pkg-plist +++ b/net/openldap20-server/pkg-plist @@ -39,12 +39,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-ldbm -@unexec rmdir %%LOCALSTATEDIR%%/openldap-ldbm 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%% diff --git a/net/openldap21-server/Makefile b/net/openldap21-server/Makefile index 6be6284662a6..aa91eab6ea5d 100644 --- a/net/openldap21-server/Makefile +++ b/net/openldap21-server/Makefile @@ -51,7 +51,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?= @@ -68,15 +68,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/openldap21-server/files/patch-servers::slapd::back-bdb::id2entry.c b/net/openldap21-server/files/patch-servers::slapd::back-bdb::id2entry.c new file mode 100644 index 000000000000..92c0224f511a --- /dev/null +++ b/net/openldap21-server/files/patch-servers::slapd::back-bdb::id2entry.c @@ -0,0 +1,22 @@ +# +# ITS#2672: eternal loop in back-bdb/id2entry.c +# +--- servers/slapd/back-bdb/id2entry.c 2003/03/24 03:54:12 1.24.2.9 ++++ servers/slapd/back-bdb/id2entry.c 2003/08/09 16:14:04 1.24.2.10 +@@ -125,6 +125,8 @@ + } + + if ( rc == 0 ) { ++ int add_loop_cnt = 0; ++ + #ifdef BDB_HIER + bdb_fix_dn(be, id, *e); + #endif +@@ -132,7 +134,6 @@ + &bdb->bi_cache, *e, rw, locker, lock); + while ( ret == 1 || ret == -1 ) { + Entry *ee; +- int add_loop_cnt = 0; + if ( (*e)->e_private != NULL ) { + free ((*e)->e_private); + } diff --git a/net/openldap21-server/files/slapd.sh b/net/openldap21-server/files/slapd.sh index f9d970cfbd22..d9c1c63100ef 100644 --- a/net/openldap21-server/files/slapd.sh +++ b/net/openldap21-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/openldap21-server/files/slurpd.sh b/net/openldap21-server/files/slurpd.sh index ba2f2944c6e2..434dca3d130f 100644 --- a/net/openldap21-server/files/slurpd.sh +++ b/net/openldap21-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/openldap21-server/pkg-plist b/net/openldap21-server/pkg-plist index a7c9f23d92d1..f6bfa4f3c820 100644 --- a/net/openldap21-server/pkg-plist +++ b/net/openldap21-server/pkg-plist @@ -37,12 +37,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%% 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%% diff --git a/net/openldap23-server/Makefile b/net/openldap23-server/Makefile index 3b7d758fa2e0..e139a6dd4d00 100644 --- a/net/openldap23-server/Makefile +++ b/net/openldap23-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/openldap23-server/files/slapd.sh b/net/openldap23-server/files/slapd.sh index f9d970cfbd22..d9c1c63100ef 100644 --- a/net/openldap23-server/files/slapd.sh +++ b/net/openldap23-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/openldap23-server/files/slurpd.sh b/net/openldap23-server/files/slurpd.sh index ba2f2944c6e2..434dca3d130f 100644 --- a/net/openldap23-server/files/slurpd.sh +++ b/net/openldap23-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/openldap23-server/pkg-plist b/net/openldap23-server/pkg-plist index d283b88ee117..d2c94faf8fe7 100644 --- a/net/openldap23-server/pkg-plist +++ b/net/openldap23-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%% diff --git a/net/openldap24-server/Makefile b/net/openldap24-server/Makefile index 3b7d758fa2e0..e139a6dd4d00 100644 --- a/net/openldap24-server/Makefile +++ b/net/openldap24-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/openldap24-server/files/slapd.sh b/net/openldap24-server/files/slapd.sh index f9d970cfbd22..d9c1c63100ef 100644 --- a/net/openldap24-server/files/slapd.sh +++ b/net/openldap24-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/openldap24-server/files/slurpd.sh b/net/openldap24-server/files/slurpd.sh index ba2f2944c6e2..434dca3d130f 100644 --- a/net/openldap24-server/files/slurpd.sh +++ b/net/openldap24-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/openldap24-server/pkg-plist b/net/openldap24-server/pkg-plist index d283b88ee117..d2c94faf8fe7 100644 --- a/net/openldap24-server/pkg-plist +++ b/net/openldap24-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%% |