Back to index

lightdm  1.3.2
Functions
privileges.h File Reference
#include "accounts.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void privileges_drop (User *user)
void privileges_reclaim (void)

Function Documentation

void privileges_drop ( User user)

Definition at line 19 of file privileges.c.

{
    g_return_if_fail (user != NULL);

    g_debug ("Dropping privileges to uid %i", user_get_uid (user));
#ifdef HAVE_SETRESGID
    g_debug ("Calling setresgid");
    g_assert (setresgid (user_get_gid (user), user_get_gid (user), -1) == 0);
#else
    g_assert (setgid (user_get_gid (user)) == 0);
    g_assert (setegid (user_get_gid (user)) == 0);
#endif
#ifdef HAVE_SETRESUID
    g_debug ("Calling setresuid");
    g_assert (setresuid (user_get_uid (user), user_get_uid (user), -1) == 0);
#else
    g_assert (setuid (user_get_uid (user)) == 0);
    g_assert (seteuid (user_get_uid (user)) == 0);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void privileges_reclaim ( void  )

Definition at line 41 of file privileges.c.

{
    g_debug ("Restoring privileges");
#ifdef HAVE_SETRESUID
    g_debug ("Calling setresuid");
    g_assert (setresuid (0, 0, -1) == 0);
#else
    g_assert (setuid (0) == 0);
    g_assert (seteuid (0) == 0);
#endif
#ifdef HAVE_SETRESGID
    g_debug ("Calling setresgid");
    g_assert (setresgid (0, 0, -1) == 0);
#else
    g_assert (setgid (0) == 0);
    g_assert (setegid (0) == 0);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function: