bugGKSu - Bugs: bug #40023, command is not escaped when...

 
 

bug #40023: command is not escaped when run_mode is not SUDO_MODE

Submitted by:  Andrea Corbellini <candrea>
Submitted on:  Fri 13 Sep 2013 06:46:01 PM UTC  
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 13 Sep 2013 07:09:58 PM UTC, comment #1: 

With further investigation I think I got it.

The commands I've posted are wrong. The right ones are:

gksu -- echo 'foo\ bar'
gksu --sudo-mode -- echo 'foo\ bar'

But this only happens with "/apps/gksu/sudo-mode true".

That's because gksu without arguments does not escape the command (run_mode is set to DEFAULT_MODE), but with "/apps/gksu/sudo-mode true" libgksu defaults to the sudo fuller.

Andrea Corbellini <candrea>
Fri 13 Sep 2013 06:46:01 PM UTC, original submission:  

Originally reported at: https://launchpad.net/bugs/1186676

As the downstream bug says, compare the output of these two commands:

   $ gksu --su-mode   -- echo 'foo\ bar'
   foo\ bar
   $ gksu --sudo-mode -- echo 'foo\ bar'
   foo bar

Looking at the source code of gksu, it seems that this difference in behavior is by design:

    // in sudo mode, check for ' and \ in string and escape it
    if(run_mode == SUDO_MODE &&
       (strchr(newargv[i],'\'') || strchr(newargv[i],'\\')))

So the possibilities I see are two:

1. either this is really by design;
2. or that code relies on old libgksu behavior.

If it is the first case, then this particular difference should be properly documented.

Andrea Corbellini <candrea>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by candrea (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.5