summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-09-11 07:50:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:18:19 -0500
commita41b696346bd3c525d09fa97bdf487aa809f3c73 (patch)
tree7373a3c77d0e0fe83e36b3e59d94db935a80826d /source4/dsdb
parentdd4fac5a557a768fd8027e01c7dbdc2ebd80c055 (diff)
downloadsamba-a41b696346bd3c525d09fa97bdf487aa809f3c73.tar.gz
samba-a41b696346bd3c525d09fa97bdf487aa809f3c73.tar.bz2
samba-a41b696346bd3c525d09fa97bdf487aa809f3c73.zip
r18367: When converting to entryUUID, ensure we don't double-convert a
string-format GUID. Andrew Bartlett (This used to be commit 11cc6408c93f46f4d9ae7ae0ee18dac836fe270d)
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/entryUUID.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/entryUUID.c b/source4/dsdb/samdb/ldb_modules/entryUUID.c
index d6f4b10d76..29e80ff003 100644
--- a/source4/dsdb/samdb/ldb_modules/entryUUID.c
+++ b/source4/dsdb/samdb/ldb_modules/entryUUID.c
@@ -58,24 +58,27 @@ static struct ldb_val encode_guid(struct ldb_module *module, TALLOC_CTX *ctx, co
return out;
}
-static struct ldb_val decode_guid(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
+static struct ldb_val guid_always_string(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
{
struct GUID *guid;
NTSTATUS status;
struct ldb_val out = data_blob(NULL, 0);
-
- guid = talloc(ctx, struct GUID);
- if (guid == NULL) {
- return out;
- }
- status = ndr_pull_struct_blob(val, guid, guid,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
- if (!NT_STATUS_IS_OK(status)) {
+ if (val->length >= 32 && val->data[val->length] == '\0') {
+ ldb_handler_copy(module->ldb, ctx, val, &out);
+ } else {
+ guid = talloc(ctx, struct GUID);
+ if (guid == NULL) {
+ return out;
+ }
+ status = ndr_pull_struct_blob(val, guid, guid,
+ (ndr_pull_flags_fn_t)ndr_pull_GUID);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(guid);
+ return out;
+ }
+ out = data_blob_string_const(GUID_string(ctx, guid));
talloc_free(guid);
- return out;
}
- out = data_blob_string_const(GUID_string(ctx, guid));
- talloc_free(guid);
return out;
}
@@ -179,7 +182,7 @@ const struct ldb_map_attribute entryUUID_attributes[] =
.u = {
.convert = {
.remote_name = "entryUUID",
- .convert_local = decode_guid,
+ .convert_local = guid_always_string,
.convert_remote = encode_guid,
},
},