154925bf6Swillf /*
2*159d09a2SMark Phalan  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
354925bf6Swillf  * Use is subject to license terms.
454925bf6Swillf  */
554925bf6Swillf 
654925bf6Swillf 
754925bf6Swillf /*
854925bf6Swillf  * lib/kdb/kdb_ldap/ldap_exp.c
954925bf6Swillf  *
1054925bf6Swillf  * Copyright (c) 2004-2005, Novell, Inc.
1154925bf6Swillf  * All rights reserved.
1254925bf6Swillf  *
1354925bf6Swillf  * Redistribution and use in source and binary forms, with or without
1454925bf6Swillf  * modification, are permitted provided that the following conditions are met:
1554925bf6Swillf  *
1654925bf6Swillf  *   * Redistributions of source code must retain the above copyright notice,
1754925bf6Swillf  *       this list of conditions and the following disclaimer.
1854925bf6Swillf  *   * Redistributions in binary form must reproduce the above copyright
1954925bf6Swillf  *       notice, this list of conditions and the following disclaimer in the
2054925bf6Swillf  *       documentation and/or other materials provided with the distribution.
2154925bf6Swillf  *   * The copyright holder's name is not used to endorse or promote products
2254925bf6Swillf  *       derived from this software without specific prior written permission.
2354925bf6Swillf  *
2454925bf6Swillf  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2554925bf6Swillf  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2654925bf6Swillf  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2754925bf6Swillf  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2854925bf6Swillf  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2954925bf6Swillf  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3054925bf6Swillf  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3154925bf6Swillf  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
3254925bf6Swillf  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3354925bf6Swillf  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3454925bf6Swillf  * POSSIBILITY OF SUCH DAMAGE.
3554925bf6Swillf  */
3654925bf6Swillf 
3754925bf6Swillf #include "k5-int.h"
3854925bf6Swillf #if HAVE_UNISTD_H
3954925bf6Swillf #include <unistd.h>
4054925bf6Swillf #endif
4154925bf6Swillf #include <stdio.h>
4254925bf6Swillf #include <errno.h>
4354925bf6Swillf #include <utime.h>
4454925bf6Swillf #include <kdb5.h>
4554925bf6Swillf #include "kdb_ldap.h"
4654925bf6Swillf #include "ldap_principal.h"
4754925bf6Swillf #include "ldap_pwd_policy.h"
4854925bf6Swillf 
4954925bf6Swillf 
5054925bf6Swillf /*
5154925bf6Swillf  *      Exposed API
5254925bf6Swillf  */
5354925bf6Swillf 
5454925bf6Swillf kdb_vftabl kdb_function_table = {
5554925bf6Swillf   /* major version number 1 */		       1,
5654925bf6Swillf   /* minor version number 0 */		       0,
5754925bf6Swillf   /* Solaris Kerberos: iprop support */
5854925bf6Swillf   /* iprop_supported, not by ldap*/	       0,
5954925bf6Swillf   /* init_library */			       krb5_ldap_lib_init,
6054925bf6Swillf   /* fini_library */			       krb5_ldap_lib_cleanup,
6154925bf6Swillf   /* init_module */			       krb5_ldap_open,
6254925bf6Swillf   /* fini_module */			       krb5_ldap_close,
6354925bf6Swillf   /* db_create */			       krb5_ldap_create,
6454925bf6Swillf   /* db_destroy */			       krb5_ldap_delete_realm_1,
6554925bf6Swillf   /* db_get_age */                             krb5_ldap_db_get_age,
6654925bf6Swillf   /* db_set_option */			       krb5_ldap_set_option,
6754925bf6Swillf   /* db_lock */				       krb5_ldap_lock,
6854925bf6Swillf   /* db_unlock */			       krb5_ldap_unlock,
6954925bf6Swillf   /* db_get_principal */		       krb5_ldap_get_principal,
7054925bf6Swillf   /* Solaris Kerberos: need a nolock for iprop, not used for this plugin */
7154925bf6Swillf   /* db_get_principal_nolock */		       krb5_ldap_get_principal,
7254925bf6Swillf   /* db_free_principal */		       krb5_ldap_free_principal,
7354925bf6Swillf   /* db_put_principal */		       krb5_ldap_put_principal,
7454925bf6Swillf   /* db_delete_principal */		       krb5_ldap_delete_principal,
7554925bf6Swillf   /* db_iterate */			       krb5_ldap_iterate,
7654925bf6Swillf   /* db_create_policy */                       krb5_ldap_create_password_policy,
7754925bf6Swillf   /* db_get_policy */                          krb5_ldap_get_password_policy,
7854925bf6Swillf   /* db_put_policy */                          krb5_ldap_put_password_policy,
7954925bf6Swillf   /* db_iter_policy */                         krb5_ldap_iterate_password_policy,
8054925bf6Swillf   /* db_delete_policy */                       krb5_ldap_delete_password_policy,
8154925bf6Swillf   /* db_free_policy */                         krb5_ldap_free_password_policy,
8254925bf6Swillf   /* db_supported_realms */		       krb5_ldap_supported_realms,
8354925bf6Swillf   /* db_free_supported_realms */	       krb5_ldap_free_supported_realms,
8454925bf6Swillf   /* errcode_2_string */                       krb5_ldap_errcode_2_string,
8554925bf6Swillf   /* release_errcode_string */		       krb5_ldap_release_errcode_string,
8654925bf6Swillf   /* db_alloc */                               krb5_ldap_alloc,
8754925bf6Swillf   /* db_free */                                krb5_ldap_free,
8854925bf6Swillf             /* optional functions */
8954925bf6Swillf   /* set_master_key */			       krb5_ldap_set_mkey,
9054925bf6Swillf   /* get_master_key */			       krb5_ldap_get_mkey,
9154925bf6Swillf   /* setup_master_key_name */		       NULL,
92