summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-02-08 00:04:20 +0100
committerGünther Deschner <gd@samba.org>2011-02-08 09:52:56 +0100
commitbe5edba117d3af9c9289bc5d37e7e037cb0a05f1 (patch)
treebf97dc0608c0ce7076d22d564089f5cc66087f0e
parent84dbc2a82de0531c49fa7aa16fbdf8aba6324aac (diff)
downloadsamba-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
-rw-r--r--librpc/ndr/libndr.h3
-rw-r--r--librpc/ndr/uuid.c17
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/lib/netapi/samr.c6
-rw-r--r--source3/lib/util.c17
-rw-r--r--source4/torture/rpc/spoolss_access.c7
6 files changed, 23 insertions, 30 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);
+}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 01c450c075..a50917762f 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1186,9 +1186,6 @@ void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const c
void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
void *talloc_zeronull(const void *context, size_t size, const char *name);
-bool is_valid_policy_hnd(const struct policy_handle *hnd);
-bool policy_hnd_equal(const struct policy_handle *hnd1,
- const struct policy_handle *hnd2);
const char *strip_hostname(const char *s);
bool tevent_req_poll_ntstatus(struct tevent_req *req,
struct tevent_context *ev,
diff --git a/source3/lib/netapi/samr.c b/source3/lib/netapi/samr.c
index 470e5e613c..f859c529f1 100644
--- a/source3/lib/netapi/samr.c
+++ b/source3/lib/netapi/samr.c
@@ -270,7 +270,7 @@ void libnetapi_samr_close_domain_handle(struct libnetapi_ctx *ctx,
priv = talloc_get_type_abort(ctx->private_data,
struct libnetapi_private_ctx);
- if (!policy_hnd_equal(handle, &priv->samr.domain_handle)) {
+ if (!policy_handle_equal(handle, &priv->samr.domain_handle)) {
return;
}
@@ -298,7 +298,7 @@ void libnetapi_samr_close_builtin_handle(struct libnetapi_ctx *ctx,
priv = talloc_get_type_abort(ctx->private_data,
struct libnetapi_private_ctx);
- if (!policy_hnd_equal(handle, &priv->samr.builtin_handle)) {
+ if (!policy_handle_equal(handle, &priv->samr.builtin_handle)) {
return;
}
@@ -326,7 +326,7 @@ void libnetapi_samr_close_connect_handle(struct libnetapi_ctx *ctx,
priv = talloc_get_type_abort(ctx->private_data,
struct libnetapi_private_ctx);
- if (!policy_hnd_equal(handle, &priv->samr.connect_handle)) {
+ if (!policy_handle_equal(handle, &priv->samr.connect_handle)) {
return;
}
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 4baeda4d0a..08a24ec722 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2918,23 +2918,6 @@ void *talloc_zeronull(const void *context, size_t size, const char *name)
}
#endif
-bool is_valid_policy_hnd(const struct policy_handle *hnd)
-{
- struct policy_handle tmp;
- ZERO_STRUCT(tmp);
- return (memcmp(&tmp, hnd, sizeof(tmp)) != 0);
-}
-
-bool policy_hnd_equal(const struct policy_handle *hnd1,
- const struct policy_handle *hnd2)
-{
- if (!hnd1 || !hnd2) {
- return false;
- }
-
- return (memcmp(hnd1, hnd2, sizeof(*hnd1)) == 0);
-}
-
/****************************************************************
strip off leading '\\' from a hostname
****************************************************************/
diff --git a/source4/torture/rpc/spoolss_access.c b/source4/torture/rpc/spoolss_access.c
index c32c5c108e..a935cbd3c3 100644
--- a/source4/torture/rpc/spoolss_access.c
+++ b/source4/torture/rpc/spoolss_access.c
@@ -100,13 +100,6 @@ static bool test_openprinter_handle(struct torture_context *tctx,
return true;
}
-static bool is_valid_policy_hnd(const struct policy_handle *hnd)
-{
- struct policy_handle tmp;
- ZERO_STRUCT(tmp);
- return (memcmp(&tmp, hnd, sizeof(tmp)) != 0);
-}
-
static bool test_openprinter_access(struct torture_context *tctx,
struct dcerpc_pipe *p,
const char *name,