This is just a post 2.0.7 idea. Comments please.

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


Resource Scripts: Make sure that SYSTYPE is quoted

This is probably a bit paranoid, but $SYSTYPE really ought to be quoted
when used in if-then-else claueses. I'm not sure about case, but
there was one quoted instance, so I made them all quoted. I can make
the reverse change if that is prefered.

Signed-Off-By: Simon Horman <[EMAIL PROTECTED]>
Index: linux-ha/resources/OCF/IPaddr2.in
===================================================================
--- linux-ha.orig/resources/OCF/IPaddr2.in      2006-08-09 20:11:30.000000000 
+0900
+++ linux-ha/resources/OCF/IPaddr2.in   2006-08-09 20:11:36.000000000 +0900
@@ -276,7 +276,7 @@
        IF_MAC="$OCF_RESKEY_mac"
 
        LVS_SUPPORT=0
-       if [ $SYSTYPE = "Linux" -o $SYSTYPE = "SunOS" ]; then
+       if [ "$SYSTYPE" = "Linux" -o "$SYSTYPE" = "SunOS" ]; then
            if [ x"${OCF_RESKEY_lvs_support}" = x"true" \
                -o x"${OCF_RESKEY_lvs_support}" = x"on" \
                -o x"${OCF_RESKEY_lvs_support}" = x"1" ]; then
Index: linux-ha/resources/OCF/IPaddr.in
===================================================================
--- linux-ha.orig/resources/OCF/IPaddr.in       2006-08-09 20:11:30.000000000 
+0900
+++ linux-ha/resources/OCF/IPaddr.in    2006-08-09 20:11:36.000000000 +0900
@@ -270,7 +270,7 @@
        esac
 
        LVS_SUPPORT=0
-       if [ $SYSTYPE = "Linux" -o $SYSTYPE = "SunOS" ]; then
+       if [ "$SYSTYPE" = "Linux" -o "$SYSTYPE" = "SunOS" ]; then
            if [ x"${OCF_RESKEY_lvs_support}" = x"true" \
                -o x"${OCF_RESKEY_lvs_support}" = x"on" \
                -o x"${OCF_RESKEY_lvs_support}" = x"1" ]; then
@@ -368,7 +368,7 @@
     esac
 
 
-    case $SYSTYPE in
+    case "$SYSTYPE" in
       *BSD)
                $IFCONFIG | grep "$ipaddr" -B20 | grep "UP," | tail -n 1 | cut 
-d ":" -f 1
                return 0;;
@@ -393,7 +393,7 @@
 #
 find_interface() {
     ipaddr="$1"
-    case $SYSTYPE in
+    case "$SYSTYPE" in
        SunOS)
                NIC=`find_interface_solaris $ipaddr`
         ;;
@@ -419,7 +419,7 @@
        return $OCF_ERR_GENERIC;
     fi
 
-  case $SYSTYPE in
+  case "$SYSTYPE" in
        *BSD)
                echo $NIC;
                return $OCF_SUCCESS;;
@@ -438,7 +438,7 @@
   NICBASE="$VLDIR/$NIC"
   touch "$NICBASE"
 
-  case $SYSTYPE in
+  case "$SYSTYPE" in
        SunOS)
                j=1
                ;;
@@ -485,7 +485,7 @@
 delete_route () {
   ipaddr="$1"
 
-  case $SYSTYPE in
+  case "$SYSTYPE" in
        SunOS)
                CMD=""
                ;;
@@ -508,7 +508,7 @@
   ifname="$1"
   ipaddr="$2"
 
-  case $SYSTYPE in
+  case "$SYSTYPE" in
        SunOS)
                if [ "$SYSVERSION" -ge 8 ] ; then
                    CMD="$IFCONFIG $ifname unplumb"
Index: linux-ha/resources/OCF/IPsrcaddr.in
===================================================================
--- linux-ha.orig/resources/OCF/IPsrcaddr.in    2006-08-09 20:11:30.000000000 
+0900
+++ linux-ha/resources/OCF/IPsrcaddr.in 2006-08-09 20:11:36.000000000 +0900
@@ -300,7 +300,7 @@
       : Nothing
     done
 
-    case $SYSTYPE in
+    case "$SYSTYPE" in
       *BSD)
                $IFCONFIG | grep "$BASEIP" -B4 | grep "UP," | cut -d ":" -f 1
                return 0;;
@@ -324,7 +324,7 @@
 #       is an (aliased) interface name (e.g., "eth0" and "eth0:0").
 #
 find_interface() {
-    case $SYSTYPE in
+    case "$SYSTYPE" in
        SunOS)
                IF=`find_interface_solaris $BASEIP`
         ;;
@@ -351,7 +351,7 @@
   esac
 
 
-  case $SYSTYPE in
+  case "$SYSTYPE" in
       *BSD)
          $IFCONFIG $IFCONFIG_A_OPT | grep "inet.*[: ]$BASEIP " >/dev/null 2>&1
          if [ $? = 0 ]; then

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to