From 173977a7015c45e5dc3c43534cd3deb81159ad1f Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Fri, 30 Jul 2010 11:26:43 -0400 Subject: [PATCH] GCredentials: use effective uid/gid Otherwise e.g. setuid root processes can't connect to the system bus. This was discovered when porting PolicyKit's pkexec(1) command to a PolicyKit library using GDBus. Signed-off-by: David Zeuthen --- docs/reference/glib/tmpl/glib-unused.sgml | 40 ++++++++++++++++++++++ docs/reference/glib/tmpl/messages.sgml | 27 ++++----------- docs/reference/glib/tmpl/version.sgml | 41 ----------------------- gio/gcredentials.c | 4 +-- 4 files changed, 48 insertions(+), 64 deletions(-) diff --git a/docs/reference/glib/tmpl/glib-unused.sgml b/docs/reference/glib/tmpl/glib-unused.sgml index 7b5718952..3d551f7eb 100644 --- a/docs/reference/glib/tmpl/glib-unused.sgml +++ b/docs/reference/glib/tmpl/glib-unused.sgml @@ -937,6 +937,46 @@ Turns the argument into a string literal by using the '#' stringizing operator. + + + + + + + + + + + +@required_major: +@required_minor: +@required_micro: +@Returns: + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/reference/glib/tmpl/messages.sgml b/docs/reference/glib/tmpl/messages.sgml index 245a775ee..2c4e8d86d 100644 --- a/docs/reference/glib/tmpl/messages.sgml +++ b/docs/reference/glib/tmpl/messages.sgml @@ -117,18 +117,15 @@ documentation. @args: the parameters to insert into the format string. - + A convenience function/macro to log a normal message. -@format: -@Varargs: - @...: format string, followed by parameters to insert into the format string (as with printf()) - + A convenience function/macro to log a warning message. @@ -138,13 +135,10 @@ You can make warnings fatal at runtime by setting the %G_DEBUG environment variable (see Running GLib Applications). -@format: -@Varargs: - @...: format string, followed by parameters to insert into the format string (as with printf()) - + Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL). It's more or less application-defined what constitutes a critical vs. a regular @@ -159,13 +153,10 @@ the %G_DEBUG environment variable (see Running GLib Applications). -@format: -@Varargs: - @...: format string, followed by parameters to insert into the format string (as with printf()) - + A convenience function/macro to log an error message. Error messages are always fatal, resulting in a call to @@ -175,22 +166,16 @@ expect. Using this function indicates a bug in your program, i.e. an assertion failure. -@format: -@Varargs: - @...: format string, followed by parameters to insert into the format string (as with printf()) - + A convenience function/macro to log a debug message. -@format: -@Varargs: -@Since: 2.6 - @...: format string, followed by parameters to insert into the format string (as with printf()) +@Since: 2.6 diff --git a/docs/reference/glib/tmpl/version.sgml b/docs/reference/glib/tmpl/version.sgml index 027a0f456..dca4ac9c6 100644 --- a/docs/reference/glib/tmpl/version.sgml +++ b/docs/reference/glib/tmpl/version.sgml @@ -22,47 +22,6 @@ typically use the features described here. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@required_major: -@required_minor: -@required_micro: -@Returns: - - The major version number of the GLib library. diff --git a/gio/gcredentials.c b/gio/gcredentials.c index e79901f2a..a9c2b5a98 100644 --- a/gio/gcredentials.c +++ b/gio/gcredentials.c @@ -118,8 +118,8 @@ g_credentials_init (GCredentials *credentials) { #ifdef __linux__ credentials->native.pid = getpid (); - credentials->native.uid = getuid (); - credentials->native.gid = getgid (); + credentials->native.uid = geteuid (); + credentials->native.gid = getegid (); #endif }