diff options
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 39 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_syntax.c | 2 |
2 files changed, 28 insertions, 13 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index 948241b094..0a6c350a3b 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -146,19 +146,10 @@ static struct ldb_val objectCategory_always_dn(struct ldb_module *module, TALLOC static struct ldb_val normalise_to_signed32(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val) { - long long int signed_ll = strtoll((const char *)val->data, NULL, 10); - if (signed_ll >= 0x80000000LL) { - union { - int32_t signed_int; - uint32_t unsigned_int; - } u = { - .unsigned_int = strtoul((const char *)val->data, NULL, 10) - }; - - struct ldb_val out = data_blob_string_const(talloc_asprintf(ctx, "%d", u.signed_int)); - return out; - } - return val_copy(module, ctx, val); + struct ldb_val out; + int32_t i = (int32_t) strtol((char *)val->data, NULL, 0); + out = data_blob_string_const(talloc_asprintf(ctx, "%d", i)); + return out; } static struct ldb_val usn_to_entryCSN(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val) @@ -359,6 +350,17 @@ static const struct ldb_map_attribute entryuuid_attributes[] = } }, { + .local_name = "userAccountControl", + .type = MAP_CONVERT, + .u = { + .convert = { + .remote_name = "userAccountControl", + .convert_local = normalise_to_signed32, + .convert_remote = val_copy, + }, + } + }, + { .local_name = "sAMAccountType", .type = MAP_CONVERT, .u = { @@ -500,6 +502,17 @@ static const struct ldb_map_attribute nsuniqueid_attributes[] = } }, { + .local_name = "userAccountControl", + .type = MAP_CONVERT, + .u = { + .convert = { + .remote_name = "userAccountControl", + .convert_local = normalise_to_signed32, + .convert_remote = val_copy, + }, + } + }, + { .local_name = "sAMAccountType", .type = MAP_CONVERT, .u = { diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index 4fd6501cc8..4ff861766f 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -1243,6 +1243,7 @@ static const struct dsdb_syntax dsdb_syntaxes[] = { .ldb_to_drsuapi = dsdb_syntax_INT32_ldb_to_drsuapi, .equality = "integerMatch", .comment = "Integer", + .ldb_syntax = LDB_SYNTAX_SAMBA_INT32 },{ .name = "String(Octet)", .ldap_oid = LDB_SYNTAX_OCTET_STRING, @@ -1279,6 +1280,7 @@ static const struct dsdb_syntax dsdb_syntaxes[] = { .attributeSyntax_oid = "2.5.5.9", .drsuapi_to_ldb = dsdb_syntax_INT32_drsuapi_to_ldb, .ldb_to_drsuapi = dsdb_syntax_INT32_ldb_to_drsuapi, + .ldb_syntax = LDB_SYNTAX_SAMBA_INT32 },{ /* not used in w2k3 forest */ .name = "String(Numeric)", |