mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-01 03:19:27 -05:00
Update entryUUID to latest draft specification
This commit is contained in:
parent
13ef3206ef
commit
80fa73bf8c
4 changed files with 109 additions and 5 deletions
|
|
@ -850,7 +850,7 @@ int slap_mods_opattrs(
|
|||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_entryUUID;
|
||||
mod->sml_values =
|
||||
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], &tmpval );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
|
|
@ -863,7 +863,8 @@ int slap_mods_opattrs(
|
|||
mod->sml_op = mop;
|
||||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_creatorsName;
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
mod->sml_values =
|
||||
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], &name );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
|
|
@ -881,7 +882,8 @@ int slap_mods_opattrs(
|
|||
mod->sml_op = mop;
|
||||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_createTimestamp;
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
mod->sml_values =
|
||||
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], ×tamp );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
|
|
|
|||
|
|
@ -1770,6 +1770,86 @@ IA5StringNormalize(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
UUIDValidate(
|
||||
Syntax *syntax,
|
||||
struct berval *in )
|
||||
{
|
||||
int i;
|
||||
if( in->bv_len != 36 ) {
|
||||
assert(0);
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
for( i=0; i<36; i++ ) {
|
||||
switch(i) {
|
||||
case 8:
|
||||
case 13:
|
||||
case 18:
|
||||
case 23:
|
||||
if( in->bv_val[i] != '-' ) {
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if( !ASCII_HEX( in->bv_val[i]) ) {
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
UUIDNormalize(
|
||||
slap_mask_t usage,
|
||||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *val,
|
||||
struct berval *normalized,
|
||||
void *ctx )
|
||||
{
|
||||
unsigned char octet;
|
||||
int i;
|
||||
int j;
|
||||
normalized->bv_len = 16;
|
||||
normalized->bv_val = sl_malloc( normalized->bv_len+1, ctx );
|
||||
|
||||
for( i=0, j=0; i<36; i++ ) {
|
||||
unsigned char nibble;
|
||||
if( val->bv_val[i] == '-' ) {
|
||||
continue;
|
||||
|
||||
} else if( ASCII_DIGIT( val->bv_val[i] ) ) {
|
||||
nibble = val->bv_val[i] - '0';
|
||||
|
||||
} else if( ASCII_HEXLOWER( val->bv_val[i] ) ) {
|
||||
nibble = val->bv_val[i] - ('a'-10);
|
||||
|
||||
} else if( ASCII_HEXUPPER( val->bv_val[i] ) ) {
|
||||
nibble = val->bv_val[i] - ('A'-10);
|
||||
|
||||
} else {
|
||||
sl_free( normalized->bv_val, ctx );
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
if( j % 2 ) {
|
||||
octet = nibble << 4;
|
||||
} else {
|
||||
octet |= nibble;
|
||||
normalized->bv_val[j>>1] = octet;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
normalized->bv_val[normalized->bv_len] = 0;
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
numericStringValidate(
|
||||
Syntax *syntax,
|
||||
|
|
@ -2761,6 +2841,9 @@ static slap_syntax_defs_rec syntax_defs[] = {
|
|||
SLAP_SYNTAX_HIDE, NULL, NULL},
|
||||
#endif
|
||||
|
||||
{"( 1.3.6.1.4.1.4203.666.2.6 DESC 'UUID' )",
|
||||
SLAP_SYNTAX_HIDE, UUIDValidate, NULL},
|
||||
|
||||
/* OpenLDAP Void Syntax */
|
||||
{"( 1.3.6.1.4.1.4203.1.1.1 DESC 'OpenLDAP void' )" ,
|
||||
SLAP_SYNTAX_HIDE, inValidate, NULL},
|
||||
|
|
@ -3109,6 +3192,20 @@ static slap_mrule_defs_rec mrule_defs[] = {
|
|||
NULL, NULL,
|
||||
"integerMatch" },
|
||||
|
||||
{"( 1.3.6.1.4.1.4203.666.4.6 NAME 'UUIDMatch' "
|
||||
"SYNTAX 1.3.6.1.4.1.4203.666.2.6 )",
|
||||
SLAP_MR_HIDE | SLAP_MR_EQUALITY, NULL,
|
||||
NULL, UUIDNormalize, octetStringMatch,
|
||||
octetStringIndexer, octetStringFilter,
|
||||
NULL},
|
||||
|
||||
{"( 1.3.6.1.4.1.4203.666.4.7 NAME 'UUIDOrderingMatch' "
|
||||
"SYNTAX 1.3.6.1.4.1.4203.666.2.6 )",
|
||||
SLAP_MR_HIDE | SLAP_MR_ORDERING, NULL,
|
||||
NULL, UUIDNormalize, octetStringOrderingMatch,
|
||||
octetStringIndexer, octetStringFilter,
|
||||
"UUIDMatch"},
|
||||
|
||||
{NULL, SLAP_MR_NONE, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL,
|
||||
NULL }
|
||||
|
|
|
|||
|
|
@ -368,8 +368,9 @@ static struct slap_schema_ad_map {
|
|||
|
||||
{ "entryUUID", "( 1.3.6.1.4.1.4203.666.1.6 NAME 'entryUUID' "
|
||||
"DESC 'UUID of the entry' "
|
||||
"EQUALITY octetStringMatch "
|
||||
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} "
|
||||
"EQUALITY UUIDMatch "
|
||||
"ORDERING UUIDOrderingMatch "
|
||||
"SYNTAX 1.3.6.1.4.1.4203.666.2.6 "
|
||||
"SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
|
||||
NULL, SLAP_AT_HIDE,
|
||||
NULL, NULL,
|
||||
|
|
|
|||
|
|
@ -96,6 +96,10 @@ LDAP_BEGIN_DECL
|
|||
#define ASCII_UPPER(c) ( (c) >= 'A' && (c) <= 'Z' )
|
||||
#define ASCII_ALPHA(c) ( ASCII_LOWER(c) || ASCII_UPPER(c) )
|
||||
#define ASCII_DIGIT(c) ( (c) >= '0' && (c) <= '9' )
|
||||
#define ASCII_HEXLOWER(c) ( (c) >= 'a' && (c) <= 'h' )
|
||||
#define ASCII_HEXUPPER(c) ( (c) >= 'A' && (c) <= 'H' )
|
||||
#define ASCII_HEX(c) ( ASCII_DIGIT(c) || \
|
||||
ASCII_HEXLOWER(c) || ASCII_HEXUPPER(c) )
|
||||
#define ASCII_ALNUM(c) ( ASCII_ALPHA(c) || ASCII_DIGIT(c) )
|
||||
#define ASCII_PRINTABLE(c) ( (c) >= ' ' && (c) <= '~' )
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue