[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Tue Feb 8 01:53:02 MST 2011
The branch, master has been updated
via be5edba libndr: share some uuid helpers.
via 84dbc2a ndr: merge ndr_map_error2string and ndr_errstr.
via 8b55ae1 ndr: move null_ndr_syntax_id to the common libndr location.
via 724c982 ndr: merge duplicate ndr_map_error2ntstatus() functions.
from e68f6ad If possible (O_DIRECTORY exists) open an fd for a directory open.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit be5edba117d3af9c9289bc5d37e7e037cb0a05f1
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 8 00:04:20 2011 +0100
libndr: share some uuid helpers.
Guenther
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Tue Feb 8 09:52:56 CET 2011 on sn-devel-104
commit 84dbc2a82de0531c49fa7aa16fbdf8aba6324aac
Author: Günther Deschner <gd at samba.org>
Date: Mon Feb 7 23:27:57 2011 +0100
ndr: merge ndr_map_error2string and ndr_errstr.
Guenther
commit 8b55ae178586d25854a929ace05f203d547242ad
Author: Günther Deschner <gd at samba.org>
Date: Mon Feb 7 23:21:41 2011 +0100
ndr: move null_ndr_syntax_id to the common libndr location.
Guenther
commit 724c9821313b5289dc6fa29bbe930c19dfd230fb
Author: Günther Deschner <gd at samba.org>
Date: Fri Jan 28 23:38:21 2011 +0100
ndr: merge duplicate ndr_map_error2ntstatus() functions.
Guenther
-----------------------------------------------------------------------
Summary of changes:
librpc/ndr/libndr.h | 5 ++
librpc/ndr/ndr.c | 5 ++
librpc/ndr/ndr_basic.c | 25 +++++++++
librpc/ndr/uuid.c | 17 ++++++
source3/include/proto.h | 5 --
source3/lib/netapi/samr.c | 6 +-
source3/lib/util.c | 17 ------
source3/librpc/ndr/util.c | 100 ----------------------------------
source4/libcli/util/errormap.c | 26 ---------
source4/torture/rpc/spoolss_access.c | 7 ---
10 files changed, 55 insertions(+), 158 deletions(-)
Changeset truncated at 500 lines:
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index ff20755..f621535 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -328,6 +328,7 @@ typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, cons
extern const struct ndr_syntax_id ndr_transfer_syntax;
extern const struct ndr_syntax_id ndr64_transfer_syntax;
+extern const struct ndr_syntax_id null_ndr_syntax_id;
struct ndr_interface_call {
const char *name;
@@ -362,6 +363,7 @@ struct ndr_interface_list {
*********************************************************************/
NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err);
const char *ndr_map_error2string(enum ndr_err_code ndr_err);
+#define ndr_errstr ndr_map_error2string
/* FIXME: Use represent_as instead */
struct dom_sid;
@@ -504,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/ndr.c b/librpc/ndr/ndr.c
index 63b2cc3..068e07f 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -46,6 +46,11 @@ const struct ndr_syntax_id ndr64_transfer_syntax = {
1
};
+const struct ndr_syntax_id null_ndr_syntax_id = {
+ { 0, 0, 0, { 0, 0 }, { 0, 0, 0, 0, 0, 0 } },
+ 0
+};
+
/*
work out the number of bytes needed to align on a n byte boundary
*/
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index d628faa..1d67e11 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -1213,3 +1213,28 @@ _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool
{
ndr->print(ndr, "%-25s: %s", name, b?"true":"false");
}
+
+_PUBLIC_ NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
+{
+ switch (ndr_err) {
+ case NDR_ERR_SUCCESS:
+ return NT_STATUS_OK;
+ case NDR_ERR_BUFSIZE:
+ return NT_STATUS_BUFFER_TOO_SMALL;
+ case NDR_ERR_TOKEN:
+ return NT_STATUS_INTERNAL_ERROR;
+ case NDR_ERR_ALLOC:
+ return NT_STATUS_NO_MEMORY;
+ case NDR_ERR_ARRAY_SIZE:
+ return NT_STATUS_ARRAY_BOUNDS_EXCEEDED;
+ case NDR_ERR_INVALID_POINTER:
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ case NDR_ERR_UNREAD_BYTES:
+ return NT_STATUS_PORT_MESSAGE_TOO_LONG;
+ default:
+ break;
+ }
+
+ /* we should map all error codes to different status codes */
+ return NT_STATUS_INVALID_PARAMETER;
+}
diff --git a/librpc/ndr/uuid.c b/librpc/ndr/uuid.c
index 33a7eee..b6a7fc7 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 ddb5c5e..a509177 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,
@@ -1585,8 +1582,6 @@ enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const
enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
_PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
-const char *ndr_errstr(enum ndr_err_code err);
-extern const struct ndr_syntax_id null_ndr_syntax_id;
/* The following definitions come from libsmb/cliconnect.c */
diff --git a/source3/lib/netapi/samr.c b/source3/lib/netapi/samr.c
index 470e5e6..f859c52 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 4baeda4..08a24ec 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/source3/librpc/ndr/util.c b/source3/librpc/ndr/util.c
index ed24f87..b55b3d8 100644
--- a/source3/librpc/ndr/util.c
+++ b/source3/librpc/ndr/util.c
@@ -21,103 +21,6 @@
#include "includes.h"
-NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
-{
- switch (ndr_err) {
- case NDR_ERR_SUCCESS:
- return NT_STATUS_OK;
- case NDR_ERR_BUFSIZE:
- return NT_STATUS_BUFFER_TOO_SMALL;
- case NDR_ERR_TOKEN:
- return NT_STATUS_INTERNAL_ERROR;
- case NDR_ERR_ALLOC:
- return NT_STATUS_NO_MEMORY;
- case NDR_ERR_ARRAY_SIZE:
- return NT_STATUS_ARRAY_BOUNDS_EXCEEDED;
- case NDR_ERR_INVALID_POINTER:
- return NT_STATUS_INVALID_PARAMETER_MIX;
- case NDR_ERR_UNREAD_BYTES:
- return NT_STATUS_PORT_MESSAGE_TOO_LONG;
- default:
- break;
- }
-
- /* we should map all error codes to different status codes */
- return NT_STATUS_INVALID_PARAMETER;
-}
-
-/*
- * Convert an ndr error to string
- */
-
-const char *ndr_errstr(enum ndr_err_code err)
-{
- switch (err) {
- case NDR_ERR_SUCCESS:
- return "NDR_ERR_SUCCESS";
- break;
- case NDR_ERR_ARRAY_SIZE:
- return "NDR_ERR_ARRAY_SIZE";
- break;
- case NDR_ERR_BAD_SWITCH:
- return "NDR_ERR_BAD_SWITCH";
- break;
- case NDR_ERR_OFFSET:
- return "NDR_ERR_OFFSET";
- break;
- case NDR_ERR_RELATIVE:
- return "NDR_ERR_RELATIVE";
- break;
- case NDR_ERR_CHARCNV:
- return "NDR_ERR_CHARCNV";
- break;
- case NDR_ERR_LENGTH:
- return "NDR_ERR_LENGTH";
- break;
- case NDR_ERR_SUBCONTEXT:
- return "NDR_ERR_SUBCONTEXT";
- break;
- case NDR_ERR_COMPRESSION:
- return "NDR_ERR_COMPRESSION";
- break;
- case NDR_ERR_STRING:
- return "NDR_ERR_STRING";
- break;
- case NDR_ERR_VALIDATE:
- return "NDR_ERR_VALIDATE";
- break;
- case NDR_ERR_BUFSIZE:
- return "NDR_ERR_BUFSIZE";
- break;
- case NDR_ERR_ALLOC:
- return "NDR_ERR_ALLOC";
- break;
- case NDR_ERR_RANGE:
- return "NDR_ERR_RANGE";
- break;
- case NDR_ERR_TOKEN:
- return "NDR_ERR_TOKEN";
- break;
- case NDR_ERR_IPV4ADDRESS:
- return "NDR_ERR_IPV4ADDRESS";
- break;
- case NDR_ERR_IPV6ADDRESS:
- return "NDR_ERR_IPV6ADDRESS";
- break;
- case NDR_ERR_INVALID_POINTER:
- return "NDR_ERR_INVALID_POINTER";
- break;
- case NDR_ERR_UNREAD_BYTES:
- return "NDR_ERR_UNREAD_BYTES";
- break;
- case NDR_ERR_NDR64:
- return "NDR_ERR_NDR64";
- break;
- }
-
- return talloc_asprintf(talloc_tos(), "Unknown NDR error: %d", err);
-}
-
enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -166,6 +69,3 @@ _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name
char addr[INET6_ADDRSTRLEN];
ndr->print(ndr, "%-25s: %s", name, print_sockaddr(addr, sizeof(addr), ss));
}
-
-const struct ndr_syntax_id null_ndr_syntax_id =
-{ { 0, 0, 0, { 0, 0 }, { 0, 0, 0, 0, 0, 0 } }, 0 };
diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c
index 29f2331..a0154e3 100644
--- a/source4/libcli/util/errormap.c
+++ b/source4/libcli/util/errormap.c
@@ -20,7 +20,6 @@
*/
#include "includes.h"
-#include "librpc/ndr/libndr.h"
/* This map was extracted by the ERRMAPEXTRACT smbtorture command.
The setup was a Samba HEAD (2002-01-03) PDC and an Win2k member
@@ -1388,28 +1387,3 @@ WERROR unix_to_werror(int unix_error)
{
return ntstatus_to_werror(map_nt_error_from_unix(unix_error));
}
-
-NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
-{
- switch (ndr_err) {
- case NDR_ERR_SUCCESS:
- return NT_STATUS_OK;
- case NDR_ERR_BUFSIZE:
- return NT_STATUS_BUFFER_TOO_SMALL;
- case NDR_ERR_TOKEN:
- return NT_STATUS_INTERNAL_ERROR;
- case NDR_ERR_ALLOC:
- return NT_STATUS_NO_MEMORY;
- case NDR_ERR_ARRAY_SIZE:
- return NT_STATUS_ARRAY_BOUNDS_EXCEEDED;
- case NDR_ERR_INVALID_POINTER:
- return NT_STATUS_INVALID_PARAMETER_MIX;
- case NDR_ERR_UNREAD_BYTES:
- return NT_STATUS_PORT_MESSAGE_TOO_LONG;
- default:
- break;
- }
-
- /* we should map all error codes to different status codes */
- return NT_STATUS_INVALID_PARAMETER;
-}
diff --git a/source4/torture/rpc/spoolss_access.c b/source4/torture/rpc/spoolss_access.c
index c32c5c1..a935cbd 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,
--
Samba Shared Repository
More information about the samba-cvs
mailing list