summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2005-12-22 09:40:51 +0000
committerChristian Heim <phreak@gentoo.org>2005-12-22 09:40:51 +0000
commitc1395f64105640981658134855c899bc316c72c7 (patch)
treebac28abd4d8d23f57ada16511c4aa2115b8ecd57
parentfix devpts for openvz (diff)
downloadbaselayout-vserver-c1395f64105640981658134855c899bc316c72c7.tar.gz
baselayout-vserver-c1395f64105640981658134855c899bc316c72c7.tar.bz2
baselayout-vserver-c1395f64105640981658134855c899bc316c72c7.zip
Importing latest baselayout/trunk changes. This is a merge with revision 1768.
svn path=/baselayout-vserver/trunk/; revision=177
-rw-r--r--ChangeLog26
-rw-r--r--ChangeLog.vserver22
-rw-r--r--etc/conf.d/rc6
-rw-r--r--etc/profile14
-rw-r--r--net-scripts/conf.d/net.example46
-rwxr-xr-xnet-scripts/init.d/net.lo9
-rw-r--r--net-scripts/net.modules.d/dhclient7
-rw-r--r--net-scripts/net.modules.d/dhcpcd3
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/dhcp13
-rw-r--r--net-scripts/net.modules.d/helpers.d/dhcp-state2
-rw-r--r--net-scripts/net.modules.d/iwconfig50
-rw-r--r--net-scripts/net.modules.d/udhcpc3
-rwxr-xr-xsbin/functions.sh1
-rw-r--r--src/core/librcscripts/api/misc.h1
-rw-r--r--src/core/librcscripts/misc.c74
-rw-r--r--src/core/src/runscript.c66
16 files changed, 190 insertions, 153 deletions
diff --git a/ChangeLog b/ChangeLog
index ef5357d..2d7162c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,32 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2
+ 21 Dec 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Add new variable RC_DOWN_INTERFACE and documentation so that interfaces
+ are kept up for Wake On LAN support, #113880.
+
+ 21 Dec 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Make sure /etc/profile.d exists before using it #116232 by Saleem A.
+
+ * baselayout-1.12.0_pre12 (20 Dec 2005)
+
+ 20 Dec 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Ensure that tty has keyboard and stty reports icanon before enabling
+ interactive rc, #112161.
+
+ 15 Dec 2005; Roy Marples <uberlord@gentoo.org>:
+
+ When setting ad-hoc or master modes, set the mode before anything else,
+ #115664 thanks to Oldrich Jedlicka.
+
+ 14 Dec 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Add great big warning in documentation advising people not to use the
+ IPv6 examples if they don't have IPv6 enabled in their kernel, #115396.
+
09 Dec 2005; Roy Marples <uberlord@gentoo.org>:
Remove nasty undocumented backgrounding as we now support
diff --git a/ChangeLog.vserver b/ChangeLog.vserver
index d35d6dc..6f49de9 100644
--- a/ChangeLog.vserver
+++ b/ChangeLog.vserver
@@ -1,6 +1,28 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2
+ 22 Dec 2005; Christian Heim <phreak@gentoo.org>:
+ Importing latest baselayout/trunk changes. This is a merge with
+ revision 1768.
+
+ ChangeLog | 26 ++++++
+ ChangeLog.vserver | 22 +++++
+ etc/conf.d/rc | 6 +
+ etc/profile | 14 +--
+ net-scripts/conf.d/net.example | 46 +++++++----
+ net-scripts/init.d/net.lo | 9 +-
+ net-scripts/net.modules.d/dhclient | 7 -
+ net-scripts/net.modules.d/dhcpcd | 3
+ net-scripts/net.modules.d/helpers.d/dhcp | 13 ---
+ net-scripts/net.modules.d/helpers.d/dhcp-state | 2
+ net-scripts/net.modules.d/iwconfig | 50 +++---------
+ net-scripts/net.modules.d/udhcpc | 3
+ sbin/functions.sh | 1
+ src/core/librcscripts/api/misc.h | 1
+ src/core/librcscripts/misc.c | 74 ++++++++++++++++--
+ src/core/src/runscript.c | 66 ----------------
+ 16 files changed, 189 insertions(+), 153 deletions(-)
+
09 Dec 2005; Christian Heim <phreak@gentoo.org>:
Importing latest baselayout/trunk changes. This is a merge with
revision 1753.
diff --git a/etc/conf.d/rc b/etc/conf.d/rc
index 3387538..7f48996 100644
--- a/etc/conf.d/rc
+++ b/etc/conf.d/rc
@@ -35,6 +35,12 @@ RC_NET_STRICT_CHECKING="none"
RC_AUTO_INTERFACE="no"
+# RC_DOWN_INTERFACE allows you to specify if RC will bring the interface
+# compeletly down when it stops. The default is yes, but there are some
+# instances where you may not want this to happen such as using Wake On LAN.
+
+RC_DOWN_INTERFACE="yes"
+
# RC_VERBOSE will make init scripts more verbose. Only networking scripts
# really use this at this time, and this is useful for trouble shooting
# any issues you may have.
diff --git a/etc/profile b/etc/profile
index f347430..8655c73 100644
--- a/etc/profile
+++ b/etc/profile
@@ -57,9 +57,11 @@ else
PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
fi
-for sh in /etc/profile.d/*.sh ; do
- if [ -r "$sh" ] ; then
- . "$sh"
- fi
-done
-unset sh
+if [ -d /etc/profile.d ] ; then
+ for sh in /etc/profile.d/*.sh ; do
+ if [ -r "$sh" ] ; then
+ . "$sh"
+ fi
+ done
+ unset sh
+fi
diff --git a/net-scripts/conf.d/net.example b/net-scripts/conf.d/net.example
index ec6e056..e13a842 100644
--- a/net-scripts/conf.d/net.example
+++ b/net-scripts/conf.d/net.example
@@ -5,6 +5,14 @@
# In that case, everything should work out of the box, no configuration
# necessary, though the startup script will warn you that you haven't
# specified anything.
+
+#
+# WARNING :- some examples have a mixture of IPv4 (ie 192.168.0.1) and IPv6
+# (ie 4321:0:1:2:3:4:567:89ab) internet addresses. They only work if you have
+# the relevant kernel option enabled. So if you don't have an IPv6 enabled
+# kernel then remove the IPv6 address from your config.
+#
+
#
# If you want to use a static address or use DHCP explicitly, jump
# down to the section labelled INTERFACE HANDLERS.
@@ -104,11 +112,11 @@
# If you don't want ANY address (only useful when calling for advanced stuff)
#config_eth0=( "null" )
-# Here's how todo routing if you need it - the below sets the default gateway
-# and eth0 to be the default route for IPv6 unicast addresses
+# Here's how todo routing if you need it
#routes_eth0=(
-# "default via 192.168.0.1"
-# "::/0"
+# "default via 192.168.0.1" # IPv4 default route
+# "10.0.0.0/8 via 192.168.0.1" # IPv4 subnet route
+# "::/0" # IPv6 unicast
#)
# If a specified module fails (like dhcp - see below), you can specify a
@@ -362,9 +370,10 @@
#config_ppp0=( "ppp" )
#
# Each PPP interface requires an interface to use as a "Link"
-#link_ppp0="/dev/ttyS0" # Most PPP links will use a serial port
-#link_ppp0="eth0" # PPPoE requires an ethernet interface
-#link_ppp0="/dev/null" # PPPoA and ISDN links should have this
+#link_ppp0="/dev/ttyS0" # Most PPP links will use a serial port
+#link_ppp0="eth0" # PPPoE requires an ethernet interface
+#link_ppp0="/dev/null" # PPPoA and ISDN links should have this
+#link_ppp0="pty $(your_link_command)" # PPP links over ssh, rsh, etc
#
# Here you should specify what pppd plugins you want to use
# Available plugins are: pppoe, pppoa, capi, dhcpc, minconn, radius,
@@ -393,17 +402,20 @@
# "usepeerdns" # Use the DNS settings provided by PPP
#
# On demand options
-# "demand" # Enable dial on demand
-# "idle 30" # The link will go down after 30 seconds of inactivity
+# "demand" # Enable dial on demand
+# "idle 30" # Link goes down after 30 seconds of inactivity
# "10.112.112.112:10.112.112.113" # Phony IP addresses
# "ipcp-accept-remote" # Accept the peers idea of remote address
# "ipcp-accept-local" # Accept the peers idea of local address
# "holdoff 3" # Wait 3 seconds after link dies before re-starting
+#
+# Dead peer detection
# "lcp-echo-interval 15" # Send a LCP echo every 15 seconds
-# "lcp-echo-failure 3" # Make peer dead after 3 seconds of in-activity
+# "lcp-echo-failure 3" # Make peer dead after 3 consective
+# # echo-requests
#
# Compression options - use these to completely disable compression
-# "noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp"
+# noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp
#
# Dial-up settings
# "lock" # Lock serial port
@@ -622,7 +634,7 @@
# # Test for link on the interface prior to bringing it up. This
# # only works on some network adapters and requires the mii-diag
# # package to be installed.
-# if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then
+# if mii-tool "${IFACE}" 2> /dev/null | grep -q 'no link'; then
# ewarn "No link on ${IFACE}, aborting configuration"
# return 1
# fi
@@ -630,11 +642,12 @@
# # Test for link on the interface prior to bringing it up. This
# # only works on some network adapters and requires the ethtool
# # package to be installed.
-# if ethtool ${IFACE} | grep -q 'Link detected: no'; then
+# if ethtool "${IFACE}" | grep -q 'Link detected: no'; then
# ewarn "No link on ${IFACE}, aborting configuration"
# return 1
# fi
#
+#
# # Remember to return 0 on success
# return 0
#}
@@ -661,8 +674,11 @@
#}
#postdown() {
-# # This function is mostly here for completeness... I haven't
-# # thought of anything nifty to do with it yet ;-)
+# # Enable Wake-On-LAN for the interface
+# # Probably a good idea to set RC_DOWN_INTERFACE="no" in /etc/conf.d/rc
+# # as well ;)
+# ethtool -s "${IFACE}" wol g
+#
# # Return 0 always
# return 0
#}
diff --git a/net-scripts/init.d/net.lo b/net-scripts/init.d/net.lo
index 1ba02d9..2218475 100755
--- a/net-scripts/init.d/net.lo
+++ b/net-scripts/init.d/net.lo
@@ -698,7 +698,8 @@ iface_stop() {
interface_del_addresses "${i}"
# Do final shut down of this alias
- if ! ${IN_BACKGROUND}; then
+ if [[ ${IN_BACKGROUND} != "true" \
+ && ${RC_DOWN_INTERFACE} == "yes" ]]; then
ebegin "Shutting down ${i}"
interface_iface_stop "${i}"
eend "$?"
@@ -774,7 +775,9 @@ run_start() {
# Start the interface
if ! iface_start "${iface}" ; then
- interface_exists "${iface}" && interface_down "${iface}"
+ if [[ ${IN_BACKGROUND} != "true" ]]; then
+ interface_exists "${iface}" && interface_down "${iface}"
+ fi
eend 1
return 1
fi
@@ -904,6 +907,8 @@ run() {
eoutdent
fi
fi
+ [[ ${IN_BACKGROUND} == "true" ]] \
+ && mark_service_inactive "net.${iface}"
fi
return "${r}"
diff --git a/net-scripts/net.modules.d/dhclient b/net-scripts/net.modules.d/dhclient
index 4754628..91a751a 100644
--- a/net-scripts/net.modules.d/dhclient
+++ b/net-scripts/net.modules.d/dhclient
@@ -135,18 +135,13 @@ dhclient_start() {
# Bring up DHCP for this interface (or alias)
ebegin "Running dhclient"
-
- # Stop dhclient if it's already running
- dhclient_stop "${iface}"
-
local x=$( eval dhclient "${opts}" -1 -pf "${pidfile}" \
-sf "${MODULES_DIR}/helpers.d/dhclient-wrapper" -q "${iface}" 2>&1 )
# We just check the last 5 letters
[[ ${x:${#x} - 5:5} == "bound" ]]
if [[ $? != "0" ]]; then
echo "${x}"
- # We need to kill the process if we fail
- [[ -e ${pidfile} ]] && kill -s TERM $( < "${pidfile}" ) 2>/dev/null
+ dhclient_stop "${iface}" &>/dev/null
eend 1
return 1
fi
diff --git a/net-scripts/net.modules.d/dhcpcd b/net-scripts/net.modules.d/dhcpcd
index 12ed4c8..b7b942f 100644
--- a/net-scripts/net.modules.d/dhcpcd
+++ b/net-scripts/net.modules.d/dhcpcd
@@ -123,9 +123,6 @@ dhcpcd_start() {
# Bring up DHCP for this interface (or alias)
ebegin "Running dhcpcd"
- # Halt any existing dhcpcd process
- dhcpcd_stop "${iface}"
-
[[ ! -d "${statedir}/${iface}" ]] && mkdir -m 0755 -p "${statedir}/${iface}"
eval dhcpcd "${opts}" "${iface}"
eend $? || return 1
diff --git a/net-scripts/net.modules.d/helpers.d/dhcp b/net-scripts/net.modules.d/helpers.d/dhcp
index 52998ca..bb96565 100755
--- a/net-scripts/net.modules.d/helpers.d/dhcp
+++ b/net-scripts/net.modules.d/helpers.d/dhcp
@@ -17,12 +17,10 @@ case "${action}" in
bound|renew)
# We handle these actions below
;;
- deconfig)
+ deconfig|leasefail)
# Just remove IPv4 / inet addresses
interface_del_addresses "${interface}" true
- if service_starting "${service}" || service_started "${service}" ; then
- mark_service_inactive "net.${interface}"
- fi
+ service_started "${service}" && mark_service_inactive "net.${interface}"
remove_state "${interface}"
if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
best_interface=$( select_best_interface )
@@ -35,13 +33,6 @@ case "${action}" in
echo "${action}"
exit 0
;;
- leasefail)
- if service_starting "${service}" || service_started "${service}" ; then
- mark_service_inactive "net.${interface}"
- fi
- echo "${action}"
- exit 0
- ;;
*)
echo "${action}"
echo "We don't handle that action" >&2
diff --git a/net-scripts/net.modules.d/helpers.d/dhcp-state b/net-scripts/net.modules.d/helpers.d/dhcp-state
index 244fbb0..6c91bea 100644
--- a/net-scripts/net.modules.d/helpers.d/dhcp-state
+++ b/net-scripts/net.modules.d/helpers.d/dhcp-state
@@ -15,7 +15,7 @@ if [[ ${action} != "up" ]]; then
service_started "${service}" && mark_service_inactive "${service}"
remove_state "${interface}" false
else
- ! service_stopping "${service}" && mark_service_started "${service}"
+ service_inactive "${service}" && mark_service_started "${service}"
fi
if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
diff --git a/net-scripts/net.modules.d/iwconfig b/net-scripts/net.modules.d/iwconfig
index cd94cac..3f1eb22 100644
--- a/net-scripts/net.modules.d/iwconfig
+++ b/net-scripts/net.modules.d/iwconfig
@@ -191,19 +191,6 @@ iwconfig_setup_specific() {
dessid="${ESSID//\\\\/\\\\}"
ESSIDVAR=$( bash_variable "${ESSID}" )
key=$( iwconfig_get_wep_key )
-
- if ! eval iwconfig "${iface}" key "${key}" ; then
- if [[ ${key} != "off" ]]; then
- ewarn "${iface} does not support setting keys"
- ewarn "or the parameter \"mac_key_${ESSIDVAR}\" or \"key_${ESSIDVAR}\" is incorrect"
- fi
- fi
-
- if ! iwconfig "${iface}" essid "${ESSID}" ; then
- eerror "${iface} does not support setting ESSID to \"${dessid}\""
- return 1
- fi
- iwconfig "${iface}" nick "${ESSID}" 2>/dev/null
# We only change the mode if it's not the same
local cur_mode=$( iwconfig_get_mode "${iface}" )
@@ -217,21 +204,28 @@ iwconfig_setup_specific() {
channel="channel_${ifvar}"
# We default the channel to 3
channel="${!channel:-3}"
-
if ! iwconfig "${iface}" channel "${channel}" ; then
ewarn "${iface} does not support setting the channel to \"${channel}\""
return 1
fi
- iwconfig_user_config "${iface}"
- iwconfig_report "${iface}"
+ # Now set the key
+ if ! eval iwconfig "${iface}" key "${key}" ; then
+ if [[ ${key} != "off" ]]; then
+ ewarn "${iface} does not support setting keys"
+ ewarn "or the parameter \"mac_key_${ESSIDVAR}\" or \"key_${ESSIDVAR}\" is incorrect"
+ fi
+ fi
- if ${IN_BACKGROUND}; then
- mark_service_inactive "net.${iface}"
- export IN_BACKGROUND
- /etc/init.d/net.${iface} start &
- exit 0
+ # Finally set the ESSID
+ if ! iwconfig "${iface}" essid "${ESSID}" ; then
+ eerror "${iface} does not support setting ESSID to \"${dessid}\""
+ return 1
fi
+ iwconfig "${iface}" nick "${ESSID}" 2>/dev/null
+
+ iwconfig_user_config "${iface}"
+ iwconfig_report "${iface}"
return 0
}
@@ -398,14 +392,6 @@ iwconfig_associate() {
eoutdent
fi
- if ${IN_BACKGROUND}; then
- mark_service_started "net.${iface}"
- mark_service_inactive "net.${iface}"
- export IN_BACKGROUND
- /etc/init.d/net.${iface} start &
- exit 0
- fi
-
return 0
}
@@ -841,12 +827,6 @@ iwconfig_configure() {
return $?
fi
- if ${IN_BACKGROUND}; then
- export IN_BACKGROUND
- /etc/init.d/net.${iface} stop &
- exit 0
- fi
-
eerror "${e}"
return 1
}
diff --git a/net-scripts/net.modules.d/udhcpc b/net-scripts/net.modules.d/udhcpc
index b9f566c..b7dde5a 100644
--- a/net-scripts/net.modules.d/udhcpc
+++ b/net-scripts/net.modules.d/udhcpc
@@ -91,9 +91,6 @@ udhcpc_start() {
# Bring up DHCP for this interface (or alias)
ebegin "Running udhcpc"
- # Stop any instance of udhcpc on this interface
- udhcpc_stop "${interface}"
-
# Try and load the cache if it exists
if [[ -f ${cachefile} ]]; then
if [[ " ${opts}" != *" --request="* && " ${opts} " != *" -r "* ]]; then
diff --git a/sbin/functions.sh b/sbin/functions.sh
index 0ca1110..dc7997f 100755
--- a/sbin/functions.sh
+++ b/sbin/functions.sh
@@ -37,6 +37,7 @@ RC_ENDCOL="yes"
RC_TTY_NUMBER=${RC_TTY_NUMBER:-0}
RC_PARALLEL_STARTUP=${RC_PARALLEL_STARTUP:-no}
RC_NET_STRICT_CHECKING=${RC_NET_STRICT_CHECKING:-none}
+RC_DOWN_INTERFACE=${RC_DOWN_INTERFACE:-yes}
#
# Default values for e-message indentation and dots
diff --git a/src/core/librcscripts/api/misc.h b/src/core/librcscripts/api/misc.h
index effaa50..67eb214 100644
--- a/src/core/librcscripts/api/misc.h
+++ b/src/core/librcscripts/api/misc.h
@@ -95,6 +95,7 @@ int rmtree (const char *pathname);
* there is nothing to return. */
char **ls_dir (const char *pathname, int hidden);
char *get_cnf_entry (const char *pathname, const char *entry);
+char ** get_list_file (char **list, char *filename);
/* Below three functions (file_map, file_unmap and buf_get_line) are from
* udev-050 (udev_utils.c). Please see misc.c for copyright info.
diff --git a/src/core/librcscripts/misc.c b/src/core/librcscripts/misc.c
index 08546ee..37edc5f 100644
--- a/src/core/librcscripts/misc.c
+++ b/src/core/librcscripts/misc.c
@@ -65,17 +65,15 @@ strcatpaths (const char *pathname1, const char *pathname2)
return 0;
/* Lenght of pathname1 + lenght of pathname2 + '/' if needed */
- lenght = strlen (pathname1) + strlen (pathname2) + 1;
+ lenght = strlen (pathname1) + strlen (pathname2) + 2;
/* lenght + '\0' */
- new_path = xmalloc (lenght + 1);
+ new_path = xmalloc (lenght);
if (NULL == new_path)
return NULL;
- strncpy (new_path, pathname1, lenght);
- /* Should we add a '/' ? */
- if (new_path[strlen (new_path) - 1] != '/')
- strncat (new_path, "/", lenght - strlen (new_path));
- strncat (new_path, pathname2, lenght - strlen (new_path));
+ snprintf (new_path, lenght, "%s%s%s", pathname1,
+ (new_path[strlen (new_path) - 1] != '/') ? "/" : "",
+ pathname2);
return new_path;
}
@@ -567,6 +565,68 @@ _continue:
return value;
}
+char **
+get_list_file (char **list, char *filename)
+{
+ dyn_buf_t *dynbuf = NULL;
+ char *buf = NULL;
+ char *tmp_p = NULL;
+ char *token = NULL;
+
+ if (!check_arg_str (filename))
+ return NULL;
+
+ dynbuf = new_dyn_buf_mmap_file (filename);
+ if (NULL == dynbuf)
+ return NULL;
+
+ while (NULL != (buf = read_line_dyn_buf (dynbuf)))
+ {
+ tmp_p = buf;
+
+ /* Strip leading spaces/tabs */
+ while ((tmp_p[0] == ' ') || (tmp_p[0] == '\t'))
+ tmp_p++;
+
+ /* Get entry - we do not want comments, and only the first word
+ * on a line is valid */
+ token = strsep (&tmp_p, "# \t");
+ if (check_str (token))
+ {
+ tmp_p = xstrndup (token, strlen (token));
+ if (NULL == tmp_p)
+ {
+ if (NULL != list)
+ str_list_free (list);
+ free_dyn_buf (dynbuf);
+ free (buf);
+
+ return NULL;
+ }
+
+ str_list_add_item (list, tmp_p, error);
+ }
+
+ free (buf);
+ }
+
+ /* read_line_dyn_buf() returned NULL with errno set */
+ if ((NULL == buf) && (0 != errno))
+ {
+ DBG_MSG ("Failed to read line from dynamic buffer!\n");
+error:
+ if (NULL != list)
+ str_list_free (list);
+ free_dyn_buf (dynbuf);
+
+ return NULL;
+ }
+
+ free_dyn_buf (dynbuf);
+
+ return list;
+}
+
/*
* Below three functions (file_map, file_unmap and buf_get_line) are
diff --git a/src/core/src/runscript.c b/src/core/src/runscript.c
index bccd61e..0c633e7 100644
--- a/src/core/src/runscript.c
+++ b/src/core/src/runscript.c
@@ -24,7 +24,6 @@ static void (*selinux_run_init_old) (void);
static void (*selinux_run_init_new) (int argc, char **argv);
void setup_selinux (int argc, char **argv);
-char ** get_whitelist (char **whitelist, char *filename);
char ** filter_environ (char *caller);
extern char **environ;
@@ -55,67 +54,6 @@ setup_selinux (int argc, char **argv)
}
char **
-get_whitelist (char **whitelist, char *filename)
-{
- char *buf = NULL;
- char *tmp_buf = NULL;
- char *tmp_p = NULL;
- char *token = NULL;
- size_t lenght = 0;
- int count = 0;
- int current = 0;
-
- if (-1 == file_map (filename, &buf, &lenght))
- return NULL;
-
- while (current < lenght)
- {
- count = buf_get_line (buf, lenght, current);
-
- tmp_buf = xstrndup (&buf[current], count);
- if (NULL == tmp_buf)
- goto error;
-
- tmp_p = tmp_buf;
-
- /* Strip leading spaces/tabs */
- while ((tmp_p[0] == ' ') || (tmp_p[0] == '\t'))
- tmp_p++;
-
- /* Get entry - we do not want comments, and only the first word
- * on a line is valid */
- token = strsep (&tmp_p, "# \t");
- if (check_str (token))
- {
- tmp_p = xstrndup (token, strlen (token));
- if (NULL == tmp_p)
- goto error;
-
- str_list_add_item (whitelist, tmp_p, error);
- }
-
- current += count + 1;
- free (tmp_buf);
- /* Set to NULL in case we error out above and have
- * to free below */
- tmp_buf = NULL;
- }
-
-
- file_unmap (buf, lenght);
-
- return whitelist;
-
-error:
- if (NULL != tmp_buf)
- free (tmp_buf);
- file_unmap (buf, lenght);
- str_list_free (whitelist);
-
- return NULL;
-}
-
-char **
filter_environ (char *caller)
{
char **myenv = NULL;
@@ -130,12 +68,12 @@ filter_environ (char *caller)
return environ;
if (1 == is_file (SYS_WHITELIST, 1))
- whitelist = get_whitelist (whitelist, SYS_WHITELIST);
+ whitelist = get_list_file (whitelist, SYS_WHITELIST);
else
EWARN ("System environment whitelist missing!\n");
if (1 == is_file (USR_WHITELIST, 1))
- whitelist = get_whitelist (whitelist, USR_WHITELIST);
+ whitelist = get_list_file (whitelist, USR_WHITELIST);
if (NULL == whitelist)
/* If no whitelist is present, revert to old behaviour */