/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* Copyright (c) 2004-2005, Novell, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* * The copyright holder's name is not used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* */
#ifndef _KDB_LDAP_H
/* We want the interfaces marked "deprecated" in OpenLDAP. */
#include <ldap.h>
/* Check for acceptable versions.
OpenLDAP version 2.2.6 is known to have some kind of problem that
is tickled by the use of multiple handles in this code. Version
2.2.19 in Mac OS 10.4.7 seems to be buggy as well. Version 2.2.24
doesn't have this problem. Other in-between versions have not been
tested. */
#ifndef BUILD_WITH_BROKEN_LDAP
# if defined(LDAP_API_FEATURE_X_OPENLDAP)
# if LDAP_VENDOR_VERSION < 20224
# endif
# endif
#endif /* BUILD_WITH_BROKEN_LDAP */
#include <k5-thread.h>
#include <k5-platform.h> /* Solaris Kerberos */
#include <k5-platform-store_16.h>
#include <k5-platform-store_32.h>
#include <k5-platform-load_16.h>
#include <k5-platform-load_32.h>
#include <kdb5.h>
#include "k5-int.h"
#include "ldap_krbcontainer.h"
#include "ldap_realm.h"
/* Solaris Kerberos: need this define to get around sccs keyword expansion */
#ifdef HAVE_EDIRECTORY
#endif
#if !defined(LDAP_OPT_RESULT_CODE) && defined(LDAP_OPT_ERROR_NUMBER)
#endif
#define IGNORE_STATUS 0
return EINVAL; \
} \
return KRB5_KDB_DBNOTINITED;
if (st != 0) { \
st = KRB5_KDB_ACCESS_ERROR; \
goto cleanup; \
} \
extern void prepend_err_str (krb5_context ctx, const char *s, krb5_error_code err, krb5_error_code oerr);
#define LDAP_SEARCH(base, scope, filter, attrs) LDAP_SEARCH_1(base, scope, filter, attrs, CHECK_STATUS)
do { \
st = ldap_search_ext_s(ld, base, scope, filter, attrs, 0, NULL, NULL, &timelimit, LDAP_NO_LIMIT, &result); \
if (ldap_server_handle) \
} \
\
if (status_check != IGNORE_STATUS) { \
if (tempst != 0) { \
st = KRB5_KDB_ACCESS_ERROR; \
goto cleanup; \
} \
if (st != LDAP_SUCCESS) { \
goto cleanup; \
} \
}
} \
goto cleanup; \
}
goto cleanup; \
}
&& ldap_context->server_info_list)) { \
return KRB5_KDB_DBNOTINITED; \
}
/* To be used later */
typedef struct _krb5_ldap_certificates{
char *certificate;
int certtype;
/* ldap server info structure */
typedef struct _krb5_ldap_server_handle {
int msgid;
struct _krb5_ldap_server_info {
char *server_name;
#ifdef HAVE_EDIRECTORY
char *root_certificate_file;
#endif
};
/* ldap server structure */
typedef struct _krb5_ldap_context {
char *conf_section;
char *bind_dn;
char *bind_pwd;
char *service_password_file;
char *root_certificate_file;
char *service_cert_path;
char *service_cert_pass;
typedef struct {
int nkey;
}KEY;
/* misc functions */
krb5_ldap_lib_init(void);
krb5_ldap_lib_cleanup(void);
void *
void
krb5_ldap_create(krb5_context , char *, char **);
krb5_ldap_open( krb5_context , char *,
char **db_args,
int mode );
int
has_sasl_external_mech(krb5_context, char *);
/* DAL functions */
krb5_ldap_set_option( krb5_context, int, void * );
krb5_ldap_lock( krb5_context, int );
krb5_ldap_supported_realms( krb5_context, char ** );
krb5_ldap_free_supported_realms( krb5_context, char ** );
const char *
krb5_ldap_errcode_2_string( krb5_context, long );
void
krb5_ldap_release_errcode_string (krb5_context, const char *);
#ifndef HAVE_LDAP_INITIALIZE
/* Solaris Kerberos: added a use_SSL parameter */
int
ldap_initialize(LDAP **, char *, int, char **);
#endif
#ifndef HAVE_LDAP_UNBIND_EXT_S
int
#endif
#endif