From bc1e93cc80874dd89ade863e38effda80a99fd47 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 29 Jun 2009 22:11:23 +0200 Subject: Add tldap_pull_guid --- source3/include/tldap_util.h | 2 ++ source3/lib/tldap_util.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/source3/include/tldap_util.h b/source3/include/tldap_util.h index f257afc0b0..2e0da85f53 100644 --- a/source3/include/tldap_util.h +++ b/source3/include/tldap_util.h @@ -31,6 +31,8 @@ char *tldap_talloc_single_attribute(struct tldap_message *msg, TALLOC_CTX *mem_ctx); bool tldap_pull_binsid(struct tldap_message *msg, const char *attribute, struct dom_sid *sid); +bool tldap_pull_guid(struct tldap_message *msg, const char *attribute, + struct GUID *guid); bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods, int mod_op, const char *attrib, int num_values, DATA_BLOB *values); diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c index 73ce854651..f9f54aaf4d 100644 --- a/source3/lib/tldap_util.c +++ b/source3/lib/tldap_util.c @@ -91,6 +91,17 @@ bool tldap_pull_binsid(struct tldap_message *msg, const char *attribute, return sid_parse((char *)val.data, val.length, sid); } +bool tldap_pull_guid(struct tldap_message *msg, const char *attribute, + struct GUID *guid) +{ + DATA_BLOB val; + + if (!tldap_get_single_valueblob(msg, attribute, &val)) { + return false; + } + return NT_STATUS_IS_OK(GUID_from_data_blob(&val, guid)); +} + static bool tldap_add_blob_vals(TALLOC_CTX *mem_ctx, struct tldap_mod *mod, int num_newvals, DATA_BLOB *newvals) { -- cgit