diff options
author | Endi S. Dewata <edewata@redhat.com> | 2009-10-23 22:59:48 -0500 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-11-02 16:36:54 +1100 |
commit | bf01937549cd1ebaf327a709ecb104bfc0e0705c (patch) | |
tree | 90caec9a9b4b81227c4c1f3cfb87ee3aa0efbfe3 /source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | |
parent | 8097280b468b7bcf26a0e17fdcaaccfb34d06415 (diff) | |
download | samba-bf01937549cd1ebaf327a709ecb104bfc0e0705c.tar.gz |
s4:dsdb - Store SID as string in FDS.
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/simple_ldap_map.c')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index d923e55484..36104e7e3c 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -33,6 +33,7 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "librpc/ndr/libndr.h" #include "dsdb/samdb/samdb.h" +#include "../../../lib/ldb/include/ldb_handlers.h" struct entryuuid_private { struct ldb_context *ldb; @@ -122,6 +123,25 @@ static struct ldb_val sid_always_binary(struct ldb_module *module, TALLOC_CTX *c return out; } +/* Ensure we always convert sids into string, so the backend doesn't have to know about both forms */ +static struct ldb_val sid_always_string(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val) +{ + struct ldb_context *ldb = ldb_module_get_ctx(module); + struct ldb_val out = data_blob(NULL, 0); + + if (ldif_comparision_objectSid_isString(val)) { + if (ldb_handler_copy(ldb, ctx, val, &out) != LDB_SUCCESS) { + return data_blob(NULL, 0); + } + + } else { + if (ldif_write_objectSid(ldb, ctx, val, &out) != LDB_SUCCESS) { + return data_blob(NULL, 0); + } + } + return out; +} + /* Ensure we always convert objectCategory into a DN */ static struct ldb_val objectCategory_always_dn(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val) { @@ -470,9 +490,9 @@ static const struct ldb_map_attribute nsuniqueid_attributes[] = .type = LDB_MAP_CONVERT, .u = { .convert = { - .remote_name = "objectSid", - .convert_local = sid_always_binary, - .convert_remote = val_copy, + .remote_name = "sambaSID", + .convert_local = sid_always_string, + .convert_remote = sid_always_binary, } } }, |