/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*
* Copyright 2006, 2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*
*/
/*
*/
#include "k5-plugin.h"
#if USE_DLOPEN
#include <dlfcn.h>
#endif
#include <stdio.h>
#ifdef HAVE_SYS_STAT_H
#endif
#ifdef HAVE_SYS_PARAM_H
#endif
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "k5-platform.h"
#if USE_DLOPEN && USE_CFBUNDLE
#include <CoreFoundation/CoreFoundation.h>
/* Currently CoreFoundation only exists on the Mac so we just use
* pthreads directly to avoid creating empty function calls on other
* platforms. If a thread initializer ever gets created in the common
* plugin code, move this there */
#endif
#include <stdarg.h>
{
#ifdef DEBUG
#endif
}
struct plugin_file_handle {
#if USE_DLOPEN
void *dlhandle;
#endif
#ifdef _WIN32
#endif
#if !defined (USE_DLOPEN) && !defined (_WIN32)
char dummy;
#endif
};
#ifdef _WIN32
struct dirent {
};
typedef struct {
} DIR;
{
char *filespec;
long handle;
int index;
else {
return NULL;
}
}
return dp;
}
{
return NULL;
}
}
}
{
if (!dp) return 0;
return 0;
}
#endif
long KRB5_CALLCONV
{
long err = 0;
int got_plugin = 0;
if (!err) {
}
}
if (!err) {
}
#if USE_DLOPEN
#if USE_CFBUNDLE
#endif /* USE_CFBUNDLE */
)) {
#if USE_CFBUNDLE
int lock_err = 0;
/* Lock around CoreFoundation calls since objects are refcounted
* and the refcounts are not thread-safe. Using pthreads directly
* because this code is Mac-specific */
if (!err) {
}
if (!err) {
true);
}
if (!err) {
}
if (!err) {
}
if (!err) {
true, /* absolute */
(UInt8 *)executablepath,
sizeof (executablepath))) {
}
}
if (!err) {
/* override the path the caller passed in */
}
/* unlock after CFRelease calls since they modify refcounts */
}
#endif /* USE_CFBUNDLE */
#ifdef RTLD_GROUP
#else
#endif
if (!err) {
const char *e = dlerror();
if (e == NULL)
e = "unknown failure";
}
}
if (!err) {
got_plugin = 1;
}
}
#endif /* USE_DLOPEN */
#ifdef _WIN32
}
if (!err) {
got_plugin = 1;
}
}
#endif
if (!err && !got_plugin) {
}
if (!err) {
*h = htmp;
}
return err;
}
static long
{
long err = 0;
#if USE_DLOPEN
/* XXX Do we need to add a leading "_" to the symbol name on any
modern platforms? */
const char *e = dlerror (); /* XXX copy and save away */
if (e == NULL)
e = "unknown failure";
}
}
#endif
#ifdef _WIN32
const char *e = "unable to get dll symbol"; /* XXX copy and save away */
dw = GetLastError();
NULL,
dw,
0, NULL )) {
}
}
}
#endif
}
if (!err) {
}
return err;
}
long KRB5_CALLCONV
{
}
long KRB5_CALLCONV
{
if (!err) {
/* Cast function pointers to avoid code duplication */
}
return err;
}
void KRB5_CALLCONV
{
#if USE_DLOPEN
#endif
#ifdef _WIN32
#endif
free (h);
}
/* autoconf docs suggest using this preference order */
#if HAVE_DIRENT_H || USE_DIRENT_H
#include <dirent.h>
#else
#ifndef _WIN32
#else
#endif
#if HAVE_SYS_NDIR_H
# include <ndir.h>
#endif
#endif
#ifdef HAVE_STRERROR_R
#else
#endif
static long
{
long err = 0;
return err;
}
static long
struct plugin_file_handle *p)
{
long err = 0;
} else {
}
return err;
}
static void
{
int i;
krb5int_close_plugin (harray[i]);
}
}
}
#if TARGET_OS_MAC
#else
#endif
static void
{
int i;
}
}
}
static long
{
long err = 0;
size_t i;
if (!err) {
for (i = 0; filebases[i]; i++) { bases_count++; }
for (i = 0; fileexts[i]; i++) { exts_count++; }
}
if (!err) {
size_t j;
}
}
}
}
if (!err) {
}
return err;
}
/* Takes a NULL-terminated list of directories. If filebases is NULL, filebases is ignored
* all plugins in the directories are loaded. If filebases is a NULL-terminated array of names,
* only plugins in the directories with those name (plus any platform extension) are loaded. */
long KRB5_CALLCONV
const char * const *filebases,
struct plugin_dir_handle *dirhandle,
{
long err = 0;
struct plugin_file_handle **h = NULL;
int i;
if (!err) {
}
}
/* load plugins with names from filenames from each directory */
int j;
if (!err) {
}
}
}
}
} else {
/* load all plugins in each directory */
int len;
if (d == NULL) { break; }
continue;
}
/* Solaris Kerberos: Only open files with a .so extension */
continue;
if (!err) {
}
}
if (!err) {
}
}
}
}
}
err = 0; /* ran out of plugins -- do nothing */
}
if (!err) {
h = NULL; /* dirhandle->files takes ownership */
}
if (h != NULL) { krb5int_plugin_file_handle_array_free (h); }
return err;
}
void KRB5_CALLCONV
{
int i;
}
}
}
void KRB5_CALLCONV
{
/* Nothing special to be done per pointer. */
}
long KRB5_CALLCONV
const char *symname,
void ***ptrs,
{
long err = 0;
void **p = NULL;
/* XXX Do we need to add a leading "_" to the symbol name on any
modern platforms? */
if (!err) {
}
int i = 0;
count++;
} else {
p = newp;
}
}
}
}
if (!err) {
*ptrs = p;
p = NULL; /* ptrs takes ownership */
}
return err;
}
void KRB5_CALLCONV
{
/* Nothing special to be done per pointer. */
}
long KRB5_CALLCONV
const char *symname,
void (***ptrs)(void),
{
long err = 0;
void (**p)() = NULL;
/* XXX Do we need to add a leading "_" to the symbol name on any
modern platforms? */
if (!err) {
}
int i = 0;
count++;
} else {
p = newp;
}
}
}
}
if (!err) {
*ptrs = p;
p = NULL; /* ptrs takes ownership */
}
return err;
}