Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sudo-project
GitHub Repository: sudo-project/sudo
Path: blob/main/include/sudo_conf.h
1532 views
1
/*
2
* SPDX-License-Identifier: ISC
3
*
4
* Copyright (c) 2011-2017, 2019-2021 Todd C. Miller <[email protected]>
5
*
6
* Permission to use, copy, modify, and distribute this software for any
7
* purpose with or without fee is hereby granted, provided that the above
8
* copyright notice and this permission notice appear in all copies.
9
*
10
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
19
#ifndef SUDO_CONF_H
20
#define SUDO_CONF_H
21
22
#ifdef HAVE_STDBOOL_H
23
# include <stdbool.h>
24
#else
25
# include <compat/stdbool.h>
26
#endif
27
28
#include <sudo_queue.h>
29
30
/* Flags for sudo_conf_read() */
31
#define SUDO_CONF_DEBUG 0x01
32
#define SUDO_CONF_PATHS 0x02
33
#define SUDO_CONF_PLUGINS 0x04
34
#define SUDO_CONF_SETTINGS 0x08
35
#define SUDO_CONF_ALL 0x0f
36
37
/* Values of sudo_conf_group_source() */
38
#define GROUP_SOURCE_ADAPTIVE 0
39
#define GROUP_SOURCE_STATIC 1
40
#define GROUP_SOURCE_DYNAMIC 2
41
42
struct sudo_debug_file;
43
TAILQ_HEAD(sudo_conf_debug_file_list, sudo_debug_file);
44
45
struct plugin_info {
46
TAILQ_ENTRY(plugin_info) entries;
47
char *path;
48
char *symbol_name;
49
char **options;
50
unsigned int lineno;
51
};
52
TAILQ_HEAD(plugin_info_list, plugin_info);
53
54
struct sudo_conf_debug {
55
TAILQ_ENTRY(sudo_conf_debug) entries;
56
struct sudo_conf_debug_file_list debug_files;
57
char *progname;
58
};
59
TAILQ_HEAD(sudo_conf_debug_list, sudo_conf_debug);
60
61
/* Read main sudo.conf file. */
62
sudo_dso_public int sudo_conf_read_v1(const char *conf_file, int conf_types);
63
#define sudo_conf_read(_a, _b) sudo_conf_read_v1((_a), (_b))
64
65
/* Accessor functions. */
66
sudo_dso_public const char *sudo_conf_askpass_path_v1(void);
67
sudo_dso_public const char *sudo_conf_sesh_path_v1(void);
68
sudo_dso_public const char *sudo_conf_intercept_path_v1(void);
69
sudo_dso_public const char *sudo_conf_noexec_path_v1(void);
70
sudo_dso_public const char *sudo_conf_plugin_dir_path_v1(void);
71
sudo_dso_public const char *sudo_conf_devsearch_path_v1(void);
72
sudo_dso_public struct sudo_conf_debug_list *sudo_conf_debugging_v1(void);
73
sudo_dso_public struct sudo_conf_debug_file_list *sudo_conf_debug_files_v1(const char *progname);
74
sudo_dso_public struct plugin_info_list *sudo_conf_plugins_v1(void);
75
sudo_dso_public bool sudo_conf_disable_coredump_v1(void);
76
sudo_dso_public bool sudo_conf_developer_mode_v1(void);
77
sudo_dso_public bool sudo_conf_probe_interfaces_v1(void);
78
sudo_dso_public int sudo_conf_group_source_v1(void);
79
sudo_dso_public int sudo_conf_max_groups_v1(void);
80
sudo_dso_public void sudo_conf_clear_paths_v1(void);
81
#define sudo_conf_askpass_path() sudo_conf_askpass_path_v1()
82
#define sudo_conf_sesh_path() sudo_conf_sesh_path_v1()
83
#define sudo_conf_intercept_path() sudo_conf_intercept_path_v1()
84
#define sudo_conf_noexec_path() sudo_conf_noexec_path_v1()
85
#define sudo_conf_plugin_dir_path() sudo_conf_plugin_dir_path_v1()
86
#define sudo_conf_devsearch_path() sudo_conf_devsearch_path_v1()
87
#define sudo_conf_debugging() sudo_conf_debugging_v1()
88
#define sudo_conf_debug_files(_a) sudo_conf_debug_files_v1((_a))
89
#define sudo_conf_plugins() sudo_conf_plugins_v1()
90
#define sudo_conf_disable_coredump() sudo_conf_disable_coredump_v1()
91
#define sudo_conf_developer_mode() sudo_conf_developer_mode_v1()
92
#define sudo_conf_probe_interfaces() sudo_conf_probe_interfaces_v1()
93
#define sudo_conf_group_source() sudo_conf_group_source_v1()
94
#define sudo_conf_max_groups() sudo_conf_max_groups_v1()
95
#define sudo_conf_clear_paths() sudo_conf_clear_paths_v1()
96
97
#endif /* SUDO_CONF_H */
98
99