--- named.in.orig 2017-03-24 18:34:57.000000000 +0300 +++ named.in 2017-04-03 18:42:51.506881000 +0300 @@ -178,6 +178,19 @@ ln -fs "${named_chrootdir}${pidfile}" ${pidfile} } +setup_rndc_flags() +{ + if [ -n "${rndc_flags}" ]; then + return + fi + + if [ -s ${rndc_conf} ] ; then + rndc_flags="-c ${rndc_conf}" + elif [ -s ${rndc_key} ] ; then + rndc_flags="-k ${rndc_key}" + fi +} + named_poststart() { make_symlinks @@ -194,6 +207,7 @@ { # This is a one line function, but ${named_program} is not defined early # enough to be there when the reload_cmd variable is defined up there. + setup_rndc_flags ${_named_program_root}/sbin/rndc ${rndc_flags} reload } @@ -220,6 +234,7 @@ return 1 fi echo 'Stopping named.' + setup_rndc_flags if ${_named_program_root}/sbin/rndc ${rndc_flags} stop 2>/dev/null; then wait_for_pids ${rc_pid} else @@ -270,16 +285,6 @@ command_args="-u ${named_uid:=root} -c ${named_conf} ${command_args}" - if [ -z "${rndc_flags}" ]; then - if [ -s ${rndc_conf} ] ; then - rndc_flags="-c ${rndc_conf}" - elif [ -s ${rndc_key} ] ; then - rndc_flags="-k ${rndc_key}" - else - rndc_flags="" - fi - fi - %%NATIVE_PKCS11%% if [ -z "${named_pkcs11_engine}"]; then %%NATIVE_PKCS11%% err 3 "named_pkcs11_engine has to be set to the PKCS#11 engine's library you want to use" %%NATIVE_PKCS11%% elif [ ! -f ${named_pkcs11_engine} ]; then