VirtualBox

Ignore:
Timestamp:
Feb 26, 2024 4:30:42 PM (9 months ago)
Author:
vboxsync
Message:

Linux host: Prevent VBox.sh from deleting VBoxSVC IPC socket which belongs to other user, bugref:10377, ticketref:20928.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/VBox.sh

    r98103 r103575  
    9797fi
    9898
    99 SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
     99# Get effective user name to use it in order to compose XPCOM IPC socket path.
     100VBOX_EFFECTIVE_USER="$(whoami)"
     101if [ -z "$VBOX_EFFECTIVE_USER" ]; then
     102    cat << EOF
     103WARNING: Unable to detect effective user name. VirtualBox might run incorrectly.
     104EOF
     105fi
     106
     107# Variables LOGNAME and USER are used by XPCOM code in order to
     108# compose IPC socket path. If they set to something which is different
     109# from the effective user name, it might result in misbehavior.
     110# Setting VBOX_IPC_SOCKETID will tell XPCOM code which path it should use explicitly.
     111[ -n "$LOGNAME" ] && [ "$LOGNAME" = "$VBOX_EFFECTIVE_USER" ] || vbox_override_env="1"
     112[ -n "$USER"    ] && [ "$USER"    = "$VBOX_EFFECTIVE_USER" ] || vbox_override_env="1"
     113
     114if [ -n "$vbox_override_env" ]; then
     115cat << EOF
     116WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.
     117EOF
     118    export VBOX_IPC_SOCKETID="$VBOX_EFFECTIVE_USER"
     119fi
     120
     121SERVER_PID=`ps -U "$VBOX_EFFECTIVE_USER" | grep VBoxSVC | awk '{ print $1 }'`
    100122if [ -z "$SERVER_PID" ]; then
    101123    # Server not running yet/anymore, cleanup socket path.
    102124    # See IPC_GetDefaultSocketPath()!
    103     if [ -n "$LOGNAME" ]; then
    104         rm -rf /tmp/.vbox-$LOGNAME-ipc > /dev/null 2>&1
    105     else
    106         rm -rf /tmp/.vbox-$USER-ipc > /dev/null 2>&1
    107     fi
     125    rm -rf "/tmp/.vbox-$VBOX_EFFECTIVE_USER-ipc" > /dev/null 2>&1
    108126fi
    109127
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette