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 <davidz@redhat.com>
This commit is contained in:
David Zeuthen 2010-07-30 11:26:43 -04:00
parent f9845bcbec
commit 173977a701
4 changed files with 48 additions and 64 deletions

View File

@ -937,6 +937,46 @@ Turns the argument into a string literal by using the '#' stringizing operator.
</para> </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 ##### --> <!-- ##### MACRO lseek ##### -->
<para> <para>

View File

@ -117,18 +117,15 @@ documentation.
@args: the parameters to insert into the format string. @args: the parameters to insert into the format string.
<!-- ##### FUNCTION g_message ##### --> <!-- ##### MACRO g_message ##### -->
<para> <para>
A convenience function/macro to log a normal message. A convenience function/macro to log a normal message.
</para> </para>
@format:
@Varargs:
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf()) @...: format string, followed by parameters to insert into the format string (as with printf())
<!-- ##### FUNCTION g_warning ##### --> <!-- ##### MACRO g_warning ##### -->
<para> <para>
A convenience function/macro to log a warning message. A convenience function/macro to log a warning message.
</para> </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>). variable (see <ulink url="glib-running.html">Running GLib Applications</ulink>).
</para> </para>
@format:
@Varargs:
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf()) @...: format string, followed by parameters to insert into the format string (as with printf())
<!-- ##### FUNCTION g_critical ##### --> <!-- ##### MACRO g_critical ##### -->
<para> <para>
Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL). It's more or less Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL). It's more or less
application-defined what constitutes a critical vs. a regular 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>). <ulink url="glib-running.html">Running GLib Applications</ulink>).
</para> </para>
@format:
@Varargs:
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf()) @...: format string, followed by parameters to insert into the format string (as with printf())
<!-- ##### FUNCTION g_error ##### --> <!-- ##### MACRO g_error ##### -->
<para> <para>
A convenience function/macro to log an error message. A convenience function/macro to log an error message.
Error messages are always fatal, resulting in a call to 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. assertion failure.
</para> </para>
@format:
@Varargs:
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf()) @...: format string, followed by parameters to insert into the format string (as with printf())
<!-- ##### FUNCTION g_debug ##### --> <!-- ##### MACRO g_debug ##### -->
<para> <para>
A convenience function/macro to log a debug message. A convenience function/macro to log a debug message.
</para> </para>
@format:
@Varargs:
@Since: 2.6
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf()) @...: format string, followed by parameters to insert into the format string (as with printf())
@Since: 2.6
<!-- ##### FUNCTION g_log_set_handler ##### --> <!-- ##### FUNCTION g_log_set_handler ##### -->

View File

@ -22,47 +22,6 @@ typically use the features described here.
<!-- ##### SECTION Image ##### --> <!-- ##### 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 ##### --> <!-- ##### MACRO GLIB_MAJOR_VERSION ##### -->
<para> <para>
The major version number of the GLib library. The major version number of the GLib library.

View File

@ -118,8 +118,8 @@ g_credentials_init (GCredentials *credentials)
{ {
#ifdef __linux__ #ifdef __linux__
credentials->native.pid = getpid (); credentials->native.pid = getpid ();
credentials->native.uid = getuid (); credentials->native.uid = geteuid ();
credentials->native.gid = getgid (); credentials->native.gid = getegid ();
#endif #endif
} }