OpenVAS Libraries  8.0.3
Functions
drop_privileges.c File Reference
#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...
 

Detailed Description

Basic support to drop privileges.

Function Documentation

int drop_privileges ( gchar *  username,
GError **  error 
)

Naive attempt to drop privileges.

We try to drop our (root) privileges and setuid to

Parameters
usernameto minimize the risk of privilege escalation. The current implementation is somewhat linux-specific and may not work on other platforms.
[in]usernameThe user to become. Its safe to pass "NULL", in which case it will default to "nobody".
[out]errorReturn location for errors or NULL if not interested in errors.
Returns
OPENVAS_DROP_PRIVILEGES_OK in case of success. Sets
Parameters
errorotherwise and returns the error code.