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>
<!-- ##### 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>

View 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 ##### -->

View 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.

View 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
}