summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-12-18 14:54:57 +0000
committerJelmer Vernooij <jelmer@samba.org>2008-12-18 14:54:57 +0000
commitd14c8604653d39dd25736279d34930ee7a3ae103 (patch)
tree626f700b9b42b798ed7459a5cba5cd27aca9753e /source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
parent0c0b9c738f0fc1bf8aa64533a5e4e0635b84f58f (diff)
parentfc31f2c5269fd405be96b9a036baf35a60141ccf (diff)
downloadsamba-d14c8604653d39dd25736279d34930ee7a3ae103.tar.gz
samba-d14c8604653d39dd25736279d34930ee7a3ae103.tar.bz2
samba-d14c8604653d39dd25736279d34930ee7a3ae103.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba into pyregistry
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/simple_ldap_map.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/simple_ldap_map.c51
1 files changed, 11 insertions, 40 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
index c353914e2c..0e42f7869a 100644
--- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
+++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
@@ -44,7 +44,7 @@ struct entryuuid_private {
static struct ldb_val encode_guid(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
{
struct GUID guid;
- NTSTATUS status = GUID_from_string((char *)val->data, &guid);
+ NTSTATUS status = GUID_from_data_blob(val, &guid);
enum ndr_err_code ndr_err;
struct ldb_val out = data_blob(NULL, 0);
@@ -62,27 +62,13 @@ static struct ldb_val encode_guid(struct ldb_module *module, TALLOC_CTX *ctx, co
static struct ldb_val guid_always_string(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
{
- struct GUID *guid;
struct ldb_val out = data_blob(NULL, 0);
- if (val->length >= 32 && val->data[val->length] == '\0') {
- ldb_handler_copy(module->ldb, ctx, val, &out);
- } else {
- enum ndr_err_code ndr_err;
-
- guid = talloc(ctx, struct GUID);
- if (guid == NULL) {
- return out;
- }
- ndr_err = ndr_pull_struct_blob(val, guid, NULL, guid,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- talloc_free(guid);
- return out;
- }
- out = data_blob_string_const(GUID_string(ctx, guid));
- talloc_free(guid);
+ struct GUID guid;
+ NTSTATUS status = GUID_from_data_blob(val, &guid);
+ if (!NT_STATUS_IS_OK(status)) {
+ return out;
}
- return out;
+ return data_blob_string_const(GUID_string(ctx, &guid));
}
static struct ldb_val encode_ns_guid(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
@@ -107,27 +93,12 @@ static struct ldb_val encode_ns_guid(struct ldb_module *module, TALLOC_CTX *ctx,
static struct ldb_val guid_ns_string(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
{
struct ldb_val out = data_blob(NULL, 0);
- if (val->length >= 32 && val->data[val->length] == '\0') {
- struct GUID guid;
- GUID_from_string((char *)val->data, &guid);
- out = data_blob_string_const(NS_GUID_string(ctx, &guid));
- } else {
- enum ndr_err_code ndr_err;
- struct GUID *guid_p;
- guid_p = talloc(ctx, struct GUID);
- if (guid_p == NULL) {
- return out;
- }
- ndr_err = ndr_pull_struct_blob(val, guid_p, NULL, guid_p,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- talloc_free(guid_p);
- return out;
- }
- out = data_blob_string_const(NS_GUID_string(ctx, guid_p));
- talloc_free(guid_p);
+ struct GUID guid;
+ NTSTATUS status = GUID_from_data_blob(val, &guid);
+ if (!NT_STATUS_IS_OK(status)) {
+ return out;
}
- return out;
+ return data_blob_string_const(NS_GUID_string(ctx, &guid));
}
/* The backend holds binary sids, so just copy them back */