Commit 30679546 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

rework objectClass mucking to use syntax "pretty" routine

(be liberal in what you accept, strict in what you generate)
parent a609f87e
......@@ -32,7 +32,6 @@
/* not yet implemented */
#define integerFirstComponentNormalize NULL
#define objectIdentifierNormalize NULL
#define objectIdentifierFirstComponentNormalize NULL
#define uniqueMemberMatch NULL
......@@ -1425,41 +1424,46 @@ telephoneNumberNormalize(
}
static int
oidValidate(
numericoidValidate(
Syntax *syntax,
struct berval *val )
struct berval *in )
{
ber_len_t i;
struct berval val = *in;
if( val->bv_len == 0 ) {
if( val.bv_len == 0 ) {
/* disallow empty strings */
return LDAP_INVALID_SYNTAX;
}
if( OID_LEADCHAR(val->bv_val[0]) ) {
int dot = 0;
for(i=1; i < val->bv_len; i++) {
if( OID_SEPARATOR( val->bv_val[i] ) ) {
if( dot++ ) return 1;
} else if ( OID_CHAR( val->bv_val[i] ) ) {
dot = 0;
} else {
return LDAP_INVALID_SYNTAX;
}
while( OID_LEADCHAR( val.bv_val[0] ) ) {
if ( val.bv_len == 1 ) {
return LDAP_SUCCESS;
}
return !dot ? LDAP_SUCCESS : LDAP_INVALID_SYNTAX;
if ( val.bv_val[0] == '0' ) {
break;
}
} else if( DESC_LEADCHAR(val->bv_val[0]) ) {
for(i=1; i < val->bv_len; i++) {
if( !DESC_CHAR(val->bv_val[i] ) ) {
return LDAP_INVALID_SYNTAX;
val.bv_val++;
val.bv_len--;
while ( OID_LEADCHAR( val.bv_val[0] )) {
val.bv_val++;
val.bv_len--;
if ( val.bv_len == 0 ) {
return LDAP_SUCCESS;
}
}
return LDAP_SUCCESS;
if( !OID_SEPARATOR( val.bv_val[0] )) {
break;
}
val.bv_val++;
val.bv_len--;
}
return LDAP_INVALID_SYNTAX;
}
......@@ -2689,7 +2693,7 @@ static slap_syntax_defs_rec syntax_defs[] = {
{"( 1.3.6.1.4.1.1466.115.121.1.37 DESC 'Object Class Description' )",
0, NULL, NULL},
{"( 1.3.6.1.4.1.1466.115.121.1.38 DESC 'OID' )",
0, oidValidate, NULL},
0, numericoidValidate, NULL},
{"( 1.3.6.1.4.1.1466.115.121.1.39 DESC 'Other Mailbox' )",
0, IA5StringValidate, NULL},
{"( 1.3.6.1.4.1.1466.115.121.1.40 DESC 'Octet String' )",
......@@ -2840,7 +2844,7 @@ static slap_mrule_defs_rec mrule_defs[] = {
{"( 2.5.13.0 NAME 'objectIdentifierMatch' "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
NULL, objectIdentifierNormalize, octetStringMatch,
NULL, NULL, octetStringMatch,
octetStringIndexer, octetStringFilter,
NULL },
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment