After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 438939 - gdmflexiserver doesn't work when run setuid/setgid
gdmflexiserver doesn't work when run setuid/setgid
Product: gdm
Classification: Core
Component: general
Other All
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
: 488858 507750 (view as bug list)
Depends on:
Reported: 2007-05-16 16:54 UTC by Sebastien Bacher
Modified: 2008-01-09 17:59 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20

patch to revert gdmflexiesrver to revision 4812. (24.38 KB, text/plain)
2007-10-23 19:27 UTC, Brian Cameron
patch to fix problem (2.16 KB, patch)
2007-12-10 19:04 UTC, Brian Cameron
none Details | Review

Description Sebastien Bacher 2007-05-16 16:54:35 UTC
With the new 2.19.1 version (updating from 2.18.1) the custom color which was used after login (before having the desktop loaded) is not used, the default blue one is used instead. That happens with a theme not using the new background feature. The default themes with that new feature display the same blue color as well instead of the background specified
Comment 1 Brian Cameron 2007-06-04 04:31:34 UTC
I'm cc:ing Frederic on this bug since he implemented the new background feature.    I'm hoping he might be able to look into this and fix the code so that it continues to work as it did previously when background isn't available in the theme.
Comment 2 Frederic Crozat 2007-06-04 12:17:24 UTC
I've just tested again 2.19.1 with a theme without background property and GraphicalThemedColor is working correctly. 

Comment 3 Brian Cameron 2007-06-05 05:20:06 UTC
Sebastien - any ideas why you are seeing this problem but Frederic is not?  Perhaps the problem is with a distro patch?  Are you using the GraphicalThemedColor configuratin property to set your color to use?  
Comment 4 Daniel Holbach 2007-06-11 15:26:53 UTC
I had to change config/ to make it work for us.
Comment 5 Sebastien Bacher 2007-06-11 19:41:30 UTC
The change has been made to the Default BACKCOLOR value which was not required using 2.18
Comment 6 Brian Cameron 2007-06-18 04:36:04 UTC
Daniel, can you share the change you had to make to to make this work?

Also, Sebastien, I don't really understand how your comment applies to this bug. Do you believe Daniel's problem is expected and what do you think the right way to fix this is?  I suspect the right fix for Daniel isn't to modify PreSession, but perhaps to modify the configuration in another way?  I know that gdmlogin and gdmgreeter use separate keys to control background color.  Perhaps in changing this we modified the code so that it used to default to use the gdmlogin background color if there wasn't a gdmgreeter color specified and this went away or something?
Comment 7 Daniel Holbach 2007-06-18 07:01:50 UTC
diff -Nur gdm-2.19.1/config/
--- gdm-2.19.1/config/     2007-05-14 04:08:25.000000000 +0200
+++ 2007-06-04 18:02:15.000000000 +0200
@@ -62,7 +62,7 @@
        # Default value
        if [ "x$BACKCOLOR" = "x" ]; then
-               BACKCOLOR="#76848F"
+               BACKCOLOR="#dab082"
        "$XSETROOT" -cursor_name left_ptr -solid "$BACKCOLOR"
Comment 8 Brian Cameron 2007-06-18 09:20:23 UTC
This looks a bit odd to me.  Note that before the change you mention, the PreSession does the following logic (if using gdmgreeter).

      BACKCOLOR=`gdmflexiserver --command="GET_CONFIG 
         greeter/GraphicalThemedColor $DISPLAY"`

Could you run the above command and tell me what the gdmflexiserver command
returns?  I'd bet it is not returning the value you want "#dab082".

I'd recommend updating your configuration file so that the 
greeter/GraphicalThemedColor key has the value you want rather than hacking 
PreSession script to change the default value it uses if it couldn't get the 
value via gdmflexiserver.

Comment 9 Sebastien Bacher 2007-06-18 10:15:38 UTC
$ gdmflexiserver --command="GET_CONFIG greeter/GraphicalThemedColor $DISPLAY"
OK #dab082

We do modify the configuration, that doesn't work with 2.19 which is what the bug is about
Comment 10 Brian Cameron 2007-06-18 11:09:57 UTC
This is odd.  Would you mind doing some work debugging the PreSession script?  If  the code change you show above makes a difference, then there must be an odd bug in the way the script is working.  Note the following:

1) The GDM_GREETER_TYPE variable is checked and BACKCOLOR only gets set properly
   if it is equal to THEMED or PLAIN.  Is it possible this is unset?  It should
   be set to THEMED if you are using gdmgreeter.

2) Note sed is used to try and parse the output of gdmflexiserver.  Perhaps
   sed is causing a problem on your platform.  Perhaps verify that the
   if [ x$CHECKBACKCOLOR = xOK" ] test is passing.

In other words, add echo statements to the script and redirect the output to a file like /tmp/gdmtest.out and this way we can get an idea why BACKCOLOR is not being set when the gdmflexiserver GET_CONFIG command is returning a valid value.

If you can track down where the problem is happening, it will be easier to figure out how to approach fixing it. 
Comment 11 Sebastien Bacher 2007-06-18 14:25:12 UTC
The bug seems to be due to:

"(process:24197): Gtk-WARNING **: This process is currently running setuid or setgid.
This is not a supported use of GTK+. You must create a helper
program instead. For further details, see:

Refusing to initialize GTK+." might be the change creating the bug
Comment 12 Sebastien Bacher 2007-06-18 14:28:30 UTC
Reverting make the color being set correctly again
Comment 13 Brian Cameron 2007-06-19 12:08:28 UTC
If you want to provide a patch that fixes the issue in bug #431044 and also fixes this bug, I'd be happy to accept it.  You'll notice all commands that require -a don't work after you revert that bug, which is probably a more serious problem.

For example, try:

   gdmflexiserver -a --command="SET_SAFE_LOGOUT_ACTION REBOOT"

It should be easy to fix.  Just revert the previous fix for #431044 and fix the code so it also calls gtk_init when --command is used and -a is used.  In other words it should not call gtk_init when --command is used and -a is not used.

Unless William has a better idea for a fix.  I'll cc: him since he wrote the original fix for #431044 which created this bug.

Comment 14 Brian Cameron 2007-06-25 09:24:22 UTC
Any update on this?
Comment 15 Brian Cameron 2007-06-27 02:28:53 UTC
William, would you be interested in looking into fixing this, since your patch broke gdmflexiserver?
Comment 16 Sebastien Bacher 2007-09-24 12:51:56 UTC
distribution comment

"First fix was only working when already authenticated (gdmflexiserver): the following fix should work for EVERYONE :-)

Affected File (in gutsy):

Authentication missing

replace every "gdmflexiserver" whith "gdmflexiserver -a"

This could be a problem in other places besides this file also (leading possibly to other bugs).

regards Jürgen"
Comment 17 Marcus Comstedt 2007-10-06 10:37:29 UTC
I tried this fix (add "-a" to all gdmflexiserver calls) in Ubuntu Gutsy, but
it doesn't work.  Excerpt of output from script when running with -x:

+ [ xPLAIN = xTHEMED ]
+ [ xOK != xOK ]
+ [ xPLAIN = xPLAIN ]
+ gdmflexiserver -a --command=GET_CONFIG greeter/BackgroundType :0

(process:6691): Gtk-WARNING **: This process is currently running setuid or setgid.
This is not a supported use of GTK+. You must create a helper
program instead. For further details, see:

Refusing to initialize GTK+.
+ [ x = xOK 1 ]
+ [ x = xOK 2 ]
+ [ x = x ]
+ BACKCOLOR=#dab082
+ /usr/bin/xsetroot -cursor_name left_ptr -solid #dab082
+ exit 0

So this looks like a false lead and a proper fix is needed...
Comment 18 Brian Cameron 2007-10-08 21:52:31 UTC
Let me explain more clearly.

This problem is caused because gdmflexiserver is used for two very different things:

1) For switching VT's, which can pop-up a UI
2) For commands which never pop-up a UI.

We currently call gtk_init now all the time, even though we really don't need
to for case #2.  The code should be fixed so that gtk_init is only called in situation #1.

One hassle for this is that William changed the code so that gtk_init is now used for parsing the options.  As I said before, we probably need to revert to the mechanism of parsing options to the way it was before the code was cleaned up via patch for bug #431044.

Comment 19 jmehdi 2007-10-22 10:55:11 UTC
I'm building a custom Ubuntu distro and want to change the GraphicalThemedColor. I've changed the value in the gdm.conf-custom file but it doesn't work on Gutsy (it works on Feisty). Is it related to this bug? It there a workaround?
Comment 20 Brian Cameron 2007-10-22 16:51:22 UTC
In comment #12, Sebastien points out that backing out a previous change fixes the problem for him.  Does it also fix your problem?  Or does fixing gdmflexiserver as described in comment #18 fix the problem?
Comment 21 jmehdi 2007-10-23 07:55:01 UTC
I don't know how to test comment #12, and adding "-a" to all gdmflexiserver calls doesn't work ; So I've just replaced the default backcolor value in /etc/gdm/PreSession/Default... quite ugly :(
Comment 22 Brian Cameron 2007-10-23 19:27:54 UTC
Created attachment 97747 [details]
patch to revert gdmflexiesrver to revision 4812.

Attached please find the gdmflexiserver.c file that you can use to replace the one in gui/gdmflexiserver.c.

This is the old version that reverts the code to before I think the problem was introduced.  

I believe the problem is that we need to revert back to using the g_option style of parsing the arguments and go back to calling gtk_init only when --command is not used.  Although using GTK+ may be "cleaner", it doesn't work when you want to run the command with setuid/setgid.  

Does using this version fix the problem?  If so, then perhaps someone could provide a patch that would convert the SVN head version of gdmflexiserver to use the old g_option style of parsing the arguments and calling gtk_init only when --command is not used.  I'd prefer to not simply revert back to using this version of gdmflexiserver since we'd lose other fixes to the file.

But it would be useful if you could test this, and this might also provide you with a temporary workaround until this issue is resolved in the 2.20 branch.
Comment 23 Brian Cameron 2007-10-23 19:29:41 UTC
Oops.  I mean "perhaps someone could provide a patch that would convert the 2.20 branch version of gdmflexiserver to use the old g_options style of parsing the arguments and calling gtk_init onloy when --command is not used."

Obviously SVN head is the D-Bus rewrite and doesn't even contain gdmflexiserver at the moment.

Comment 24 Brian Cameron 2007-11-28 16:59:41 UTC
*** Bug 488858 has been marked as a duplicate of this bug. ***
Comment 25 Brian Cameron 2007-12-10 19:04:42 UTC
Created attachment 100709 [details] [review]
patch to fix problem

the attached patch should fix this problem.  This is now fixed in the 2.20 branch.  Using the old g_option_context* functions works better with setuid/setgid than gtk_init* functions even though it might not be so pretty.
Comment 26 Brian Cameron 2008-01-09 17:54:05 UTC
*** Bug 507750 has been marked as a duplicate of this bug. ***