#743789 menu: su-to-root fails to execute calls with multiple commands in one line

Package:
menu
Source:
menu
Description:
generates programs menu for all menu-aware applications
Submitter:
Ivan Pozderović
Date:
2020-12-12 17:39:05 UTC
Severity:
normal
#743789#5
Date:
2014-04-06 14:21:10 UTC
From:
To:
Hello,

it seems su-to-root wrapper script doesn't handle well calls which use multiple commands.

Scenario where I've discovered this:
After installing system-config-lvm package (1.1.16-1), the utility doesn't run under a non-root user (using standard GNOME 3.4). It tries to run the following command:
su-to-root -X -c "invoke-rc.d lvm2 start ; /usr/share/system-config-lvm/system-config-lvm.py";

It seems that without invoking a shell to handle the two commands only the first will be run under root privilages.

Here's a fix using printf that seems to correct the problem (only for gksu, which is used in wheezy):
@@ -105,3 +105,3 @@
     case $SU_TO_ROOT_X in
-      gksu) gksu -u "$PRIV" "$COMMAND";;
+      gksu) gksu -u "$PRIV" "sh -c $(printf %q "$COMMAND")";;
       gksudo) gksudo -u "$PRIV" "$COMMAND";;

p.s. if this is more of a gksu issue, please forward where necessary

Regards,
Ivan

#743789#10
Date:
2014-04-29 13:33:29 UTC
From:
To:
Hello Ivan,
the issue is not so much the su-to-root script but rather the underlying su engines
which may have different calling convention.

I cannot help but think that using multiple commands in a single su-to-root
invocation is pushing the design too far.

Well, it would be useful to compare the behavior of all the su- variants.

Thanks for using Debian menu!

#743789#15
Date:
2020-12-12 17:37:38 UTC
From:
To:
Pozdrav,
molim vas prihvatite moje isprike. Ne želim zadirati u vašu privatnost,
napisao sam vam raniji e-mail, ali bez odgovora. U prvom sam vam e-mailu
spomenuo svog pokojnog klijenta koji je umro 30. prosinca 2013, od njegove
smrti primio sam nekoliko pisama iz banke kod koje je dao depozit prije
njegove smrti, banka je tražila da mu pružim najbližeg rođaka ili nekoga od
njegove rodbine koji mogu zatražiti njegova sredstva ili će ih banka
zaplijeniti, jer nisam uspio pronaći nijednog od njegov rođak, stoga sam
vas kontaktirao zbog ove tvrdnje, jer imate isto prezime s njim. Nakon
vašeg odgovora dat ću vam detalje i postupke transakcije
Čekam vaš odgovor

Elvis Edorh