2 * Declarations of routines for handling privileges.
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 2006 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
11 #ifndef __PRIVILEGES_H__
12 #define __PRIVILEGES_H__
14 #include <wireshark.h>
21 * Called when the program starts, to enable security features and save
22 * whatever credential information we'll need later.
24 WS_DLL_PUBLIC
void init_process_policies(void);
27 * Was this program started with special privileges? get_credential_info()
28 * MUST be called before calling this.
29 * @return true if the program was started with special privileges,
32 WS_DLL_PUBLIC
bool started_with_special_privs(void);
35 * Is this program running with special privileges? get_credential_info()
36 * MUST be called before calling this.
37 * @return true if the program is running with special privileges,
40 WS_DLL_PUBLIC
bool running_with_special_privs(void);
43 * Permanently relinquish special privileges. get_credential_info()
44 * MUST be called before calling this.
46 WS_DLL_PUBLIC
void relinquish_special_privs_perm(void);
49 * Get the current username. String must be g_free()d after use.
50 * @return A freshly g_alloc()ed string containing the username,
51 * or "UNKNOWN" on failure.
53 WS_DLL_PUBLIC
char *get_cur_username(void);
56 * Get the current group. String must be g_free()d after use.
57 * @return A freshly g_alloc()ed string containing the group,
58 * or "UNKNOWN" on failure.
60 WS_DLL_PUBLIC
char *get_cur_groupname(void);
64 #endif /* __cplusplus */
66 #endif /* __PRIVILEGES_H__ */