/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* setoption.c - ldap_set_option implementation
*/
#include "ldap-int.h"
#ifdef _SOLARIS_SDK
#include "solaris-priv.h"
#endif
extern int nsldapi_sasl_secprops(const char *in,
} else { \
}
int
{
int rc, i;
if (!nsldapi_initialized) {
}
/*
* process global options (not associated with an LDAP session handle)
*/
if (option == LDAP_OPT_MEMALLOC_FN_PTRS) {
/* set libldap ones via a struct copy */
/* also set liblber memory allocation callbacks */
&memalloc_fns) != 0) {
return (-1);
}
return (0);
}
/*
* LDAP_OPT_DEBUG_LEVEL is global
*/
if (LDAP_OPT_DEBUG_LEVEL == option) {
#ifdef LDAP_DEBUG
ldap_debug = *((int *)optdata);
#endif
return (0);
}
/*
* if ld is NULL, arrange to modify our default settings
*/
#ifdef LDAP_DEBUG
ldap_debug = 0;
#endif
}
/*
* process options that are associated with an LDAP session handle
*/
if (!NSLDAPI_VALID_LDAP_POINTER(ld)) {
return (-1); /* punt */
}
rc = 0;
if (ld != &nsldapi_ld_defaults &&
}
switch (option) {
/* options that can be turned on and off */
#ifdef LDAP_DNS
case LDAP_OPT_DNS:
break;
#endif
case LDAP_OPT_REFERRALS:
break;
#ifdef LDAP_SSLIO_HOOKS
case LDAP_OPT_SSL:
break;
#endif
case LDAP_OPT_RESTART:
break;
case LDAP_OPT_RECONNECT:
break;
#ifdef LDAP_ASYNC_IO
case LDAP_OPT_ASYNC_CONNECT:
break;
#endif /* LDAP_ASYNC_IO */
/* fields in the LDAP structure */
case LDAP_OPT_DEREF:
break;
case LDAP_OPT_SIZELIMIT:
break;
case LDAP_OPT_TIMELIMIT:
break;
break;
}
break;
case LDAP_OPT_SERVER_CONTROLS:
/* nsldapi_dup_controls returns -1 and sets lderrno on error */
(LDAPControl **)optdata);
break;
case LDAP_OPT_CLIENT_CONTROLS:
/* nsldapi_dup_controls returns -1 and sets lderrno on error */
(LDAPControl **)optdata);
break;
/* rebind proc */
case LDAP_OPT_REBIND_FN:
break;
case LDAP_OPT_REBIND_ARG:
break;
#ifdef LDAP_SSLIO_HOOKS
/* i/o function pointers */
case LDAP_OPT_IO_FN_PTRS:
rc = -1;
}
break;
/* extended i/o function pointers */
case LDAP_X_OPT_EXTIO_FN_PTRS:
/* denotes use of old iofns struct (no writev) */
ld->ld_extclose_fn =
ld->ld_extread_fn =
ld->ld_extwrite_fn =
ld->ld_extpoll_fn =
((struct ldap_x_ext_io_fns_rev0 *)optdata)->
&(ld->ld_ext_io_fns)) != 0) {
return (LDAP_LOCAL_ERROR);
}
} else {
/* struct copy */
}
!= LDAP_SUCCESS) {
rc = -1;
}
break;
#endif
/* thread function pointers */
case LDAP_OPT_THREAD_FN_PTRS:
/*
* It is only safe to set the thread function pointers
* when one thread is using the LDAP session handle.
*/
/* free existing mutexes (some are allocated by ldap_init()) */
/* struct copy */
/* allocate new mutexes */
/* LDAP_OPTION_LOCK was never locked... so just return */
return (rc);
/* extra thread function pointers */
/* The extra thread funcs will only pick up the threadid */
/* Reset the rest of the structure preserving the threadid fn */
/* We assume that only one thread is active when replacing */
/* the threadid function. We will now proceed and reset all */
for (i = 0; i < LDAP_MAX_LOCK; i++) {
ld->ld_mutex_refcnt[i] = 0;
}
return (rc);
/* DNS function pointers */
case LDAP_OPT_DNS_FN_PTRS:
/* struct copy */
break;
/* cache function pointers */
case LDAP_OPT_CACHE_FN_PTRS:
/* struct copy */
break;
case LDAP_OPT_CACHE_STRATEGY:
break;
case LDAP_OPT_CACHE_ENABLE:
break;
case LDAP_OPT_ERROR_NUMBER:
break;
case LDAP_OPT_ERROR_STRING:
nsldapi_strdup((char *)optdata));
rc = LDAP_SUCCESS;
break;
case LDAP_OPT_MATCHED_DN:
rc = LDAP_SUCCESS;
break;
}
break;
case LDAP_OPT_HOST_NAME:
}
break;
break;
#ifdef _SOLARIS_SDK
/* recursion prevention dns functions */
case LDAP_X_OPT_DNS_SKIPDB:
break;
#endif
#ifdef LDAP_SASLIO_HOOKS
/* SASL options */
case LDAP_OPT_X_SASL_MECH:
}
break;
case LDAP_OPT_X_SASL_REALM:
}
break;
case LDAP_OPT_X_SASL_AUTHCID:
}
break;
case LDAP_OPT_X_SASL_AUTHZID:
}
break;
{
int sc;
return (-1);
}
ctx = (sasl_conn_t *)
return (-1);
}
(void *) &extprops);
return (-1);
}
}
break;
case LDAP_OPT_X_SASL_SECPROPS:
{
int sc;
&ld->ld_sasl_secprops);
}
case LDAP_OPT_X_SASL_SSF_MIN:
break;
case LDAP_OPT_X_SASL_SSF_MAX:
break;
break;
case LDAP_OPT_X_SASL_SSF: /* read only */
rc = -1;
break;
#endif
default:
rc = -1;
}
if (ld != &nsldapi_ld_defaults) {
}
return (rc);
}