From f072055a76bd42bed42d38627ebdc22a0ce1cae0 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Wed, 2 Jan 2008 17:03:38 +0000 Subject: [PATCH] - some init script cleanups - drop unquoted check and silent exit for "$NETWORKING" (#426852, #242500) - krb524: don't barf on missing database if it looks like we're using kldap, same as for kadmin - return non-zero status for missing files which cause startup to fail --- kadmind.init | 10 ++++------ kpropd.init | 12 ++++-------- krb5.spec | 7 +++++++ krb524d.init | 13 ++++++++----- krb5kdc.init | 8 +++----- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/kadmind.init b/kadmind.init index 5782d06..5e97a91 100755 --- a/kadmind.init +++ b/kadmind.init @@ -14,9 +14,6 @@ # Get config. . /etc/sysconfig/network -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 - # Get config. [ -r /etc/sysconfig/kadmin ] && . /etc/sysconfig/kadmin @@ -34,13 +31,14 @@ start() { # then we don't know for sure that this is an error. if ! grep -q 'db_library.*=.*kldap' /etc/krb5.conf ; then echo $"Error. Default principal database does not exist." - exit 0 + exit 1 fi fi if [ -f /var/kerberos/krb5kdc/kpropd.acl ] ; then echo $"Error. This appears to be a slave server, found kpropd.acl" - exit 0 + exit 6 else + [ -x $kadmind ] || exit 5 if [ ! -f /var/kerberos/krb5kdc/kadm5.keytab ] ; then echo -n $"Extracting kadm5 Service Keys: " # This should always work. @@ -97,7 +95,7 @@ case "$1" in ;; *) echo $"Usage: $0 {start|stop|status|condrestart|reload|restart}" - RETVAL=1 + RETVAL=2 ;; esac diff --git a/kpropd.init b/kpropd.init index e4bd3b7..d0ecee2 100755 --- a/kpropd.init +++ b/kpropd.init @@ -12,9 +12,6 @@ # Get config. . /etc/sysconfig/network -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 - # Source function library. . /etc/init.d/functions @@ -22,11 +19,10 @@ RETVAL=0 prog="Kerberos 5 Propagation Server" kpropd=/usr/kerberos/sbin/kpropd -# Sheel functions to cut down on useless shell instances. +# Shell functions to cut down on useless shell instances. start() { - if [ ! -f /var/kerberos/krb5kdc/kpropd.acl ] ; then - exit 0 - fi + [ -f /var/kerberos/krb5kdc/kpropd.acl ] || exit 6 + [ -x $kpropd ] || exit 5 echo -n $"Starting $prog: " daemon ${kpropd} -S RETVAL=$? @@ -65,7 +61,7 @@ case "$1" in ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart}" - RETVAL=1 + RETVAL=2 ;; esac diff --git a/krb5.spec b/krb5.spec index f613307..54626cf 100644 --- a/krb5.spec +++ b/krb5.spec @@ -222,6 +222,13 @@ to obtain initial credentials from a KDC using a private key and a certificate. %changelog +* Wed Jan 2 2007 Nalin Dahyabhai 1.6.3-4 +- some init script cleanups + - drop unquoted check and silent exit for "$NETWORKING" (#426852, #242500) + - krb524: don't barf on missing database if it looks like we're using kldap, + same as for kadmin + - return non-zero status for missing files which cause startup to fail + * Tue Dec 18 2007 Nalin Dahyabhai 1.6.3-3 - allocate space for the nul-terminator in the local pathname when looking up a file context, and properly free a previous context (Jose Plans, #426085) diff --git a/krb524d.init b/krb524d.init index bf45b32..c0cc610 100755 --- a/krb524d.init +++ b/krb524d.init @@ -13,9 +13,6 @@ # Get config. . /etc/sysconfig/network -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 - # Get config. [ -r /etc/sysconfig/krb524 ] && . /etc/sysconfig/krb524 @@ -29,8 +26,14 @@ krb524d=/usr/kerberos/sbin/krb524d # Shell functions to cut down on unnecessary shell invocations. start() { if [ ! -f /var/kerberos/krb5kdc/principal ] ; then - exit 0 + # Make an educated guess -- if they're using kldap somewhere, + # then we don't know for sure that this is an error. + if ! grep -q 'db_library.*=.*kldap' /etc/krb5.conf ; then + echo $"Error. Default principal database does not exist." + exit 6 + fi fi + [ -x $krb524d ] || exit 5 echo -n $"Starting $prog: " daemon ${krb524d} ${KRB524D_ARGS:--m} RETVAL=$? @@ -68,7 +71,7 @@ case "$1" in ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart}" - RETVAL=1 + RETVAL=2 ;; esac diff --git a/krb5kdc.init b/krb5kdc.init index 76cb56c..18d530e 100755 --- a/krb5kdc.init +++ b/krb5kdc.init @@ -13,9 +13,6 @@ # Get config. . /etc/sysconfig/network -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 - # Get config. [ -r /etc/sysconfig/krb5kdc ] && . /etc/sysconfig/krb5kdc @@ -26,8 +23,9 @@ RETVAL=0 prog="Kerberos 5 KDC" krb5kdc=/usr/kerberos/sbin/krb5kdc -# Sheel functions to cut down on useless shell instances. +# Shell functions to cut down on useless shell instances. start() { + [ -x $krb5kdc ] || exit 5 echo -n $"Starting $prog: " daemon ${krb5kdc} ${KRB5REALM:+-r ${KRB5REALM}} $KRB5KDC_ARGS RETVAL=$? @@ -75,7 +73,7 @@ case "$1" in ;; *) echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" - RETVAL=1 + RETVAL=2 ;; esac