[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Thu Jan 27 07:29:01 MST 2011
The branch, master has been updated
via dbb184a s4-torture: Reorder the epmapper tests.
via 3e29bb0 s4-torture: Added a full epm_Map test.
via 357fd2c s4-torture: Added a test_Insert for epmapper.
via 43f766d s4-torture: Use binding handle in epm_Delete test.
via fed2b61 s4-torture: Comment out the test_InqObject.
via dd9feec s4-torture: Added a clean test_Map_simple.
via c3c6506 s4-torture: Added a clean test_Lookup_terminate_search.
via 548c712 s4-torture: Added a clean test_Lookup_simple.
via 0ccb374 s4-torture: Added test_LookupHandleFree.
via 9a771f1 s4-torture: Start with a clean epm_Insert_noreplace test.
via 6cb2fb1 s4-selftest: Mark epmapper as knownfail.
via eacc9d6 idl: Added missing endpoint mapper defines.
via da3e057 librpc: Added support to accept netbios names.
from 9d04f2b s3-build: remove another leftover of -I../source4.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit dbb184ab7b354768f956ef2df29ba1be8177c41e
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jan 26 14:18:15 2011 +0100
s4-torture: Reorder the epmapper tests.
It works like a stack!
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Thu Jan 27 15:28:05 CET 2011 on sn-devel-104
commit 3e29bb0b925051aa2398bff6eef7b01ea9ca6e2f
Author: Andreas Schneider <asn at samba.org>
Date: Tue Jan 25 18:49:32 2011 +0100
s4-torture: Added a full epm_Map test.
commit 357fd2cecc6ee1cd0eb8b3d377454d3f02825ea1
Author: Andreas Schneider <asn at samba.org>
Date: Tue Jan 25 22:51:26 2011 +0100
s4-torture: Added a test_Insert for epmapper.
commit 43f766dd0494e4b6c52a5e8bdffd5e82740d13ae
Author: Andreas Schneider <asn at samba.org>
Date: Tue Jan 25 22:50:42 2011 +0100
s4-torture: Use binding handle in epm_Delete test.
commit fed2b6167a1c01e2492d03c0293a7cb8994d470d
Author: Andreas Schneider <asn at samba.org>
Date: Tue Jan 18 16:42:34 2011 +0100
s4-torture: Comment out the test_InqObject.
commit dd9feec3df4d4b6c8070467b5a1c85d54f6d7c8e
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jan 12 17:41:05 2011 +0100
s4-torture: Added a clean test_Map_simple.
commit c3c650623a70f3ccc47c235a52eafc92751afd0e
Author: Andreas Schneider <asn at samba.org>
Date: Fri Dec 24 10:35:47 2010 +0100
s4-torture: Added a clean test_Lookup_terminate_search.
commit 548c7120825fe1a1593b87f627223562beb222b2
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 23 20:57:28 2010 +0100
s4-torture: Added a clean test_Lookup_simple.
commit 0ccb374c6a72100560417326538b0642ad6feb18
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 23 13:07:39 2010 +0100
s4-torture: Added test_LookupHandleFree.
commit 9a771f17c84d8dbe8cbb1fdb86631a1fc7c9899b
Author: Andreas Schneider <asn at samba.org>
Date: Tue Oct 5 11:17:31 2010 +0200
s4-torture: Start with a clean epm_Insert_noreplace test.
commit 6cb2fb1c4a997df912940a7a74d0d5dee1ba2756
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jan 26 10:01:26 2011 +0100
s4-selftest: Mark epmapper as knownfail.
commit eacc9d659afa0b2273be350440c506c5ca5b0205
Author: Andreas Schneider <asn at samba.org>
Date: Tue Oct 5 15:32:54 2010 +0200
idl: Added missing endpoint mapper defines.
[MS-RPCE] 2.2.1.2.4 ept_lookup Method
commit da3e057b6fdb40b6cf6bdb61b35467f34024a246
Author: Andreas Schneider <asn at samba.org>
Date: Tue Jan 4 10:11:09 2011 +0100
librpc: Added support to accept netbios names.
If we have a NCACN_NP pipe, the binding host is the netbios name an not
an IP address.
-----------------------------------------------------------------------
Summary of changes:
librpc/idl/epmapper.idl | 33 ++-
librpc/rpc/binding.c | 3 +-
source4/selftest/knownfail | 3 +-
source4/torture/rpc/epmapper.c | 569 +++++++++++++++++++++++++++++++++------
4 files changed, 507 insertions(+), 101 deletions(-)
Changeset truncated at 500 lines:
diff --git a/librpc/idl/epmapper.idl b/librpc/idl/epmapper.idl
index d23b68a..0ce07d8 100644
--- a/librpc/idl/epmapper.idl
+++ b/librpc/idl/epmapper.idl
@@ -35,8 +35,6 @@ interface epmapper
const int EPMAPPER_STATUS_NO_MEMORY = 0x16C9A012;
const int EPMAPPER_STATUS_OK = 0;
-
-
typedef [enum8bit] enum {
/* Level 4 and higher */
@@ -256,17 +254,32 @@ interface epmapper
[in] uint32 num_ents,
[in, size_is(num_ents)] epm_entry_t entries[]
);
-
+
+ typedef [v1_enum] enum {
+ RPC_C_EP_ALL_ELTS = 0x00000000,
+ RPC_C_EP_MATCH_BY_IF = 0x00000001,
+ RPC_C_EP_MATCH_BY_OBJ = 0x00000002,
+ RPC_C_EP_MATCH_BY_BOTH = 0x00000003
+ } epm_InquiryType;
+
+ typedef [v1_enum] enum {
+ RPC_C_VERS_ALL = 0x00000000,
+ RPC_C_VERS_COMPATIBLE = 0x00000001,
+ RPC_C_VERS_EXACT = 0x00000002,
+ RPC_C_VERS_MAJOR_ONLY = 0x00000003,
+ RPC_C_VERS_UPTO = 0x00000004
+ } epm_VersionOption;
+
/**********************/
/* Function 0x02 */
error_status_t epm_Lookup(
- [in] uint32 inquiry_type,
- [in,ptr] GUID *object,
- [in,ptr] rpc_if_id_t *interface_id,
- [in] uint32 vers_option,
- [in,out] policy_handle *entry_handle,
- [in] uint32 max_ents,
- [out] uint32 *num_ents,
+ [in] epm_InquiryType inquiry_type,
+ [in,ptr] GUID *object,
+ [in,ptr] rpc_if_id_t *interface_id,
+ [in] epm_VersionOption vers_option,
+ [in,out] policy_handle *entry_handle,
+ [in] uint32 max_ents,
+ [out] uint32 *num_ents,
[out, length_is(*num_ents), size_is(max_ents)] epm_entry_t entries[]
);
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index 7489073..b7c3a40 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -758,7 +758,8 @@ _PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
/* The 5th contains the network address */
if (num_protocols >= 3 && binding->host) {
- if (is_ipaddress(binding->host)) {
+ if (is_ipaddress(binding->host) ||
+ (binding->host[0] == '\\' && binding->host[1] == '\\')) {
status = dcerpc_floor_set_rhs_data(tower->floors, &tower->floors[4],
binding->host);
} else {
diff --git a/source4/selftest/knownfail b/source4/selftest/knownfail
index 541e861..29ee5b7 100644
--- a/source4/selftest/knownfail
+++ b/source4/selftest/knownfail
@@ -16,8 +16,7 @@ samba4.local.registry.local.security
samba4.rpc.wkssvc
samba4.rpc.handles.*.lsarpc-shared
samba4.rpc.handles.*.mixed-shared
-samba4.rpc.epmapper.*.Insert
-samba4.rpc.epmapper.*.InqObject
+samba4.rpc.epmapper
samba4.rpc.drsuapi.*
samba4.rpc.lsalookup
samba4.rpc.cracknames
diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c
index 2409af1..94e4652 100644
--- a/source4/torture/rpc/epmapper.c
+++ b/source4/torture/rpc/epmapper.c
@@ -23,66 +23,294 @@
#include "librpc/ndr/ndr_table.h"
#include "librpc/rpc/dcerpc_proto.h"
#include "torture/rpc/torture_rpc.h"
-
+#include "lib/util/util_net.h"
/*
display any protocol tower
*/
-static void display_tower(TALLOC_CTX *mem_ctx, struct epm_tower *twr)
+static void display_tower(struct torture_context *tctx, struct epm_tower *twr)
{
int i;
- for (i=0;i<twr->num_floors;i++) {
- printf(" %s", epm_floor_string(mem_ctx, &twr->floors[i]));
+ for (i = 0; i < twr->num_floors; i++) {
+ torture_comment(tctx,
+ " %s",
+ epm_floor_string(tctx, &twr->floors[i]));
+ }
+ torture_comment(tctx, "\n");
+}
+
+static bool test_Insert(struct torture_context *tctx,
+ struct dcerpc_binding_handle *h,
+ struct ndr_syntax_id object,
+ const char *annotation,
+ struct dcerpc_binding *b)
+{
+ struct epm_Insert r;
+ NTSTATUS status;
+
+ r.in.num_ents = 1;
+ r.in.entries = talloc_array(tctx, struct epm_entry_t, 1);
+
+ if (torture_setting_bool(tctx, "samba4", false)) {
+ torture_skip(tctx, "Skip Insert test against Samba4");
+ }
+
+ /* FIXME zero */
+ ZERO_STRUCT(r.in.entries[0].object);
+ r.in.entries[0].annotation = annotation;
+
+ r.in.entries[0].tower = talloc(tctx, struct epm_twr_t);
+
+ status = dcerpc_binding_build_tower(tctx,
+ b,
+ &r.in.entries[0].tower->tower);
+
+ torture_assert_ntstatus_ok(tctx,
+ status,
+ "Unable to build tower from binding struct");
+ r.in.replace = 0;
+
+ /* shoot! */
+ status = dcerpc_epm_Insert_r(h, tctx, &r);
+
+ if (NT_STATUS_IS_ERR(status)) {
+ torture_comment(tctx,
+ "epm_Insert failed - %s\n",
+ nt_errstr(status));
+ return false;
+ }
+
+ if (r.out.result != EPMAPPER_STATUS_OK) {
+ torture_comment(tctx,
+ "epm_Insert failed - internal error: 0x%.4x\n",
+ r.out.result);
+ return false;
+ }
+
+ return true;
+}
+
+static bool test_Delete(struct torture_context *tctx,
+ struct dcerpc_binding_handle *h,
+ const char *annotation,
+ struct dcerpc_binding *b)
+{
+ NTSTATUS status;
+ struct epm_Delete r;
+
+ r.in.num_ents = 1;
+ r.in.entries = talloc_array(tctx, struct epm_entry_t, 1);
+
+ ZERO_STRUCT(r.in.entries[0].object);
+ r.in.entries[0].annotation = annotation;
+
+ r.in.entries[0].tower = talloc(tctx, struct epm_twr_t);
+
+ status = dcerpc_binding_build_tower(tctx,
+ b,
+ &r.in.entries[0].tower->tower);
+
+ torture_assert_ntstatus_ok(tctx,
+ status,
+ "Unable to build tower from binding struct");
+ r.in.num_ents = 1;
+
+ status = dcerpc_epm_Delete_r(h, tctx, &r);
+ if (NT_STATUS_IS_ERR(status)) {
+ torture_comment(tctx,
+ "epm_Delete failed - %s\n",
+ nt_errstr(status));
+ return false;
+ }
+
+ if (r.out.result != EPMAPPER_STATUS_OK) {
+ torture_comment(tctx,
+ "epm_Delete failed - internal error: 0x%.4x\n",
+ r.out.result);
+ return false;
}
- printf("\n");
+
+ return true;
}
+static bool test_Map_tcpip(struct torture_context *tctx,
+ struct dcerpc_binding_handle *h,
+ struct ndr_syntax_id map_syntax)
+{
+ struct epm_Map r;
+ struct GUID uuid;
+ struct policy_handle entry_handle;
+ struct ndr_syntax_id syntax;
+ struct dcerpc_binding map_binding;
+ struct epm_twr_t map_tower;
+ struct epm_twr_p_t towers[20];
+ struct epm_tower t;
+ uint32_t num_towers;
+ uint32_t port;
+ uint32_t i;
+ long int p;
+ const char *tmp;
+ const char *ip;
+ char *ptr;
+ NTSTATUS status;
+
+ torture_comment(tctx, "Testing epm_Map\n");
+
+ ZERO_STRUCT(uuid);
+ ZERO_STRUCT(entry_handle);
+
+ r.in.object = &uuid;
+ r.in.map_tower = &map_tower;
+ r.in.entry_handle = &entry_handle;
+ r.out.entry_handle = &entry_handle;
+ r.in.max_towers = 10;
+ r.out.towers = towers;
+ r.out.num_towers = &num_towers;
+
+ /* Create map tower */
+ map_binding.transport = NCACN_IP_TCP;
+ map_binding.object = map_syntax;
+ map_binding.host = "0.0.0.0";
+ map_binding.endpoint = "135";
+
+ status = dcerpc_binding_build_tower(tctx, &map_binding,
+ &map_tower.tower);
+ torture_assert_ntstatus_ok(tctx, status,
+ "epm_Map_tcpip failed: can't create map_tower");
+
+ torture_comment(tctx,
+ "epm_Map request for '%s':\n",
+ ndr_interface_name(&map_syntax.uuid, map_syntax.if_version));
+ display_tower(tctx, &r.in.map_tower->tower);
+
+ status = dcerpc_epm_Map_r(h, tctx, &r);
+
+ torture_assert_ntstatus_ok(tctx, status, "epm_Map_simple failed");
+ torture_assert(tctx, r.out.result == EPMAPPER_STATUS_OK,
+ "epm_Map_tcpip failed: result is not EPMAPPER_STATUS_OK");
+
+ /* Check the result */
+ t = r.out.towers[0].twr->tower;
+
+ /* Check if we got the correct RPC interface identifier */
+ dcerpc_floor_get_lhs_data(&t.floors[0], &syntax);
+ torture_assert(tctx, ndr_syntax_id_equal(&syntax, &map_syntax),
+ "epm_Map_tcpip failed: Interface identifier mismatch");
+
+ torture_comment(tctx,
+ "epm_Map_tcpip response for '%s':\n",
+ ndr_interface_name(&syntax.uuid, syntax.if_version));
+
+ dcerpc_floor_get_lhs_data(&t.floors[1], &syntax);
+ torture_assert(tctx, ndr_syntax_id_equal(&syntax, &ndr_transfer_syntax),
+ "epm_Map_tcpip failed: floor 2 is not NDR encoded");
+
+ torture_assert(tctx, t.floors[2].lhs.protocol == EPM_PROTOCOL_NCACN,
+ "epm_Map_tcpip failed: floor 3 is not NCACN_IP_TCP");
+
+ tmp = dcerpc_floor_get_rhs_data(tctx, &t.floors[3]);
+ p = strtol(tmp, &ptr, 10);
+ port = p & 0xffff;
+ torture_assert(tctx, port > 1024 && port < 65535, "epm_Map_tcpip failed");
+
+ ip = dcerpc_floor_get_rhs_data(tctx, &t.floors[4]);
+ torture_assert(tctx, is_ipaddress(ip), "epm_Map_tcpip failed");
+
+ for (i = 0; i < *r.out.num_towers; i++) {
+ if (r.out.towers[i].twr) {
+ display_tower(tctx, &t);
+ }
+ }
+
+ return true;
+}
+
+static bool test_Map_full(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
+{
+ const struct ndr_syntax_id obj = {
+ { 0x8a885d04, 0x1ceb, 0x11c9, {0x9f, 0xe8}, {0x08,0x00,0x2b,0x10,0x48,0x60} },
+ 2
+ };
+ struct dcerpc_binding_handle *h = p->binding_handle;
+ const char *annotation = "SMBTORTURE";
+ struct dcerpc_binding *b;
+ NTSTATUS status;
+ bool ok;
+
+ status = dcerpc_parse_binding(tctx, "ncacn_ip_tcp:216.83.154.106[41768]", &b);
+ torture_assert_ntstatus_ok(tctx,
+ status,
+ "Unable to generate dcerpc_binding struct");
+ b->object = obj;
+
+ ok = test_Insert(tctx, h, obj, annotation, b);
+ if (!ok) {
+ return false;
+ }
+
+ ok = test_Map_tcpip(tctx, h, obj);
+ if (!ok) {
+ return false;
+ }
+
+ ok = test_Delete(tctx, h, annotation, b);
+ if (!ok) {
+ return false;
+ }
+
+ return true;
+}
-static bool test_Map(struct dcerpc_binding_handle *b,
- TALLOC_CTX *mem_ctx,
- struct epm_twr_t *twr)
+static bool test_Map_display(struct dcerpc_binding_handle *b,
+ struct torture_context *tctx,
+ struct epm_twr_t *twr)
{
NTSTATUS status;
struct epm_Map r;
struct GUID uuid;
struct policy_handle handle;
- int i;
struct ndr_syntax_id syntax;
uint32_t num_towers;
+ uint32_t i;
ZERO_STRUCT(uuid);
ZERO_STRUCT(handle);
r.in.object = &uuid;
r.in.map_tower = twr;
- r.in.entry_handle = &handle;
+ r.in.entry_handle = &handle;
r.out.entry_handle = &handle;
- r.in.max_towers = 100;
+ r.in.max_towers = 10;
r.out.num_towers = &num_towers;
dcerpc_floor_get_lhs_data(&twr->tower.floors[0], &syntax);
- printf("epm_Map results for '%s':\n",
- ndr_interface_name(&syntax.uuid, syntax.if_version));
+ torture_comment(tctx,
+ "epm_Map results for '%s':\n",
+ ndr_interface_name(&syntax.uuid, syntax.if_version));
+ /* RPC protocol identifier */
twr->tower.floors[2].lhs.protocol = EPM_PROTOCOL_NCACN;
twr->tower.floors[2].lhs.lhs_data = data_blob(NULL, 0);
twr->tower.floors[2].rhs.ncacn.minor_version = 0;
+ /* Port address */
twr->tower.floors[3].lhs.protocol = EPM_PROTOCOL_TCP;
twr->tower.floors[3].lhs.lhs_data = data_blob(NULL, 0);
twr->tower.floors[3].rhs.tcp.port = 0;
+ /* Transport */
twr->tower.floors[4].lhs.protocol = EPM_PROTOCOL_IP;
twr->tower.floors[4].lhs.lhs_data = data_blob(NULL, 0);
twr->tower.floors[4].rhs.ip.ipaddr = "0.0.0.0";
- status = dcerpc_epm_Map_r(b, mem_ctx, &r);
+ status = dcerpc_epm_Map_r(b, tctx, &r);
if (NT_STATUS_IS_OK(status) && r.out.result == 0) {
for (i=0;i<*r.out.num_towers;i++) {
if (r.out.towers[i].twr) {
- display_tower(mem_ctx, &r.out.towers[i].twr->tower);
+ display_tower(tctx, &r.out.towers[i].twr->tower);
}
}
}
@@ -91,11 +319,11 @@ static bool test_Map(struct dcerpc_binding_handle *b,
twr->tower.floors[3].lhs.lhs_data = data_blob(NULL, 0);
twr->tower.floors[3].rhs.http.port = 0;
- status = dcerpc_epm_Map_r(b, mem_ctx, &r);
+ status = dcerpc_epm_Map_r(b, tctx, &r);
if (NT_STATUS_IS_OK(status) && r.out.result == 0) {
for (i=0;i<*r.out.num_towers;i++) {
if (r.out.towers[i].twr) {
- display_tower(mem_ctx, &r.out.towers[i].twr->tower);
+ display_tower(tctx, &r.out.towers[i].twr->tower);
}
}
}
@@ -104,11 +332,11 @@ static bool test_Map(struct dcerpc_binding_handle *b,
twr->tower.floors[3].lhs.lhs_data = data_blob(NULL, 0);
twr->tower.floors[3].rhs.http.port = 0;
- status = dcerpc_epm_Map_r(b, mem_ctx, &r);
+ status = dcerpc_epm_Map_r(b, tctx, &r);
if (NT_STATUS_IS_OK(status) && r.out.result == 0) {
for (i=0;i<*r.out.num_towers;i++) {
if (r.out.towers[i].twr) {
- display_tower(mem_ctx, &r.out.towers[i].twr->tower);
+ display_tower(tctx, &r.out.towers[i].twr->tower);
}
}
}
@@ -121,134 +349,282 @@ static bool test_Map(struct dcerpc_binding_handle *b,
twr->tower.floors[4].lhs.lhs_data = data_blob(NULL, 0);
twr->tower.floors[4].rhs.netbios.name = "";
- status = dcerpc_epm_Map_r(b, mem_ctx, &r);
+ status = dcerpc_epm_Map_r(b, tctx, &r);
if (NT_STATUS_IS_OK(status) && r.out.result == 0) {
- for (i=0;i<*r.out.num_towers;i++) {
+ for (i = 0; i < *r.out.num_towers; i++) {
if (r.out.towers[i].twr) {
- display_tower(mem_ctx, &r.out.towers[i].twr->tower);
+ display_tower(tctx, &r.out.towers[i].twr->tower);
}
}
}
/* FIXME: Extend to do other protocols as well (ncacn_unix_stream, ncalrpc) */
-
+
return true;
}
-static bool test_Lookup(struct torture_context *tctx,
- struct dcerpc_pipe *p)
+static bool test_Map_simple(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
{
NTSTATUS status;
struct epm_Lookup r;
- struct GUID uuid;
- struct rpc_if_id_t iface;
- struct policy_handle handle;
- uint32_t num_ents;
- struct dcerpc_binding_handle *b = p->binding_handle;
+ struct policy_handle entry_handle;
+ uint32_t num_ents = 0;
+ struct dcerpc_binding_handle *h = p->binding_handle;
- ZERO_STRUCT(handle);
+ ZERO_STRUCT(entry_handle);
- r.in.inquiry_type = 0;
- r.in.object = &uuid;
- r.in.interface_id = &iface;
- r.in.vers_option = 0;
- r.in.entry_handle = &handle;
- r.out.entry_handle = &handle;
+ torture_comment(tctx, "Testing epm_Map\n");
+
+ /* get all elements */
+ r.in.inquiry_type = RPC_C_EP_ALL_ELTS;
+ r.in.object = NULL;
+ r.in.interface_id = NULL;
+ r.in.vers_option = RPC_C_VERS_ALL;
+
+ r.in.entry_handle = &entry_handle;
r.in.max_ents = 10;
+
+ r.out.entry_handle = &entry_handle;
r.out.num_ents = &num_ents;
do {
int i;
- ZERO_STRUCT(uuid);
- ZERO_STRUCT(iface);
-
- status = dcerpc_epm_Lookup_r(b, tctx, &r);
- if (!NT_STATUS_IS_OK(status) || r.out.result != 0) {
+ status = dcerpc_epm_Lookup_r(h, tctx, &r);
+ if (!NT_STATUS_IS_OK(status) ||
+ r.out.result != EPMAPPER_STATUS_OK) {
break;
}
- printf("epm_Lookup returned %d events GUID %s\n",
--
Samba Shared Repository
More information about the samba-cvs
mailing list