File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / sudo / src / preload.c
Revision 1.1.1.4 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jun 15 16:12:55 2014 UTC (10 years, 1 month ago) by misho
Branches: sudo, MAIN
CVS tags: v1_8_10p3_0, v1_8_10p3, HEAD
sudo v 1.8.10p3

    1: /*
    2:  * Copyright (c) 2010, 2011, 2013 Todd C. Miller <Todd.Miller@courtesan.com>
    3:  *
    4:  * Permission to use, copy, modify, and distribute this software for any
    5:  * purpose with or without fee is hereby granted, provided that the above
    6:  * copyright notice and this permission notice appear in all copies.
    7:  *
    8:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    9:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   10:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   11:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   12:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   13:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   14:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   15:  */
   16: 
   17: #include <config.h>
   18: 
   19: #ifdef HAVE_GSS_KRB5_CCACHE_NAME
   20: # if defined(HAVE_GSSAPI_GSSAPI_KRB5_H)
   21: #  include <gssapi/gssapi.h>
   22: #  include <gssapi/gssapi_krb5.h>
   23: # elif defined(HAVE_GSSAPI_GSSAPI_H)
   24: #  include <gssapi/gssapi.h>
   25: # else
   26: #  include <gssapi.h>
   27: # endif
   28: #endif
   29: 
   30: #include "sudo_plugin.h"
   31: #include "sudo_dso.h"
   32: 
   33: #ifdef STATIC_SUDOERS_PLUGIN
   34: 
   35: extern struct policy_plugin sudoers_policy;
   36: extern struct io_plugin sudoers_io;
   37: 
   38: static struct sudo_preload_symbol sudo_rtld_default_symbols[] = {
   39: # ifdef HAVE_GSS_KRB5_CCACHE_NAME
   40:     { "gss_krb5_ccache_name", (void *)&gss_krb5_ccache_name},
   41: # endif
   42:     { (const char *)0, (void *)0 }
   43: };
   44: 
   45: /* XXX - can we autogenerate these? */
   46: static struct sudo_preload_symbol sudo_sudoers_plugin_symbols[] = {
   47:     { "sudoers_policy", (void *)&sudoers_policy},
   48:     { "sudoers_io", (void *)&sudoers_io},
   49:     { (const char *)0, (void *)0 }
   50: };
   51: 
   52: /*
   53:  * Statically compiled symbols indexed by handle.
   54:  */
   55: static struct sudo_preload_table sudo_preload_table[] = {
   56:     { (char *)0, SUDO_DSO_DEFAULT, sudo_rtld_default_symbols },
   57:     { "sudoers.so", &sudo_sudoers_plugin_symbols, sudo_sudoers_plugin_symbols },
   58:     { (char *)0, (void *)0, (struct sudo_preload_symbol *)0 }
   59: };
   60: 
   61: void
   62: preload_static_symbols(void)
   63: {
   64:     sudo_dso_preload_table(sudo_preload_table);
   65: }
   66: 
   67: #endif /* STATIC_SUDOERS_PLUGIN */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>