Add tldap_pull_guid
authorVolker Lendecke <vl@samba.org>
Mon, 29 Jun 2009 20:11:23 +0000 (22:11 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 4 Jul 2009 10:54:22 +0000 (12:54 +0200)
source3/include/tldap_util.h
source3/lib/tldap_util.c

index f257afc0b02f27b2ade5eee9ced46595f30036b1..2e0da85f53357207a9a12da967d11ffa968e0a8b 100644 (file)
@@ -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);
index 73ce854651566479a32fac76e0fb7e68a0ee9203..f9f54aaf4d43f4f8f96ea7ba307b0d74c8958afa 100644 (file)
@@ -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)
 {