diff options
author | Günther Deschner <gd@samba.org> | 2011-02-08 00:04:20 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-02-08 09:52:56 +0100 |
commit | be5edba117d3af9c9289bc5d37e7e037cb0a05f1 (patch) | |
tree | bf97dc0608c0ce7076d22d564089f5cc66087f0e /librpc | |
parent | 84dbc2a82de0531c49fa7aa16fbdf8aba6324aac (diff) | |
download | samba-be5edba117d3af9c9289bc5d37e7e037cb0a05f1.tar.gz samba-be5edba117d3af9c9289bc5d37e7e037cb0a05f1.tar.bz2 samba-be5edba117d3af9c9289bc5d37e7e037cb0a05f1.zip |
libndr: share some uuid helpers.
Guenther
Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Tue Feb 8 09:52:56 CET 2011 on sn-devel-104
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/ndr/libndr.h | 3 | ||||
-rw-r--r-- | librpc/ndr/uuid.c | 17 |
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); +} |