diff options
author | Edwin Groothuis <edwin@FreeBSD.org> | 2003-08-28 12:51:08 +0000 |
---|---|---|
committer | Edwin Groothuis <edwin@FreeBSD.org> | 2003-08-28 12:51:08 +0000 |
commit | d90d7b94c09bda503e13bca12bb41b8de10580bc (patch) | |
tree | e9778dfd76653c2bf7218cb642a93c523eea21d6 /net/openldap20-server/files | |
parent | [orphaned port] mail/teapop: use USE_OPENLDAP and USE_MYSQL (diff) |
[MAINTAINER] ports net/openldap2[012]-server: use RC_SUBR, miscellaneous improvements
- use RC_SUBR (PR 54352, submitted by Scot W. Hetzel <hetzels@westbend.net>)
- run slapd under a non-privileged account by default (PR 56075)
- remove ${PORTSDIR}/net/openldap20-server/bsd.openldap.mk (PR 55680)
- use USE_OPENLDAP
- improve conflict checking (PR 54845, submitted by Jens Rehsack <rehsack@liwing.de>)
- make ODBC library selectable (PR 46288, submitted by Emile Heitor <eheitor@fr.cw.net>)
- don't use USE_OPENSSL to avoid gazillions of -rpath warnings
PR: ports/56077
Submitted by: Oliver Eikemeier <eikemeier@fillmore-labs.com>
Notes
Notes:
svn path=/head/; revision=87902
Diffstat (limited to 'net/openldap20-server/files')
-rw-r--r-- | net/openldap20-server/files/patch-servers::slapd::main.c | 16 | ||||
-rw-r--r-- | net/openldap20-server/files/slapd.sh | 126 | ||||
-rw-r--r-- | net/openldap20-server/files/slurpd.sh | 59 |
3 files changed, 111 insertions, 90 deletions
diff --git a/net/openldap20-server/files/patch-servers::slapd::main.c b/net/openldap20-server/files/patch-servers::slapd::main.c new file mode 100644 index 000000000000..1903a4a5d5bb --- /dev/null +++ b/net/openldap20-server/files/patch-servers::slapd::main.c @@ -0,0 +1,16 @@ +--- servers/slapd/main.c.orig Fri Jan 4 21:38:28 2002 ++++ servers/slapd/main.c Fri Aug 22 14:25:23 2003 +@@ -480,6 +480,13 @@ + #endif + slapd_daemon_destroy(); + ++ if ( slapd_pid_file != NULL ) { ++ unlink( slapd_pid_file ); ++ } ++ if ( slapd_args_file != NULL ) { ++ unlink( slapd_args_file ); ++ } ++ + #ifdef CSRIMALLOC + mal_dumpleaktrace( leakfile ); + #endif diff --git a/net/openldap20-server/files/slapd.sh b/net/openldap20-server/files/slapd.sh index e7e385bbc625..8e25fb7d667f 100644 --- a/net/openldap20-server/files/slapd.sh +++ b/net/openldap20-server/files/slapd.sh @@ -1,59 +1,83 @@ #!/bin/sh # # $FreeBSD$ +# -slapd_program=%%PREFIX%%/libexec/slapd - -slapd_pidfile=%%LDAP_RUN_DIR%%/slapd.pid - -slapd_enable="YES" - -slapd_args= +# PROVIDE: slapd +# REQUIRE: NETWORKING SERVERS +# BEFORE: DAEMON +# KEYWORD: FreeBSD shutdown +# # Add the following lines to /etc/rc.conf to enable slapd: # #slapd_enable="YES" -#slapd_args='-h "ldapi://%2fvar%2frun%2fopenldap%2fldapi/ ldap://0.0.0.0/"' -# -# See sldap(8) for details -# -# Create a user 'ldap' and add '-u ldap -g ldap' to slapd_args -# if you want to run slapd as a non-privileged user (recommended) -# - -# Suck in the configuration variables. -if [ -r /etc/defaults/rc.conf ]; then - . /etc/defaults/rc.conf - source_rc_confs -elif [ -r /etc/rc.conf ]; then - . /etc/rc.conf -fi - -case "$slapd_enable" in -[Yy][Ee][Ss]) - case "$1" in - start) - if [ -x ${slapd_program} ]; then - echo -n ' slapd' - eval ${slapd_program} ${slapd_args} - fi - ;; - stop) - if [ -f $slapd_pidfile ]; then - kill `cat $slapd_pidfile` - echo -n ' slapd' - else - echo ' slapd: not running' - fi - ;; - *) - echo "Usage: `basename $0` {start|stop}" >&2 - exit 64 - ;; - esac - ;; -*) - ;; -esac - -exit 0 +#slapd_flags='-h "ldapi://%2fvar%2frun%2fopenldap%2fldapi/ ldap://0.0.0.0/"' +#slapd_sockets="/var/run/openldap/ldapi" +# +# See slapd(8) for more flags +# +# The `-u' and `-g' flags are automatically extracted from slapd_owner, +# 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= +# + +. %%RC_SUBR%% + +name=slapd +rcvar=`set_rcvar` + +command=%%PREFIX%%/libexec/slapd +pidfile=%%LDAP_RUN_DIR%%/slapd.pid +required_dirs=%%LDAP_RUN_DIR%% +required_files=%%PREFIX%%/etc/openldap/slapd.conf + +start_precmd=start_precmd +start_postcmd=start_postcmd + +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" + + slapd_ownername=`expr //"$slapd_owner" : //'\([^:]*\)'` + slapd_groupname=`expr //"$slapd_owner" : //'.*:\([^:]*\)'` + + if [ x"$slapd_ownername" != x ]; then + rc_flags="$rc_flags -u $slapd_ownername" + fi + if [ x"$slapd_groupname" != x ]; then + rc_flags="$rc_flags -g $slapd_groupname" + fi + fi +} + +start_postcmd() +{ + for socket in ${slapd_sockets}; do + for seconds in 1 2 3 4 5; do + test -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} + fi + done +} + +slapd_enable="NO" +slapd_flags= + +slapd_owner=ldap:ldap +slapd_sockets= +slapd_sockets_mode=666 + +load_rc_config $name +run_rc_command "$1" diff --git a/net/openldap20-server/files/slurpd.sh b/net/openldap20-server/files/slurpd.sh index 46a1a6dbc18b..ba2f2944c6e2 100644 --- a/net/openldap20-server/files/slurpd.sh +++ b/net/openldap20-server/files/slurpd.sh @@ -1,50 +1,31 @@ #!/bin/sh # # $FreeBSD$ +# -slurpd_program=%%PREFIX%%/libexec/slurpd - -slurpd_enable="YES" - -slurpd_args= +# PROVIDE: slurpd +# REQUIRE: slapd +# BEFORE: +# KEYWORD: FreeBSD shutdown # Add the following line to /etc/rc.conf to enable slurpd: # #slurpd_enable="YES" # -# See slurpd(8) for details +# See slurpd(8) for more flags # -# Suck in the configuration variables. -if [ -r /etc/defaults/rc.conf ]; then - . /etc/defaults/rc.conf - source_rc_confs -elif [ -r /etc/rc.conf ]; then - . /etc/rc.conf -fi - -case "$slurpd_enable" in -[Yy][Ee][Ss]) - case "$1" in - start) - if [ -x ${slurpd_program} ]; then - echo -n ' slurpd' - ${slurpd_program} ${slurpd_args} - fi - ;; - stop) - if ! killall `basename ${slurpd_program}`; then - echo ' slurpd: not running' - fi - ;; - *) - echo "Usage: `basename $0` {start|stop}" >&2 - exit 64 - ;; - esac - ;; -*) - ;; -esac - -exit 0 +. %%RC_SUBR%% + +name=slurpd +rcvar=`set_rcvar` + +command=%%PREFIX%%/libexec/slurpd +required_files=%%PREFIX%%/etc/openldap/slapd.conf + + +slurpd_enable="NO" +slurpd_args= + +load_rc_config $name +run_rc_command "$1" |