X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fschema_init.c;h=354bbffe6757e1ac9fbcc742e4f16d8ad3982ec0;hb=4e4818771c26a4c02808130970f2a5e4c216ef52;hp=e25d9a7abee867c90b9de07d8e6a19186adb36fc;hpb=fe569dbb7517dbb8bf1905c4f87732197114c4cf;p=openldap diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index e25d9a7abe..354bbffe67 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 ); @@ -3524,7 +3520,6 @@ objectIdentifierFirstComponentMatch( match, value->bv_val, asserted->bv_val ); #endif - if( rc == LDAP_SUCCESS ) *matchp = match; return rc; } @@ -3542,12 +3537,16 @@ integerBitAndMatch( /* safe to assume integers are NUL terminated? */ lValue = strtoul(value->bv_val, NULL, 10); - if(( lValue == LONG_MIN || lValue == LONG_MAX) && errno == ERANGE ) + if(( lValue == LONG_MIN || lValue == LONG_MAX) && errno == ERANGE ) { return LDAP_CONSTRAINT_VIOLATION; + } lAssertedValue = strtol(((struct berval *)assertedValue)->bv_val, NULL, 10); - if(( lAssertedValue == LONG_MIN || lAssertedValue == LONG_MAX) && errno == ERANGE ) + if(( lAssertedValue == LONG_MIN || lAssertedValue == LONG_MAX) + && errno == ERANGE ) + { return LDAP_CONSTRAINT_VIOLATION; + } *matchp = (lValue & lAssertedValue) ? 0 : 1; return LDAP_SUCCESS; @@ -3566,12 +3565,16 @@ integerBitOrMatch( /* safe to assume integers are NUL terminated? */ lValue = strtoul(value->bv_val, NULL, 10); - if(( lValue == LONG_MIN || lValue == LONG_MAX) && errno == ERANGE ) + if(( lValue == LONG_MIN || lValue == LONG_MAX) && errno == ERANGE ) { return LDAP_CONSTRAINT_VIOLATION; + } lAssertedValue = strtol(((struct berval *)assertedValue)->bv_val, NULL, 10); - if(( lAssertedValue == LONG_MIN || lAssertedValue == LONG_MAX) && errno == ERANGE ) + if(( lAssertedValue == LONG_MIN || lAssertedValue == LONG_MAX) + && errno == ERANGE ) + { return LDAP_CONSTRAINT_VIOLATION; + } *matchp = (lValue | lAssertedValue) ? 0 : -1; return LDAP_SUCCESS; @@ -3580,7 +3583,6 @@ integerBitOrMatch( #ifdef HAVE_TLS #include #include -char digit[] = "0123456789"; /* * Next function returns a string representation of a ASN1_INTEGER. @@ -3592,6 +3594,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; @@ -3634,8 +3637,8 @@ asn1_integer2str(ASN1_INTEGER *a, struct berval *bv) return NULL; } *--p = digit[carry]; - if (copy[base] == 0) - base++; + + if (copy[base] == 0) base++; } free(copy); } @@ -3679,7 +3682,9 @@ certificateExactConvert( X509_free(xcert); return LDAP_INVALID_SYNTAX; } - if ( dnX509normalize(X509_get_issuer_name(xcert), &issuer_dn ) != LDAP_SUCCESS ) { + if ( dnX509normalize(X509_get_issuer_name(xcert), &issuer_dn ) + != LDAP_SUCCESS ) + { X509_free(xcert); ber_memfree(serial.bv_val); return LDAP_INVALID_SYNTAX; @@ -3727,18 +3732,14 @@ serial_and_issuer_parse( begin = assertion->bv_val; end = assertion->bv_val+assertion->bv_len-1; - for (p=begin; p<=end && *p != '$'; p++) - ; - if ( p > end ) - return LDAP_INVALID_SYNTAX; + for (p=begin; p<=end && *p != '$'; p++) /* empty */ ; + if ( p > end ) return LDAP_INVALID_SYNTAX; /* p now points at the $ sign, now use begin and end to delimit the serial number */ - while (ASCII_SPACE(*begin)) - begin++; + while (ASCII_SPACE(*begin)) begin++; end = p-1; - while (ASCII_SPACE(*end)) - end--; + while (ASCII_SPACE(*end)) end--; bv.bv_len = end-begin+1; bv.bv_val = begin; @@ -3748,8 +3749,7 @@ serial_and_issuer_parse( if ( issuer_dn ) { begin = p+1; end = assertion->bv_val+assertion->bv_len-1; - while (ASCII_SPACE(*begin)) - begin++; + while (ASCII_SPACE(*begin)) begin++; /* should we trim spaces at the end too? is it safe always? */ bv.bv_len = end-begin+1; @@ -3797,8 +3797,7 @@ certificateExactMatch( X509_free(xcert); serial_and_issuer_parse(assertedValue, - &asserted_serial, - &asserted_issuer_dn); + &asserted_serial, &asserted_issuer_dn); ret = integerMatch( matchp, @@ -3894,8 +3893,7 @@ static int certificateExactIndexer( asn1_integer2str(xcert->cert_info->serialNumber, &serial); X509_free(xcert); integerNormalize( slap_schema.si_syn_integer, - &serial, - &keys[i] ); + &serial, &keys[i] ); ber_memfree(serial.bv_val); #ifdef NEW_LOGGING LDAP_LOG( CONFIG, ENTRY, @@ -3928,8 +3926,7 @@ static int certificateExactFilter( struct berval asserted_serial; serial_and_issuer_parse(assertedValue, - &asserted_serial, - NULL); + &asserted_serial, NULL); keys = ch_malloc( sizeof( struct berval ) * 2 ); integerNormalize( syntax, &asserted_serial, &keys[0] );