From aa87b9ad2e0f8c8f7d85ae254d3bb1e9f3f82a8e Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 31 Mar 2006 21:07:53 +0000 Subject: [PATCH] cleanup dead code --- libraries/libldap/options.c | 103 ++++++++++++++++++------------------ libraries/libldap/request.c | 13 +---- libraries/libldap/schema.c | 15 ++++++ 3 files changed, 67 insertions(+), 64 deletions(-) diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index 9d608c9c2c..4b76a0c5f7 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -452,58 +452,6 @@ ldap_set_option( } } return LDAP_OPT_SUCCESS; - /* Only accessed from inside this function by ldap_set_rebind_proc() */ - case LDAP_OPT_REBIND_PROC: { - lo->ldo_rebind_proc = (LDAP_REBIND_PROC *)invalue; - } return LDAP_OPT_SUCCESS; - case LDAP_OPT_REBIND_PARAMS: { - lo->ldo_rebind_params = (void *)invalue; - } return LDAP_OPT_SUCCESS; - - /* Only accessed from inside this function by ldap_set_nextref_proc() */ - case LDAP_OPT_NEXTREF_PROC: { - lo->ldo_nextref_proc = (LDAP_NEXTREF_PROC *)invalue; - } return LDAP_OPT_SUCCESS; - case LDAP_OPT_NEXTREF_PARAMS: { - lo->ldo_nextref_params = (void *)invalue; - } return LDAP_OPT_SUCCESS; - } - - if(invalue == NULL) { - /* no place to set from */ - return LDAP_OPT_ERROR; - } - - /* options which cannot withstand invalue == NULL */ - - switch(option) { - case LDAP_OPT_API_INFO: - case LDAP_OPT_DESC: - /* READ ONLY */ - break; - - case LDAP_OPT_DEREF: - lo->ldo_deref = * (const int *) invalue; - return LDAP_OPT_SUCCESS; - - case LDAP_OPT_SIZELIMIT: - lo->ldo_sizelimit = * (const int *) invalue; - return LDAP_OPT_SUCCESS; - - case LDAP_OPT_TIMELIMIT: - lo->ldo_timelimit = * (const int *) invalue; - return LDAP_OPT_SUCCESS; - - case LDAP_OPT_PROTOCOL_VERSION: { - int vers = * (const int *) invalue; - if (vers < LDAP_VERSION_MIN || vers > LDAP_VERSION_MAX) { - /* not supported */ - break; - } - lo->ldo_version = vers; - } return LDAP_OPT_SUCCESS; - - case LDAP_OPT_HOST_NAME: { const char *host = (const char *) invalue; LDAPURLDesc *ludlist = NULL; @@ -594,6 +542,57 @@ ldap_set_option( return rc; } + /* Only accessed from inside this function by ldap_set_rebind_proc() */ + case LDAP_OPT_REBIND_PROC: { + lo->ldo_rebind_proc = (LDAP_REBIND_PROC *)invalue; + } return LDAP_OPT_SUCCESS; + case LDAP_OPT_REBIND_PARAMS: { + lo->ldo_rebind_params = (void *)invalue; + } return LDAP_OPT_SUCCESS; + + /* Only accessed from inside this function by ldap_set_nextref_proc() */ + case LDAP_OPT_NEXTREF_PROC: { + lo->ldo_nextref_proc = (LDAP_NEXTREF_PROC *)invalue; + } return LDAP_OPT_SUCCESS; + case LDAP_OPT_NEXTREF_PARAMS: { + lo->ldo_nextref_params = (void *)invalue; + } return LDAP_OPT_SUCCESS; + } + + if(invalue == NULL) { + /* no place to set from */ + return LDAP_OPT_ERROR; + } + + /* options which cannot withstand invalue == NULL */ + + switch(option) { + case LDAP_OPT_API_INFO: + case LDAP_OPT_DESC: + /* READ ONLY */ + break; + + case LDAP_OPT_DEREF: + lo->ldo_deref = * (const int *) invalue; + return LDAP_OPT_SUCCESS; + + case LDAP_OPT_SIZELIMIT: + lo->ldo_sizelimit = * (const int *) invalue; + return LDAP_OPT_SUCCESS; + + case LDAP_OPT_TIMELIMIT: + lo->ldo_timelimit = * (const int *) invalue; + return LDAP_OPT_SUCCESS; + + case LDAP_OPT_PROTOCOL_VERSION: { + int vers = * (const int *) invalue; + if (vers < LDAP_VERSION_MIN || vers > LDAP_VERSION_MAX) { + /* not supported */ + break; + } + lo->ldo_version = vers; + } return LDAP_OPT_SUCCESS; + case LDAP_OPT_ERROR_NUMBER: { int err = * (const int *) invalue; diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index 9a16858d93..a3849da871 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -93,7 +93,6 @@ ldap_send_initial_request( BerElement *ber, ber_int_t msgid) { - LDAPURLDesc *servers; int rc; Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 ); @@ -112,14 +111,6 @@ ldap_send_initial_request( 0, 0, 0 ); } - { - /* - * use of DNS is turned off or this is an X.500 DN... - * use our default connection - */ - servers = NULL; - } - #ifdef LDAP_CONNECTIONLESS if (LDAP_IS_UDP(ld)) { if (msgtype == LDAP_REQ_BIND) { @@ -136,12 +127,10 @@ ldap_send_initial_request( ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex ); #endif rc = ldap_send_server_request( ld, ber, msgid, NULL, - servers, NULL, NULL ); + NULL, NULL, NULL ); #ifdef LDAP_R_COMPILE ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); #endif - if (servers) - ldap_free_urllist(servers); return(rc); } diff --git a/libraries/libldap/schema.c b/libraries/libldap/schema.c index 9e04633b00..46271968e6 100644 --- a/libraries/libldap/schema.c +++ b/libraries/libldap/schema.c @@ -3235,6 +3235,21 @@ ldap_str2nameform( LDAP_CONST char * s, seen_obsolete = 1; nf->nf_obsolete = LDAP_SCHEMA_YES; parse_whsp(&ss); + } else if ( !strcasecmp(sval,"OC") ) { + LDAP_FREE(sval); + if ( seen_class ) { + *code = LDAP_SCHERR_DUPOPT; + *errp = ss; + ldap_nameform_free(nf); + return(NULL); + } + seen_class = 1; + nf->nf_objectclass = parse_woid(&ss,code); + if ( !nf->nf_objectclass ) { + *errp = ss; + ldap_nameform_free(nf); + return NULL; + } } else if ( !strcasecmp(sval,"MUST") ) { LDAP_FREE(sval); if ( seen_must ) { -- 2.39.5