aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2000-08-03 14:21:32 +0000
committerNalin Dahyabhai <nalin@redhat.com>2000-08-03 14:21:32 +0000
commit6e3016030556c37994a9f3ecadd81bfa747b0b72 (patch)
treed940ba27a1fa4133fe2f84cef1eb2bbe0822bf65
parent90c9c1bdb710b438fc84aea4bcad180cf9eed12f (diff)
downloadinitscripts-6e3016030556c37994a9f3ecadd81bfa747b0b72.tar
initscripts-6e3016030556c37994a9f3ecadd81bfa747b0b72.tar.gz
initscripts-6e3016030556c37994a9f3ecadd81bfa747b0b72.tar.bz2
initscripts-6e3016030556c37994a9f3ecadd81bfa747b0b72.tar.xz
initscripts-6e3016030556c37994a9f3ecadd81bfa747b0b72.zip
be more specific about quoting variables
-rw-r--r--src/shvar.c6
-rwxr-xr-xsysconfig/network-scripts/ifup70
-rwxr-xr-xsysconfig/network-scripts/ifup-ppp50
3 files changed, 63 insertions, 63 deletions
diff --git a/src/shvar.c b/src/shvar.c
index 48f62ce0..765a77e7 100644
--- a/src/shvar.c
+++ b/src/shvar.c
@@ -133,8 +133,8 @@ unescape(char *s) {
/* create a new string with all necessary characters escaped.
* caller must free returned string
*/
-static const char escapees[] = "\"'\\$~`"; /* must be escaped */
-static const char spaces[] = " \t"; /* only require "" */
+static const char escapees[] = "\"'\\$~`"; /* must be escaped */
+static const char spaces[] = " \t|&;()<>"; /* only require "" */
static char *
escape(const char *s) {
char *new;
@@ -280,7 +280,7 @@ svSetValue(shvarFile *s, const char *key, const char *value)
if (val1 && newval && !strcmp(val1, newval)) goto bail;
if (s->parent) val2 = svGetValue(s->parent, key);
- if (!newval) {
+ if (!newval || !newval[0]) {
/* delete value somehow */
if (val2) {
/* change/append line to get key= */
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index fe8bd474..6f7db977 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -6,23 +6,23 @@ cd /etc/sysconfig/network-scripts
need_hostname
-CONFIG=$1
+CONFIG=${1}
-[ -z "$CONFIG" ] && {
+[ -z "${CONFIG}" ] && {
echo "usage: ifup <device name>" >&2
exit 1
}
-[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
-[ -f "$CONFIG" ] || {
+[ -f "${CONFIG}" ] || CONFIG=ifcfg-${CONFIG}
+[ -f "${CONFIG}" ] || {
echo "usage: ifup <device name>" >&2
exit 1
}
-if [ $UID != 0 ]; then
+if [ ${UID} != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
- if /usr/sbin/usernetctl $CONFIG report ; then
- exec /usr/sbin/usernetctl $CONFIG up
+ if /usr/sbin/usernetctl ${CONFIG} report ; then
+ exec /usr/sbin/usernetctl ${CONFIG} up
fi
fi
echo "Users cannot control this device." >&2
@@ -38,20 +38,20 @@ fi
IPSETUP=no
-DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"`
-REALDEVICE=`echo $DEVICE | sed 's/:.*//g'`
-if echo $DEVICE | grep -q ':' ; then
+DEVICETYPE=`echo ${DEVICE} | sed "s/[0-9]*$//"`
+REALDEVICE=`echo ${DEVICE} | sed 's/:.*//g'`
+if echo ${DEVICE} | grep -q ':' ; then
ISALIAS=yes
else
ISALIAS=no
fi
# Old BOOTP variable
-if [ "$BOOTP" = "yes" ]; then
+if [ "${BOOTP}" = "yes" ]; then
BOOTPROTO=bootp
fi
-if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
+if [ "${BOOTPROTO}" = bootp -o "${BOOTPROTO}" = dhcp ]; then
DYNCONFIG=true
fi
@@ -61,8 +61,8 @@ fi
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${DEVICETYPE}"
-if [ -x $OTHERSCRIPT ]; then
- exec $OTHERSCRIPT $CONFIG $2
+if [ -x ${OTHERSCRIPT} ]; then
+ exec ${OTHERSCRIPT} ${CONFIG} $2
fi
# is this device available? (this catches PCMCIA devices for us)
@@ -72,51 +72,51 @@ if [ "$?" = "0" ]; then
exit 1
fi
-if [ "$SLAVE" = yes -a "$ISALIAS" = no -a "$MASTER" != "" -a \
+if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" -a \
-x /sbin/ifenslave ]; then
- RFLAG="" ; [ "$RECEIVEONLY" = yes ] && RFLAG="-r"
+ RFLAG="" ; [ "${RECEIVEONLY}" = yes ] && RFLAG="-r"
ifconfig ${DEVICE} down
- echo "Enslaving $DEVICE to $MASTER"
- ifenslave $RFLAG "$MASTER" "$DEVICE"
+ echo "Enslaving ${DEVICE} to ${MASTER}"
+ ifenslave ${RFLAG} "${MASTER}" "${DEVICE}"
exit 0
fi
-if [ -n "$MACADDR" ]; then
+if [ -n "${MACADDR}" ]; then
ifconfig ${DEVICE} hw ether ${MACADDR}
fi
-if [ -n "$DYNCONFIG" ]; then
+if [ -n "${DYNCONFIG}" ]; then
PUMPARGS=
DHCPCDARGS=
- if [ -n "$DHCP_HOSTNAME" ]; then
- PUMPARGS="-h $DHCP_HOSTNAME"
- DHCPCDARGS="-h $DHCP_HOSTNAME"
+ if [ -n "${DHCP_HOSTNAME}" ]; then
+ PUMPARGS="-h ${DHCP_HOSTNAME}"
+ DHCPCDARGS="-h ${DHCP_HOSTNAME}"
fi
- if [ -n "$NEEDHOSTNAME" ]; then
- PUMPARGS="$PUMPARGS --lookup-hostname"
- DHCPCDARGS="$DHCPCDARGS -H"
+ if [ -n "${NEEDHOSTNAME}" ]; then
+ PUMPARGS="${PUMPARGS} --lookup-hostname"
+ DHCPCDARGS="${DHCPCDARGS} -H"
fi
- echo -n "Determining IP information for $DEVICE..."
- if /sbin/pump $PUMPARGS -i $DEVICE ; then
+ echo -n "Determining IP information for ${DEVICE}..."
+ if /sbin/pump ${PUMPARGS} -i ${DEVICE} ; then
echo " done."
- elif /sbin/dhcpcd $DHCPCDARGS $DEVICE ; then
+ elif /sbin/dhcpcd ${DHCPCDARGS} ${DEVICE} ; then
echo " done."
else
echo " failed."
exit 1
fi
else
- if [ -z "$NETMASK" ]; then
+ if [ -z "${NETMASK}" ]; then
eval `/bin/ipcalc --netmask ${IPADDR}`
fi
- if [ -z "$BROADCAST" ]; then
+ if [ -z "${BROADCAST}" ]; then
eval `/bin/ipcalc --broadcast ${IPADDR} ${NETMASK}`
fi
- if [ -z "$NETWORK" ]; then
+ if [ -z "${NETWORK}" ]; then
eval `/bin/ipcalc --network ${IPADDR} ${NETMASK}`
fi
@@ -148,8 +148,8 @@ fi
. /etc/sysconfig/network
-if [ "$IPX" = yes ]; then
- /etc/sysconfig/network-scripts/ifup-ipx $DEVICE
+if [ "${IPX}" = yes ]; then
+ /etc/sysconfig/network-scripts/ifup-ipx ${DEVICE}
fi
-exec /etc/sysconfig/network-scripts/ifup-post $CONFIG $2
+exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2}
diff --git a/sysconfig/network-scripts/ifup-ppp b/sysconfig/network-scripts/ifup-ppp
index 2827df36..a8a3f7d6 100755
--- a/sysconfig/network-scripts/ifup-ppp
+++ b/sysconfig/network-scripts/ifup-ppp
@@ -12,44 +12,44 @@ if [ "$1" = daemon ] ; then
else
# just in case a full path to the configuration file is passed in
CONFIG=$(basename $1)
- [ -f "$CONFIG" ] || CONFIG=ifcfg-$1
+ [ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
source_config
- if [ "$DEMAND" != yes ] ; then
+ if [ "${DEMAND}" != yes ] ; then
# let ppp-watch do the right thing
shift
exec /sbin/ppp-watch "${DEVICE}" "$@"
fi
fi
-CONFIG=$1
-[ -f "$CONFIG" ] || CONFIG=ifcfg-$1
+CONFIG=${1}
+[ -f "${CONFIG}" ] || CONFIG=ifcfg-$1
source_config
-if [ -z "$DISCONNECTTIMEOUT" ]; then
+if [ -z "${DISCONNECTTIMEOUT}" ]; then
DISCONNECTTIMEOUT=2
fi
-if [ -z "$RETRYTIMEOUT" ]; then
+if [ -z "${RETRYTIMEOUT}" ]; then
RETRYTIMEOUT=30
fi
-if [ "$2" = "boot" -a "${ONBOOT}" = "no" ]; then
+if [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; then
exit
fi
[ -x /usr/sbin/pppd ] || {
echo "/usr/sbin/pppd does not exist or is not executable"
- echo "ifup-ppp for $DEVICE exiting"
+ echo "ifup-ppp for ${DEVICE} exiting"
logger -p daemon.info -t ifup-ppp \
- "/usr/sbin/pppd does not exist or is not executable for $DEVICE"
+ "/usr/sbin/pppd does not exist or is not executable for ${DEVICE}"
exit 1
}
-[ -n "$WVDIALSECT" -o -f /etc/sysconfig/network-scripts/chat-$DEVICE ] || {
- echo "/etc/sysconfig/network-scripts/chat-$DEVICE does not exist"
- echo "ifup-ppp for $DEVICE exiting"
+[ -n "${WVDIALSECT}" -o -f /etc/sysconfig/network-scripts/chat-${DEVICE} ] || {
+ echo "/etc/sysconfig/network-scripts/chat-${DEVICE} does not exist"
+ echo "ifup-ppp for ${DEVICE} exiting"
logger -p daemon.info -t ifup-ppp \
- "/etc/sysconfig/network-scripts/chat-$DEVICE does not exist for $DEVICE"
+ "/etc/sysconfig/network-scripts/chat-${DEVICE} does not exist for ${DEVICE}"
exit 1
}
@@ -94,28 +94,28 @@ if [ ${DEMAND} = yes ] ; then
fi
fi
-if [ -z "$WVDIALSECT" ] ; then
- CHATSCRIPT=/etc/sysconfig/network-scripts/chat-$DEVNAME
- [ -f $CHATSCRIPT ] || {
- CHATSCRIPT=/etc/sysconfig/network-scripts/chat-$PARENTDEVNAME
+if [ -z "${WVDIALSECT}" ] ; then
+ CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${DEVNAME}
+ [ -f "${CHATSCRIPT}" ] || {
+ CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${PARENTDEVNAME}
}
else
CHATSCRIPT=
fi
(logger -p daemon.info -t ifup-ppp \
- "pppd started for $DEVICE on $MODEMPORT at $LINESPEED" &)&
+ "pppd started for ${DEVICE} on ${MODEMPORT} at ${LINESPEED}" &)&
-if [ -n "$WVDIALSECT" ] ; then
- exec /usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
- ipparam $DEVICE linkname $DEVICE \
+if [ -n "${WVDIALSECT}" ] ; then
+ exec /usr/sbin/pppd -detach $opts ${MODEMPORT} ${LINESPEED} \
+ ipparam ${DEVICE} linkname ${DEVICE} \
noauth \
${PPPOPTIONS} \
- connect "/usr/bin/wvdial --remotename $DEVICE --chat $WVDIALSECT"
+ connect "/usr/bin/wvdial --remotename ${DEVICE} --chat ${WVDIALSECT}"
else
- exec /usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
- ipparam $DEVICE linkname $DEVICE \
+ exec /usr/sbin/pppd -detach $opts ${MODEMPORT} ${LINESPEED} \
+ ipparam ${DEVICE} linkname ${DEVICE} \
noauth \
${PPPOPTIONS} \
- connect "/usr/sbin/chat $chatdbg -f $CHATSCRIPT"
+ connect "/usr/sbin/chat $chatdbg -f ${CHATSCRIPT}"
fi