Commit 2ee43073 authored by Howard Chu's avatar Howard Chu
Browse files

ITS#5927 MicrosoftAD compatibility hack (YUCK) - treat '=' as '-'

if defined in an attributeoption
parent 4bc8cb63
...@@ -64,6 +64,8 @@ static Attr_option lang_option = { BER_BVC("lang-"), 1 }; ...@@ -64,6 +64,8 @@ static Attr_option lang_option = { BER_BVC("lang-"), 1 };
static Attr_option *options = &lang_option; static Attr_option *options = &lang_option;
static int option_count = 1; static int option_count = 1;
static int msad_range_hack = 0;
static Attr_option *ad_find_option_definition( const char *opt, int optlen ); static Attr_option *ad_find_option_definition( const char *opt, int optlen );
static int ad_keystring( static int ad_keystring(
...@@ -76,7 +78,9 @@ static int ad_keystring( ...@@ -76,7 +78,9 @@ static int ad_keystring(
} }
for( i=1; i<bv->bv_len; i++ ) { for( i=1; i<bv->bv_len; i++ ) {
if( !AD_CHAR( bv->bv_val[i] ) ) { if( !AD_CHAR( bv->bv_val[i] )) {
if ( msad_range_hack && bv->bv_val[i] == '=' )
continue;
return 1; return 1;
} }
} }
...@@ -234,7 +238,8 @@ int slap_bv2ad( ...@@ -234,7 +238,8 @@ int slap_bv2ad(
} else if ( ad_find_option_definition( opt, optlen ) ) { } else if ( ad_find_option_definition( opt, optlen ) ) {
int i; int i;
if( opt[optlen-1] == '-' ) { if( opt[optlen-1] == '-' ||
( opt[optlen-1] == '=' && msad_range_hack )) {
desc.ad_flags |= SLAP_DESC_TAG_RANGE; desc.ad_flags |= SLAP_DESC_TAG_RANGE;
} }
...@@ -1178,6 +1183,11 @@ ad_define_option( const char *name, const char *fname, int lineno ) ...@@ -1178,6 +1183,11 @@ ad_define_option( const char *name, const char *fname, int lineno )
optlen = 0; optlen = 0;
do { do {
if ( !DESC_CHAR( name[optlen] ) ) { if ( !DESC_CHAR( name[optlen] ) ) {
/* allow trailing '=', same as '-' */
if ( name[optlen] == '=' && !name[optlen+1] ) {
msad_range_hack = 1;
continue;
}
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"%s: line %d: illegal option name \"%s\"\n", "%s: line %d: illegal option name \"%s\"\n",
fname, lineno, name ); fname, lineno, name );
...@@ -1204,7 +1214,8 @@ ad_define_option( const char *name, const char *fname, int lineno ) ...@@ -1204,7 +1214,8 @@ ad_define_option( const char *name, const char *fname, int lineno )
options[i].name.bv_val = ch_strdup( name ); options[i].name.bv_val = ch_strdup( name );
options[i].name.bv_len = optlen; options[i].name.bv_len = optlen;
options[i].prefix = (name[optlen-1] == '-'); options[i].prefix = (name[optlen-1] == '-') ||
(name[optlen-1] == '=');
if ( i != option_count && if ( i != option_count &&
options[i].prefix && options[i].prefix &&
......
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