2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-01 14:35:29 +00:00

[538-kea-should-not-store-anything-in-var-kea-lsb-violation] Introduced runstatedir for pid files

This commit is contained in:
Francis Dupont
2019-05-31 17:29:29 +02:00
parent a445d32933
commit 85c5b01d69
11 changed files with 29 additions and 22 deletions

View File

@@ -1527,6 +1527,13 @@ AM_COND_IF([HAVE_OPTRESET], [AC_DEFINE([HAVE_OPTRESET], [1], [Check for optreset
AC_DEFINE([CONFIG_H_WAS_INCLUDED], [1], [config.h inclusion marker]) AC_DEFINE([CONFIG_H_WAS_INCLUDED], [1], [config.h inclusion marker])
# Autoconf 2.70 has runstatedir but is not yet released.
if test "x$runstatedir" = "x"; then
AC_ARG_VAR(runstatedir, [$localstatedir/run for autoconf < 2.70])
runstatedir="$localstatedir/run"
AC_SUBST(runstatedir)
fi
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
compatcheck/Makefile compatcheck/Makefile
doc/Makefile doc/Makefile

View File

@@ -174,12 +174,12 @@ strings <userinput>path</userinput>/kea-dhcp-ddns | sed -n 's/;;;; //p'
<para> <para>
During startup the server will attempt to create a PID file of the During startup the server will attempt to create a PID file of the
form: [localstatedir]/[conf name].kea-dhcp-ddns.pid form: [runstatedir]/[conf name].kea-dhcp-ddns.pid
where: where:
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<simpara><command>localstatedir</command>: The value as passed into the <simpara><command>runstatedir</command>: The value as passed into the
build configure script; it defaults to "/usr/local/var". Note build configure script; it defaults to "/usr/local/var/run". Note
that this value may be overridden at runtime by setting the environment that this value may be overridden at runtime by setting the environment
variable KEA_PIDFILE_DIR. This is intended primarily for testing purposes. variable KEA_PIDFILE_DIR. This is intended primarily for testing purposes.
</simpara> </simpara>

View File

@@ -96,11 +96,11 @@
<para> <para>
During startup, the server will attempt to create a PID file of the During startup, the server will attempt to create a PID file of the
form: [localstatedir]/[conf name].kea-dhcp4.pid where: form: [runstatedir]/[conf name].kea-dhcp4.pid where:
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<simpara><command>localstatedir</command>: The value as passed into the <simpara><command>runstatedir</command>: The value as passed into the
build configure script; it defaults to "/usr/local/var". Note build configure script; it defaults to "/usr/local/var/run". Note
that this value may be overridden at runtime by setting the environment that this value may be overridden at runtime by setting the environment
variable KEA_PIDFILE_DIR, although this is intended primarily for testing purposes. variable KEA_PIDFILE_DIR, although this is intended primarily for testing purposes.
</simpara> </simpara>

View File

@@ -96,11 +96,11 @@
<para> <para>
During startup, the server will attempt to create a PID file of the During startup, the server will attempt to create a PID file of the
form: localstatedir]/[conf name].kea-dhcp6.pid where: form: [runstatedir]/[conf name].kea-dhcp6.pid where:
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<simpara><command>localstatedir</command>: The value as passed into the <simpara><command>runstatedir</command>: The value as passed into the
build configure script; it defaults to "/usr/local/var". Note build configure script; it defaults to "/usr/local/var/run". Note
that this value may be overridden at runtime by setting the environment that this value may be overridden at runtime by setting the environment
variable KEA_PIDFILE_DIR, although this is intended primarily for testing purposes. variable KEA_PIDFILE_DIR, although this is intended primarily for testing purposes.
</simpara> </simpara>

View File

@@ -252,7 +252,7 @@
// // of all devices serviced by Kea, including their identifiers // // of all devices serviced by Kea, including their identifiers
// // (like MAC address), their location in the network, times // // (like MAC address), their location in the network, times
// // when they were active etc. // // when they were active etc.
// "library": "@localstatedir@/kea/libdhcp_legal_log.so" // "library": "@libdir@/kea/hooks/libdhcp_legal_log.so"
// "parameters": { // "parameters": {
// "path": "/var/kea/var", // "path": "/var/kea/var",
// "base-name": "kea-forensic4" // "base-name": "kea-forensic4"
@@ -269,7 +269,7 @@
// // of specific options or perhaps even a combination of several // // of specific options or perhaps even a combination of several
// // options and fields to uniquely identify a client. Those scenarios // // options and fields to uniquely identify a client. Those scenarios
// // are addressed by the Flexible Identifiers hook application. // // are addressed by the Flexible Identifiers hook application.
// "library": "@localstatedir@/kea/libdhcp_flex_id.so", // "library": "@libdir@/kea/hooks/libdhcp_flex_id.so",
// "parameters": { // "parameters": {
// "identifier-expression": "substring(relay6[0].option[18],0,8)" // "identifier-expression": "substring(relay6[0].option[18],0,8)"
// } // }

View File

@@ -99,9 +99,9 @@ get_pid_from_file() {
local conf_name local conf_name
conf_name=$(basename -- "${kea_config_file}" | cut -f1 -d'.') conf_name=$(basename -- "${kea_config_file}" | cut -f1 -d'.')
# Default the directory to --localstatedir # Default the directory to --localstatedir / run
local pid_file_dir local pid_file_dir
pid_file_dir=@localstatedir@/@PACKAGE@ pid_file_dir=@runstatedir@/@PACKAGE@
# Use directory override if set (primarily for testing only) # Use directory override if set (primarily for testing only)
if [ -n "$KEA_PIDFILE_DIR" ]; then if [ -n "$KEA_PIDFILE_DIR" ]; then
@@ -333,7 +333,7 @@ run_conditional() {
# to the default file. # to the default file.
if [ -z "${KEA_LOGGER_DESTINATION}" ]; then if [ -z "${KEA_LOGGER_DESTINATION}" ]; then
prefix=@prefix@ prefix=@prefix@
export KEA_LOGGER_DESTINATION=@localstatedir@/@PACKAGE@/kea.log export KEA_LOGGER_DESTINATION=@localstatedir@/log/kea.log
fi fi
command=${1} command=${1}

View File

@@ -1,5 +1,5 @@
SUBDIRS = . testutils tests SUBDIRS = . testutils tests
dhcp_data_dir = @localstatedir@/@PACKAGE@ dhcp_data_dir = @runstatedir@/@PACKAGE@
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += -DDATA_DIR="\"$(dhcp_data_dir)\"" AM_CPPFLAGS += -DDATA_DIR="\"$(dhcp_data_dir)\""

View File

@@ -268,7 +268,7 @@ private:
std::string proc_name_; std::string proc_name_;
/// @brief Pointer to the directory where PID file(s) are written /// @brief Pointer to the directory where PID file(s) are written
/// It defaults to --localstatedir /// It defaults to --localstatedir / run
std::string pid_file_dir_; std::string pid_file_dir_;
/// @brief Pointer to the PID file for this process /// @brief Pointer to the PID file for this process

View File

@@ -107,9 +107,9 @@ This is an error message that occurs when the server is unable to create
its PID file. The log message should contain details sufficient to its PID file. The log message should contain details sufficient to
determine the underlying cause. The most likely culprits are that determine the underlying cause. The most likely culprits are that
some portion of the pathname does not exist or a permissions issue. The some portion of the pathname does not exist or a permissions issue. The
default path is determined by --localstatedir configure parameter but default path is determined by --localstatedir or --runstatedir configure
may be overridden by setting environment variable, KEA_PIDFILE_DIR. The parameters but may be overridden by setting environment variable,
first argument is the process name. KEA_PIDFILE_DIR. The first argument is the process name.
% DCTL_PROCESS_FAILED %1 application execution failed: %2 % DCTL_PROCESS_FAILED %1 application execution failed: %2
The controller has encountered a fatal error while running the The controller has encountered a fatal error while running the

View File

@@ -1,5 +1,5 @@
SUBDIRS = . SUBDIRS = .
dhcp_data_dir = @localstatedir@/@PACKAGE@ dhcp_data_dir = @runstatedir@/@PACKAGE@
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/process/tests\" AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/process/tests\"

View File

@@ -257,9 +257,9 @@ set_logger() {
export KEA_LOGGER_DESTINATION=${LOG_FILE} export KEA_LOGGER_DESTINATION=${LOG_FILE}
} }
# PID file path is by default <kea-install-dir>/var/kea, but can be # PID file path is by default <kea-install-dir>/var/run/kea, but can be
# overridden by the environmental variable. # overridden by the environmental variable.
PID_FILE_PATH=@localstatedir@/@PACKAGE@/ PID_FILE_PATH=@runstatedir@/@PACKAGE@/
if [ ! -z ${KEA_PIDFILE_DIR} ]; then if [ ! -z ${KEA_PIDFILE_DIR} ]; then
PID_FILE_PATH="${KEA_PIDFILE_DIR}" PID_FILE_PATH="${KEA_PIDFILE_DIR}"
fi fi