summaryrefslogtreecommitdiff
path: root/source4/rpc_server/samr/samdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/rpc_server/samr/samdb.c')
-rw-r--r--source4/rpc_server/samr/samdb.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/rpc_server/samr/samdb.c b/source4/rpc_server/samr/samdb.c
index 12319cf84a..ed76a4fc60 100644
--- a/source4/rpc_server/samr/samdb.c
+++ b/source4/rpc_server/samr/samdb.c
@@ -380,6 +380,28 @@ struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, struct ldb_message *ms
}
/*
+ pull a guid structure from a objectGUID in a result set.
+*/
+struct GUID samdb_result_guid(struct ldb_message *msg, const char *attr)
+{
+ NTSTATUS status;
+ struct GUID guid;
+ const char *guidstr = ldb_msg_find_string(msg, attr, NULL);
+
+ ZERO_STRUCT(guid);
+
+ if (!guidstr) return guid;
+
+ status = GUID_from_string(guidstr, &guid);
+ if (!NT_STATUS_IS_OK(status)) {
+ ZERO_STRUCT(guid);
+ return guid;
+ }
+
+ return guid;
+}
+
+/*
pull a sid prefix from a objectSid in a result set.
this is used to find the domain sid for a user
*/