Rewrite service and state handling to make POSIX compliant and to get
rid of potential eval-related security holes.
diff -U 0 -rNX diffignore pm-utils.updates/pm/functions working/pm/functions
--- pm-utils.updates/pm/functions	2008-01-27 12:50:52.000000000 -0600
+++ working/pm/functions	2008-01-27 11:26:51.000000000 -0600
@@ -230,2 +225 @@
-_service=$(type -p service)
-if [ -z "$_service" ]; then
+if type service |grep -q "not found"; then
@@ -241 +234,0 @@
-unset _service
@@ -245,4 +238,2 @@
-	service "$1" status 2>/dev/null | grep -c -q running
-	if [ "$?" == "0" ]; then
-		N=${1//[-.]/_}
-		echo "export ${N}_SERVICE_ACTIVATE=yes" >> /var/run/pm-suspend
+	if service "$1" status 2>/dev/null | grep -c -q running; then
+		touch "/var/run/pm-suspend/service:$1"
@@ -255,4 +246 @@
-	N=${1//[-.]/_}
-	if [ "x$(eval echo \$${N}_SERVICE_ACTIVATE)" == "xyes" ]; then
-		service "$1" start
-	fi
+	[ -f "/var/run/pm-suspend/service:$1" ] && service "$1" start
@@ -263 +251 @@
-	echo "export ${1}_STATE=$2" >> /var/run/pm-suspend
+	echo "$2" > "/var/run/pm-suspend/state:$1"
@@ -268 +256 @@
-	eval echo \$${1}_STATE
+	cat "/var/run/pm-suspend/state:${1}"
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to