GCredentials: use effective uid/gid
authorDavid Zeuthen <davidz@redhat.com>
Fri, 30 Jul 2010 15:26:43 +0000 (11:26 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 30 Jul 2010 15:26:43 +0000 (11:26 -0400)
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 <davidz@redhat.com>
docs/reference/glib/tmpl/glib-unused.sgml
docs/reference/glib/tmpl/messages.sgml
docs/reference/glib/tmpl/version.sgml
gio/gcredentials.c

index 7b57189..3d551f7 100644 (file)
@@ -937,6 +937,46 @@ Turns the argument into a string literal by using the '#' stringizing operator.
 </para>
 
 
+<!-- ##### VARIABLE glib_binary_age ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION glib_check_version ##### -->
+<para>
+
+</para>
+
+@required_major: 
+@required_minor: 
+@required_micro: 
+@Returns: 
+
+<!-- ##### VARIABLE glib_interface_age ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE glib_major_version ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE glib_micro_version ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE glib_minor_version ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### MACRO lseek ##### -->
 <para>
 
index 245a775..2c4e8d8 100644 (file)
@@ -117,18 +117,15 @@ documentation.
 @args: the parameters to insert into the format string.
 
 
-<!-- ##### FUNCTION g_message ##### -->
+<!-- ##### MACRO g_message ##### -->
 <para>
 A convenience function/macro to log a normal message.
 </para>
 
-@format: 
-@Varargs: 
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### FUNCTION g_warning ##### -->
+<!-- ##### MACRO g_warning ##### -->
 <para>
 A convenience function/macro to log a warning message.
 </para>
@@ -138,13 +135,10 @@ You can make warnings fatal at runtime by setting the %G_DEBUG environment
 variable (see <ulink url="glib-running.html">Running GLib Applications</ulink>).
 </para>
 
-@format: 
-@Varargs: 
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### FUNCTION g_critical ##### -->
+<!-- ##### MACRO g_critical ##### -->
 <para>
 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
 <ulink url="glib-running.html">Running GLib Applications</ulink>).
 </para>
 
-@format: 
-@Varargs: 
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### FUNCTION g_error ##### -->
+<!-- ##### MACRO g_error ##### -->
 <para>
 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.
 </para>
 
-@format: 
-@Varargs: 
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### FUNCTION g_debug ##### -->
+<!-- ##### MACRO g_debug ##### -->
 <para>
 A convenience function/macro to log a debug message.
 </para>
 
-@format: 
-@Varargs: 
-@Since: 2.6
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
+@Since: 2.6
 
 
 <!-- ##### FUNCTION g_log_set_handler ##### -->
index 027a0f4..dca4ac9 100644 (file)
@@ -22,47 +22,6 @@ typically use the features described here.
 <!-- ##### SECTION Image ##### -->
 
 
-<!-- ##### VARIABLE glib_major_version ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### VARIABLE glib_minor_version ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### VARIABLE glib_micro_version ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### VARIABLE glib_binary_age ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### VARIABLE glib_interface_age ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### FUNCTION glib_check_version ##### -->
-<para>
-
-</para>
-
-@required_major: 
-@required_minor: 
-@required_micro: 
-@Returns: 
-
-
 <!-- ##### MACRO GLIB_MAJOR_VERSION ##### -->
 <para>
 The major version number of the GLib library.
index e79901f..a9c2b5a 100644 (file)
@@ -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
 }