summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
Diffstat (limited to 'librpc')
-rw-r--r--librpc/ndr/libndr.h3
-rw-r--r--librpc/ndr/uuid.c17
2 files changed, 20 insertions, 0 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index 314df35907..f62153596d 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -506,6 +506,9 @@ enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, st
enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r);
void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r);
bool policy_handle_empty(struct policy_handle *h);
+bool is_valid_policy_hnd(const struct policy_handle *hnd);
+bool policy_handle_equal(const struct policy_handle *hnd1,
+ const struct policy_handle *hnd2);
void ndr_check_padding(struct ndr_pull *ndr, size_t n);
enum ndr_err_code ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v);
diff --git a/librpc/ndr/uuid.c b/librpc/ndr/uuid.c
index 33a7eeeb5a..b6a7fc7071 100644
--- a/librpc/ndr/uuid.c
+++ b/librpc/ndr/uuid.c
@@ -335,3 +335,20 @@ _PUBLIC_ bool policy_handle_empty(struct policy_handle *h)
{
return (h->handle_type == 0 && GUID_all_zero(&h->uuid));
}
+
+_PUBLIC_ bool is_valid_policy_hnd(const struct policy_handle *hnd)
+{
+ struct policy_handle tmp;
+ ZERO_STRUCT(tmp);
+ return (memcmp(&tmp, hnd, sizeof(tmp)) != 0);
+}
+
+_PUBLIC_ bool policy_handle_equal(const struct policy_handle *hnd1,
+ const struct policy_handle *hnd2)
+{
+ if (!hnd1 || !hnd2) {
+ return false;
+ }
+
+ return (memcmp(hnd1, hnd2, sizeof(*hnd1)) == 0);
+}