« Return to Thread: Please quote SYSADMIN

Please quote SYSADMIN

by Wilson Snyder :: Rate this Message:

| View in Thread


Thanks for the great package!

I just hit a trivial bug; if the default SYSADMIN variable
contains shell characters, the onbattery, etc scripts will
break.  I suggest the attached patches against 3.14.10.
Thanks.


diff --git a/examples/offbattery.cpufreq b/examples/offbattery.cpufreq
index 85c3194..30e9b23 100755
--- a/examples/offbattery.cpufreq
+++ b/examples/offbattery.cpufreq
@@ -9,7 +9,7 @@
 #
 # NOTE: Assumes Linux-2.6.x kernel with CPUFREQ
 # support for your chipset.
-SYSADMIN=root
+SYSADMIN="root"
 APCUPSD_MAIL="/bin/mail"
 
 # Iterate over all CPUs, enabling the userspace governor
@@ -37,6 +37,6 @@ MSG="$HOSTNAME Power has returned"
    done
    echo " "
    /sbin/apcaccess status
-) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
+) | $APCUPSD_MAIL -s "$MSG" "$SYSADMIN"
 exit 0
 
diff --git a/examples/onbattery.cpufreq b/examples/onbattery.cpufreq
index 1d0c1a1..c5d7b25 100755
--- a/examples/onbattery.cpufreq
+++ b/examples/onbattery.cpufreq
@@ -10,7 +10,7 @@
 # NOTE: Assumes Linux-2.6.x kernel with CPUFREQ
 # support for your chipset. Enable appropriate
 # modprobe line below to match your hardware.
-SYSADMIN=root
+SYSADMIN="root"
 APCUPSD_MAIL="/bin/mail"
 
 # Load the appropriate cpufreq module. This is best done
@@ -50,6 +50,6 @@ MSG="$HOSTNAME Power Failure!"
    done
    echo " "
    /sbin/apcaccess status
-) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
+) | $APCUPSD_MAIL -s "$MSG" "$SYSADMIN"
 exit 0
 
diff --git a/platforms/etc/changeme.in b/platforms/etc/changeme.in
index 8378f8d..30a47ac 100755
--- a/platforms/etc/changeme.in
+++ b/platforms/etc/changeme.in
@@ -5,7 +5,7 @@
 # detects that the battery should be replaced.
 # We send an email message to root to notify him.
 #
-SYSADMIN=root
+SYSADMIN="root"
 APCUPSD_MAIL="@APCUPSD_MAIL@"
 
 HOSTNAME=`hostname`
@@ -17,5 +17,5 @@ MSG="$HOSTNAME UPS battery needs changing NOW."
    echo "$MSG"
    echo " "
    @sbindir@/apcaccess status
-) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
+) | $APCUPSD_MAIL -s "$MSG" "$SYSADMIN"
 exit 0
diff --git a/platforms/etc/commfailure.in b/platforms/etc/commfailure.in
index db5f03a..09c1ca3 100755
--- a/platforms/etc/commfailure.in
+++ b/platforms/etc/commfailure.in
@@ -5,7 +5,7 @@
 # loses contact with the UPS (i.e. the serial connection is not responding).
 # We send an email message to root to notify him.
 #
-SYSADMIN=root
+SYSADMIN="root"
 APCUPSD_MAIL="@APCUPSD_MAIL@"
 
 HOSTNAME=`hostname`
@@ -17,5 +17,5 @@ MSG="$HOSTNAME Communications with UPS lost"
    echo "$MSG"
    echo " "
    @sbindir@/apcaccess status
-) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
+) | $APCUPSD_MAIL -s "$MSG" "$SYSADMIN"
 exit 0
diff --git a/platforms/etc/commok.in b/platforms/etc/commok.in
index 628548e..fd5d676 100755
--- a/platforms/etc/commok.in
+++ b/platforms/etc/commok.in
@@ -5,7 +5,7 @@
 # restores contact with the UPS (i.e. the serial connection is restored).
 # We send an email message to root to notify him.
 #
-SYSADMIN=root
+SYSADMIN="root"
 APCUPSD_MAIL="@APCUPSD_MAIL@"
 
 HOSTNAME=`hostname`
@@ -17,5 +17,5 @@ MSG="$HOSTNAME Communications with UPS restored"
    echo "$MSG"
    echo " "
    @sbindir@/apcaccess status
-) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
+) | $APCUPSD_MAIL -s "$MSG" "$SYSADMIN"
 exit 0
diff --git a/platforms/etc/offbattery.in b/platforms/etc/offbattery.in
index 22e9a99..2753574 100755
--- a/platforms/etc/offbattery.in
+++ b/platforms/etc/offbattery.in
@@ -5,7 +5,7 @@
 # UPS goes back on to the mains after a power failure.
 # We send an email message to root to notify him.
 #
-SYSADMIN=root
+SYSADMIN="root"
 APCUPSD_MAIL="@APCUPSD_MAIL@"
 
 HOSTNAME=`hostname`
@@ -17,5 +17,5 @@ MSG="$HOSTNAME Power has returned"
    echo "$MSG"
    echo " "
    @sbindir@/apcaccess status
-) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
+) | $APCUPSD_MAIL -s "$MSG" "$SYSADMIN"
 exit 0
diff --git a/platforms/etc/onbattery.in b/platforms/etc/onbattery.in
index 48d80b2..290740b 100755
--- a/platforms/etc/onbattery.in
+++ b/platforms/etc/onbattery.in
@@ -5,7 +5,7 @@
 # goes on batteries.
 # We send an email message to root to notify him.
 #
-SYSADMIN=root
+SYSADMIN="root"
 APCUPSD_MAIL="@APCUPSD_MAIL@"
 
 HOSTNAME=`hostname`
@@ -17,5 +17,5 @@ MSG="$HOSTNAME Power Failure !!!"
    echo "$MSG"
    echo " "
    @sbindir@/apcaccess status
-) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
+) | $APCUPSD_MAIL -s "$MSG" "$SYSADMIN"
 exit 0

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Apcupsd-users mailing list
Apcupsd-users@...
https://lists.sourceforge.net/lists/listinfo/apcupsd-users

 « Return to Thread: Please quote SYSADMIN