ldap_handle.c revision 54925bf60766fbb4f1f2d7c843721406a7b7a3fb
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* 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.
*/
#include "ldap_main.h"
#ifdef ASYNC_BIND
/*
* Update the server info structure. In case of an asynchronous bind,
* this function is called to check the bind status. A flag
* server_info_upate_pending is refered before calling this function.
* This function sets the server_status to either ON or OFF and
* sets the server_info_udpate_pending to OFF.
* Do not lock the mutex here. The caller should lock it
*/
static krb5_error_code
{
return -1;
while (st == 0) {
switch (st) {
case -1:
break;
case 0:
continue;
break;
case LDAP_RES_BIND:
} else {
}
break;
default:
continue;
break;
}
}
return 0;
}
#endif
/*
* Return ldap server handle from the pool. If the pool is exhausted return NULL.
* Do not lock the mutex, caller should lock it
*/
static krb5_ldap_server_handle *
{
int cnt=0;
break;
#ifdef ASYNC_BIND
}
break;
} else
#endif
}
}
++cnt;
}
return ldap_server_handle;
}
/*
* This is called incase krb5_get_ldap_handle returns NULL.
* Try getting a single connection (handle) and return the same by
* calling krb5_get_ldap_handle function.
* Do not lock the mutex here. The caller should lock it
*/
static krb5_ldap_server_handle *
{
return NULL;
return ldap_server_handle;
}
/*
* Put back the ldap server handle to the front of the list of handles of the
* ldap server info structure.
* Do not lock the mutex here. The caller should lock it.
*/
static krb5_error_code
{
if (ldap_server_handle == NULL)
return 0;
return 0;
}
/*
* Add a new ldap server handle structure to the server info structure.
* This function name can be changed to krb5_insert_ldap_handle.
* Do not lock the mutex here. The caller should lock it
*/
{
return 0;
server_info->num_conns++;
return 0;
}
/*
* Free up all the ldap server handles of the server info.
* This function is called when the ldap server returns LDAP_SERVER_DOWN.
*/
static krb5_error_code
{
/* Solaris kerberos: don't leak ldap handles */
}
return 0;
}
/*
* wrapper function called from outside to get a handle.
*/
{
return st;
}
/*
* wrapper function wrapper called to get the next ldap server handle, when the current
* ldap server handle returns LDAP_SERVER_DOWN.
*/
{
return st;
}
/*
* wrapper function to call krb5_put_ldap_handle.
*/
void
{
if (ldap_server_handle != NULL) {
}
return;
}