OpenVAS Libraries
8.0.3
|
#include "drop_privileges.h"
#include <pwd.h>
#include <unistd.h>
#include <sys/types.h>
#include <grp.h>
Functions | |
int | drop_privileges (gchar *username, GError **error) |
Naive attempt to drop privileges. More... | |
Basic support to drop privileges.
int drop_privileges | ( | gchar * | username, |
GError ** | error | ||
) |
Naive attempt to drop privileges.
We try to drop our (root) privileges and setuid to
username | to minimize the risk of privilege escalation. The current implementation is somewhat linux-specific and may not work on other platforms. | |
[in] | username | The user to become. Its safe to pass "NULL", in which case it will default to "nobody". |
[out] | error | Return location for errors or NULL if not interested in errors. |
error | otherwise and returns the error code. |