Parameter expansion stopped working after upgrade of sudo
Issue
After upgrade of sudo from version 1.7.2p1-10 to 1.7.2p1-14.3 the behaviour of parameter expansion has changed. See following reproducer:
user bob has a "~/.profile" containing line
export VARIABLE="This is bob"
user brian has a "~/.profile" containing line
export VARIABLE="This is brian"
User brian has proper permissions to execute apps using sudo as user bob.
With sudo 1.7.2p1-10
brian$ sudo -ui bob "echo $VARIABLE"
This is brian
brian$ sudo -ui bob "echo \$VARIABLE"
This is bob
With sudo 1.7.2p1-14.3
brian$ sudo -ui bob "echo $VARIABLE"
This is brian
brian$ sudo -ui bob "echo \$VARIABLE"
$VARIABLE
Instead of expanding the parameter sudo passes the literal '$VARIABLE' to echo statement.
Environment
Red Hat Enterprise Linux 5.8
sudo 1.7.2p1-10
sudo 1.7.2p1-14.3
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.