summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-06-18 11:05:45 +0200
committerAndrew Bartlett <abartlet@samba.org>2009-06-19 11:32:01 +1000
commit0376d056e58d76b7792a5512d84c07f703838b4d (patch)
tree4b220a75b90cb7b73ef6729a693df4c0b7c93096 /source4/dsdb/samdb
parent5d40677a9b7d97a028878422be3dc1ace4bfeecf (diff)
downloadsamba-0376d056e58d76b7792a5512d84c07f703838b4d.tar.gz
samba-0376d056e58d76b7792a5512d84c07f703838b4d.tar.bz2
samba-0376d056e58d76b7792a5512d84c07f703838b4d.zip
Correct handling of 32-bit integer attributes in SAMBA 4
- LDB handles now all 32-bit integer attributes correctly (also with overflows) according to the schema - LDAP backends handle the attributes "groupType", "userAccountControl" and "sAMAccountType" correctly. This handling doesn't yet use the schema but the conversion file "simple_ldap.map.c" which contains them hardcoded. Did also a refactoring of the conversion function there. - Bug #6136 should be gone
Diffstat (limited to 'source4/dsdb/samdb')
-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 = {