OpenVAS Libraries  4.0+rc3.SVN
base/drop_privileges.h
00001 /* openvas-libraries/base
00002  * $Id$
00003  * Description: Privilege dropping header file.
00004  *
00005  * Authors:
00006  * Felix Wolfsteller <felix.wolfsteller@intevation.de>
00007  * based on work by Michael Wiegand <michael.wiegand@intevation.de>
00008  *
00009  * Copyright:
00010  * Copyright (C) 2010 Greenbone Networks GmbH
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License version 2,
00014  * or, at your option, any later version as published by the Free
00015  * Software Foundation
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
00025  */
00026 
00027 #ifndef _OPENVAS_LIBRARIES_BASE_DROP_PRIVILEGES_H
00028 #define _OPENVAS_LIBRARIES_BASE_DROP_PRIVILEGES_H
00029 
00030 #include <glib.h>
00031 
00035 #define OPENVAS_DROP_PRIVILEGES g_quark_from_static_string ("openvas-drop-privileges-error-quark")
00036 
00037 /* Definitions of the return codes. */
00038 #define OPENVAS_DROP_PRIVILEGES_ERROR_ALREADY_SET -1
00039 
00040 #define OPENVAS_DROP_PRIVILEGES_OK 0
00041 #define OPENVAS_DROP_PRIVILEGES_FAIL_NOT_ROOT 1
00042 #define OPENVAS_DROP_PRIVILEGES_FAIL_UNKNOWN_USER 2
00043 #define OPENVAS_DROP_PRIVILEGES_FAIL_DROP_GID 3
00044 #define OPENVAS_DROP_PRIVILEGES_FAIL_DROP_UID 4
00045 
00046 int drop_privileges (gchar * username, GError ** error);
00047 
00048 #endif