Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sudo-project
GitHub Repository: sudo-project/sudo
Path: blob/main/src/preload.c
1532 views
1
/*
2
* SPDX-License-Identifier: ISC
3
*
4
* Copyright (c) 2010, 2011, 2013 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
#include <config.h>
20
21
#ifdef HAVE_GSS_KRB5_CCACHE_NAME
22
# if defined(HAVE_GSSAPI_GSSAPI_KRB5_H)
23
# include <gssapi/gssapi.h>
24
# include <gssapi/gssapi_krb5.h>
25
# elif defined(HAVE_GSSAPI_GSSAPI_H)
26
# include <gssapi/gssapi.h>
27
# else
28
# include <gssapi.h>
29
# endif
30
#endif
31
32
#include <sudo.h>
33
#include <sudo_dso.h>
34
#include <sudo_plugin.h>
35
36
#ifdef STATIC_SUDOERS_PLUGIN
37
38
extern struct policy_plugin sudoers_policy;
39
extern struct io_plugin sudoers_io;
40
extern struct audit_plugin sudoers_audit;
41
42
static struct sudo_preload_symbol sudo_rtld_default_symbols[] = {
43
# ifdef HAVE_GSS_KRB5_CCACHE_NAME
44
{ "gss_krb5_ccache_name", (void *)&gss_krb5_ccache_name},
45
# endif
46
{ (const char *)0, (void *)0 }
47
};
48
49
/* XXX - can we autogenerate these? */
50
static struct sudo_preload_symbol sudo_sudoers_plugin_symbols[] = {
51
{ "sudoers_policy", (void *)&sudoers_policy },
52
{ "sudoers_io", (void *)&sudoers_io },
53
{ "sudoers_audit", (void *)&sudoers_audit },
54
{ (const char *)0, (void *)0 }
55
};
56
57
/*
58
* Statically compiled symbols indexed by handle.
59
*/
60
static struct sudo_preload_table sudo_preload_table[] = {
61
{ (char *)0, SUDO_DSO_DEFAULT, sudo_rtld_default_symbols },
62
{ _PATH_SUDOERS_PLUGIN, &sudo_sudoers_plugin_symbols, sudo_sudoers_plugin_symbols },
63
{ (char *)0, (void *)0, (struct sudo_preload_symbol *)0 }
64
};
65
66
void
67
preload_static_symbols(void)
68
{
69
sudo_dso_preload_table(sudo_preload_table);
70
}
71
72
#endif /* STATIC_SUDOERS_PLUGIN */
73
74