Richard:
On 04/23/10 03:22 AM, Richard L. Hamilton wrote:
su - $USER -c "/usr/bin/audioctl (args)"
Double quotes around $USER, please. And I hope
that the contents of $USER are trustworthy at that point.
Thanks for the suggestion. I just updated the patch we apply so that
there are double-quotes around "$USER". You can see attached for the
latest version of the patch with this change.
The value of $USER is set directly by the per-display GDM slave daemon
before calling the script. The GDM slave daemon manages the username
information in a trustworthy manner.
Brian
--- 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
_______________________________________________
opensolaris-arc mailing list
[email protected]