patches/gdm-19-audio-default.diff
author rohinis
Tue, 29 Nov 2011 17:32:55 +0000
branchs11express-2010-11
changeset 22234 c23e64da3e06
parent 18350 282594b54196
permissions -rw-r--r--
2011-11-29 Rohini S <[email protected]> * patches/Python26-22-audio.diff: Fixes CVE-2010-1634 * specs/SUNWPython26.spec: Fixes CR 7085446

--- gdm-2.30.0/data/Xsession.in-orig	2010-04-07 15:12:25.882247407 -0500
+++ gdm-2.30.0/data/Xsession.in	2010-04-07 15:12:57.139892497 -0500
@@ -70,6 +70,30 @@ gdmwhich () {
   echo "$OUTPUT"
 }
 
+# Reload audio settings after sourcing the user's .profile to ensure that any
+# AUDIODEV settings defined by the user are honored.
+#
+AUDIOCTL_SAVE_HOSTNAME=`/usr/bin/hostname`
+AUDIOCTL_SAVE_DEVICE=""
+AUDIOCTL_SAVE_DIR="$HOME/.audioctl"
+AUDIOCTL_DEVICE_OWNER=`/usr/bin/stat -L /dev/audio -c %U`
+
+# Only set audio settings if logindevperm has set the owner of the audio
+# device to this user.
+#
+if test "x$USER" = "x$AUDIOCTL_DEVICE_OWNER" ; then
+  if test -x "/usr/bin/audioctl" ; then
+    AUDIOCTL_SAVE_DEVICE=`/usr/bin/audioctl show-device | /usr/bin/awk '/^ *Name /{ print $3; }'`
+  fi
+
+  if test -n "$AUDIOCTL_SAVE_HOSTNAME" -a -n "$AUDIOCTL_SAVE_DEVICE"; then
+    AUDIOCTL_SAVE_FILE="$AUDIOCTL_SAVE_DIR/audioctl-$AUDIOCTL_SAVE_HOSTNAME-$AUDIOCTL_SAVE_DEVICE"
+    if test -f "$AUDIOCTL_SAVE_FILE" ; then
+      /usr/bin/audioctl load-controls $AUDIOCTL_SAVE_FILE
+    fi
+  fi
+fi
+
 zenity=`gdmwhich zenity`
 
 # Note: ~/.xsession-errors is now done in the daemon so that it
--- gdm-2.30.0/data/PostSession.in-orig	2010-04-07 15:11:36.882431156 -0500
+++ gdm-2.30.0/data/PostSession.in	2010-04-07 15:13:18.268798760 -0500
@@ -1,4 +1,31 @@
 #!/bin/sh
 PATH="@SCRIPT_PATH@"
 
+AUDIOCTL_SAVE_HOSTNAME=`/usr/bin/hostname`
+AUDIOCTL_SAVE_DIR="$HOME/.audioctl"
+AUDIOCTL_SAVE_DEVICE=""
+AUDIOCTL_DEVICE_OWNER=`/usr/bin/stat -L /dev/audio -c %U`
+
+# Only set audio settings if logindevperm has set the owner of the audio device
+# to this user.
+#
+if test "x$USER" = "x$AUDIOCTL_DEVICE_OWNER" ; then
+  if test -x "/usr/bin/audioctl" ; then
+    AUDIOCTL_SAVE_DEVICE=`/usr/bin/audioctl show-device | /usr/bin/awk '/^ *Name /{ print $3; }'`
+  fi
+
+  if test -n "$AUDIOCTL_SAVE_HOSTNAME" -a -n "$AUDIOCTL_SAVE_DEVICE"; then
+    if test ! -d "$AUDIOCTL_SAVE_DIR" ; then
+      /usr/bin/su "$USER" -c "/usr/bin/mkdir $AUDIOCTL_SAVE_DIR"
+      /usr/bin/chmod 700 $AUDIOCTL_SAVE_DIR
+    fi
+
+    if test -d "$AUDIOCTL_SAVE_DIR" ; then
+      AUDIOCTL_SAVE_FILE="$AUDIOCTL_SAVE_DIR/audioctl-$AUDIOCTL_SAVE_HOSTNAME-$AUDIOCTL_SAVE_DEVICE"
+      /usr/bin/su "$USER" -c "/usr/bin/audioctl save-controls -f $AUDIOCTL_SAVE_FILE"
+      /usr/bin/chmod 600 $AUDIOCTL_SAVE_FILE
+    fi
+  fi
+fi
+
 exit 0