]> git.sur5r.net Git - openldap/commitdiff
NameAndOptionalUID fix
authorKurt Zeilenga <kurt@openldap.org>
Wed, 11 Dec 2002 02:30:13 +0000 (02:30 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 11 Dec 2002 02:30:13 +0000 (02:30 +0000)
servers/slapd/controls.c
servers/slapd/schema_init.c

index 7b4a124231d32a0a5063eebe685cc41ebf14cdd5..3ce7d9ebd7390355cb915624ce9dcf15d30ea0c0 100644 (file)
@@ -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 );
index e25d9a7abee867c90b9de07d8e6a19186adb36fc..4b4ee0d37158caeb1942c79d350a8cfbbfcebaab 100644 (file)
@@ -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 <openssl/x509.h>
 #include <openssl/err.h>
-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;