From: Kurt Zeilenga Date: Wed, 11 Dec 2002 02:30:13 +0000 (+0000) Subject: NameAndOptionalUID fix X-Git-Tag: OPENLDAP_REL_ENG_2_1_10~28 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=286928e8e47807bc1e47e9d6d8a9c5ecefe902b6;p=openldap NameAndOptionalUID fix --- diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 7b4a124231..3ce7d9ebd7 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -144,10 +144,13 @@ int get_ctrls( } #ifdef NEW_LOGGING - LDAP_LOG( OPERATION, ENTRY, "get_ctrls: conn %lu\n", conn->c_connid, 0, 0 ); + LDAP_LOG( OPERATION, ENTRY, + "get_ctrls: conn %lu\n", conn->c_connid, 0, 0 ); #else - Debug( LDAP_DEBUG_TRACE, "=> get_ctrls\n", 0, 0, 0 ); + Debug( LDAP_DEBUG_TRACE, + "=> get_ctrls\n", 0, 0, 0 ); #endif + if( op->o_protocol < LDAP_VERSION3 ) { rc = SLAPD_DISCONNECT; errmsg = "controls require LDAPv3"; @@ -220,11 +223,29 @@ int get_ctrls( Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get oid failed.\n", 0, 0, 0 ); #endif + ldap_controls_free( op->o_ctrls ); op->o_ctrls = NULL; rc = SLAPD_DISCONNECT; errmsg = "decoding controls error"; goto return_results; + + } else if( c->ldctl_oid == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, INFO, + "get_ctrls: conn %lu got emtpy OID.\n", + conn->c_connid, 0, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "get_ctrls: conn %lu got emtpy OID.\n", + conn->c_connid, 0, 0 ); +#endif + + ldap_controls_free( op->o_ctrls ); + op->o_ctrls = NULL; + rc = LDAP_PROTOCOL_ERROR; + errmsg = "OID field is empty"; + goto return_results; } tag = ber_peek_tag( ber, &len ); @@ -260,13 +281,12 @@ int get_ctrls( #ifdef NEW_LOGGING LDAP_LOG( OPERATION, INFO, "get_ctrls: conn %lu: " "%s (%scritical): get value failed.\n", - conn->c_connid, c->ldctl_oid ? c->ldctl_oid : "(NULL)", + conn->c_connid, c->ldctl_oid, c->ldctl_iscritical ? "" : "non" ); #else Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: conn %lu: " "%s (%scritical): get value failed.\n", - conn->c_connid, - c->ldctl_oid ? c->ldctl_oid : "(NULL)", + conn->c_connid, c->ldctl_oid, c->ldctl_iscritical ? "" : "non" ); #endif ldap_controls_free( op->o_ctrls ); @@ -280,13 +300,11 @@ int get_ctrls( #ifdef NEW_LOGGING LDAP_LOG( OPERATION, INFO, "get_ctrls: conn %lu oid=\"%s\" (%scritical)\n", - conn->c_connid, c->ldctl_oid ? c->ldctl_oid : "(NULL)", - c->ldctl_iscritical ? "" : "non" ); + conn->c_connid, c->ldctl_oid, c->ldctl_iscritical ? "" : "non" ); #else - Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: oid=\"%s\" (%scritical)\n", - c->ldctl_oid ? c->ldctl_oid : "(NULL)", - c->ldctl_iscritical ? "" : "non", - 0 ); + Debug( LDAP_DEBUG_TRACE, + "=> get_ctrls: oid=\"%s\" (%scritical)\n", + c->ldctl_oid, c->ldctl_iscritical ? "" : "non", 0 ); #endif sc = find_ctrl( c->ldctl_oid ); diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index e25d9a7abe..4b4ee0d371 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -414,11 +414,7 @@ nameUIDNormalize( } } -#ifdef USE_DN_NORMALIZE rc = dnNormalize2( NULL, &out, normalized ); -#else - rc = dnPretty2( NULL, &out, normalized ); -#endif if( rc != LDAP_SUCCESS ) { free( out.bv_val ); @@ -3580,7 +3576,6 @@ integerBitOrMatch( #ifdef HAVE_TLS #include #include -char digit[] = "0123456789"; /* * Next function returns a string representation of a ASN1_INTEGER. @@ -3592,6 +3587,7 @@ asn1_integer2str(ASN1_INTEGER *a, struct berval *bv) { char buf[256]; char *p; + static char digit[] = "0123456789"; /* We work backwards, make it fill from the end of buf */ p = buf + sizeof(buf) - 1;