summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/simple_ldap_map.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/simple_ldap_map.c39
1 files changed, 26 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 = {