2006-02-06 03:11:34 +00:00
|
|
|
/* privileges.h
|
|
|
|
* Declarations of routines for handling privileges.
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2006-02-06 03:11:34 +00:00
|
|
|
* Copyright 2006 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2006-02-06 03:11:34 +00:00
|
|
|
*/
|
|
|
|
|
2010-12-01 18:16:41 +00:00
|
|
|
#ifndef __PRIVILEGES_H__
|
|
|
|
#define __PRIVILEGES_H__
|
|
|
|
|
2013-02-28 14:09:46 +00:00
|
|
|
#include "ws_symbol_export.h"
|
|
|
|
|
2010-12-01 18:25:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2007-08-30 00:24:40 +00:00
|
|
|
/**
|
2010-09-16 19:20:06 +00:00
|
|
|
* Called when the program starts, to enable security features and save
|
|
|
|
* whatever credential information we'll need later.
|
2006-02-06 03:11:34 +00:00
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC void init_process_policies(void);
|
2006-02-06 03:11:34 +00:00
|
|
|
|
2007-08-30 00:24:40 +00:00
|
|
|
/**
|
2007-11-20 16:46:11 +00:00
|
|
|
* Was this program started with special privileges? get_credential_info()
|
|
|
|
* MUST be called before calling this.
|
2007-08-30 00:24:40 +00:00
|
|
|
* @return TRUE if the program was started with special privileges,
|
|
|
|
* FALSE otherwise.
|
2006-02-06 03:11:34 +00:00
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC gboolean started_with_special_privs(void);
|
2006-02-06 10:27:27 +00:00
|
|
|
|
2007-08-30 00:24:40 +00:00
|
|
|
/**
|
2007-11-20 16:46:11 +00:00
|
|
|
* Is this program running with special privileges? get_credential_info()
|
|
|
|
* MUST be called before calling this.
|
2007-08-30 00:24:40 +00:00
|
|
|
* @return TRUE if the program is running with special privileges,
|
|
|
|
* FALSE otherwise.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC gboolean running_with_special_privs(void);
|
2007-08-30 00:24:40 +00:00
|
|
|
|
|
|
|
/**
|
2007-11-20 16:46:11 +00:00
|
|
|
* Permanently relinquish special privileges. get_credential_info()
|
|
|
|
* MUST be called before calling this.
|
2006-02-06 10:27:27 +00:00
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC void relinquish_special_privs_perm(void);
|
2007-08-30 00:24:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current username. String must be g_free()d after use.
|
|
|
|
* @return A freshly g_alloc()ed string containing the username,
|
|
|
|
* or "UNKNOWN" on failure.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC gchar *get_cur_username(void);
|
2007-08-30 00:24:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current group. String must be g_free()d after use.
|
|
|
|
* @return A freshly g_alloc()ed string containing the group,
|
|
|
|
* or "UNKNOWN" on failure.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC gchar *get_cur_groupname(void);
|
2007-08-30 00:24:40 +00:00
|
|
|
|
2010-12-01 18:25:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2010-12-01 18:16:41 +00:00
|
|
|
#endif /* __PRIVILEGES_H__ */
|