[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Fri Dec 23 04:18:04 MST 2011


The branch, master has been updated
       via  31db5e6 s4:torture/rpc/netlogon.c - factor out the computer name check in an own test
       via  9a91d7f s4:netlogon RPC server - dcesrv_netr_DsRGetSiteName - add a small explaination
       via  2bc7b8f s4:libcli/finddcs_nbt.c - free "req" consistently with "finddcs_cldap.c"
       via  eddf0d0 ldb:ldb_tdb.c - fix warnings in "ltdb_init_rootdse"
      from  601f382 s4:drsuapi/getncchanges: the default for isRecycled is FALSE

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 31db5e667bbb388b75a5dc1790facf85d4daf629
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Thu Nov 24 17:38:14 2011 +0100

    s4:torture/rpc/netlogon.c - factor out the computer name check in an own test
    
    This check is by no ways specific to "DsRGetSiteName" and hence it should
    be factored out in an own function.
    Samba at the moment does not implement the expected behaviour so I have
    added the "torture_skip" action.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Fri Dec 23 12:17:48 CET 2011 on sn-devel-104

commit 9a91d7f05a702ea47495b254049a7ec409212d1b
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Thu Nov 24 17:03:00 2011 +0100

    s4:netlogon RPC server - dcesrv_netr_DsRGetSiteName - add a small explaination
    
    NETLOGON pipe is only thought for DCs.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 2bc7b8f4c9992f5f825d8328e0353f793d7e7ebf
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Thu Dec 22 16:49:48 2011 +0100

    s4:libcli/finddcs_nbt.c - free "req" consistently with "finddcs_cldap.c"
    
    It is more obvious to free where the context for the first time appears.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit eddf0d0fe277cc763bbe0bb4706ab1a4aebf8151
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Thu Dec 22 11:50:49 2011 +0100

    ldb:ldb_tdb.c - fix warnings in "ltdb_init_rootdse"
    
    We should ignore the LDB result.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb/ldb_tdb/ldb_tdb.c                     |    8 +---
 source4/libcli/finddcs_nbt.c                  |    6 ++-
 source4/rpc_server/netlogon/dcerpc_netlogon.c |    5 ++
 source4/torture/rpc/netlogon.c                |   72 +++++++++++++++++++++----
 4 files changed, 71 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
index a85e41d..ebde8a3 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -1418,14 +1418,8 @@ static int ltdb_handle_request(struct ldb_module *module,
 
 static int ltdb_init_rootdse(struct ldb_module *module)
 {
-	struct ldb_context *ldb;
-	int ret;
-
-	ldb = ldb_module_get_ctx(module);
-
-	ret = ldb_mod_register_control(module,
-				       LDB_CONTROL_PERMISSIVE_MODIFY_OID);
 	/* ignore errors on this - we expect it for non-sam databases */
+	ldb_mod_register_control(module, LDB_CONTROL_PERMISSIVE_MODIFY_OID);
 
 	/* there can be no module beyond the backend, just return */
 	return LDB_SUCCESS;
diff --git a/source4/libcli/finddcs_nbt.c b/source4/libcli/finddcs_nbt.c
index 9579a9e..6a5d1fd 100644
--- a/source4/libcli/finddcs_nbt.c
+++ b/source4/libcli/finddcs_nbt.c
@@ -284,7 +284,6 @@ NTSTATUS finddcs_nbt_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 		*num_dcs = state->num_dcs;
 		*dcs = talloc_steal(mem_ctx, state->dcs);
 	}
-	talloc_free(req);
 	return status;
 }
 
@@ -298,6 +297,7 @@ NTSTATUS finddcs_nbt(TALLOC_CTX *mem_ctx,
 		 struct imessaging_context *msg_ctx,
 		 int *num_dcs, struct nbt_dc_name **dcs)
 {
+	NTSTATUS status;
 	struct tevent_req *req = finddcs_nbt_send(mem_ctx,
 					      my_netbios_name,
 					      nbt_port,
@@ -305,5 +305,7 @@ NTSTATUS finddcs_nbt(TALLOC_CTX *mem_ctx,
 					      domain_sid,
 					      resolve_ctx,
 					      event_ctx, msg_ctx);
-	return finddcs_nbt_recv(req, mem_ctx, num_dcs, dcs);
+	status = finddcs_nbt_recv(req, mem_ctx, num_dcs, dcs);
+	talloc_free(req);
+	return status;
 }
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 125fb38..6d6cfe0 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -1296,6 +1296,11 @@ static WERROR dcesrv_netr_DsRGetSiteName(struct dcesrv_call_state *dce_call, TAL
 		return WERR_DS_UNAVAILABLE;
 	}
 
+	/*
+	 * We assume to be a DC when we get called over NETLOGON. Hence we
+	 * get our site name always by using "samdb_server_site_name()"
+	 * and not "samdb_client_site_name()".
+	 */
 	*r->out.site = samdb_server_site_name(sam_ctx, mem_ctx);
 	W_ERROR_HAVE_NO_MEMORY(*r->out.site);
 
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index d60b2e3..ab9ef02 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -40,6 +40,64 @@
 
 #define TEST_MACHINE_NAME "torturetest"
 
+static bool test_netr_broken_binding_handle(struct torture_context *tctx,
+					    struct dcerpc_pipe *p)
+{
+	NTSTATUS status;
+	struct netr_DsRGetSiteName r;
+	const char *site = NULL;
+	struct dcerpc_binding_handle *b = p->binding_handle;
+
+	r.in.computer_name	= talloc_asprintf(tctx, "\\\\%s",
+						  dcerpc_server_name(p));
+	r.out.site		= &site;
+
+	torture_comment(tctx,
+			"Testing netlogon request with correct binding handle: %s\n",
+			r.in.computer_name);
+
+	status = dcerpc_netr_DsRGetSiteName_r(b, tctx, &r);
+	torture_assert_ntstatus_ok(tctx, status,
+				   "Netlogon request with broken binding handle");
+	torture_assert_werr_ok(tctx, r.out.result,
+			       "Netlogon request with broken binding handle");
+
+	if (torture_setting_bool(tctx, "samba3", false) ||
+	    torture_setting_bool(tctx, "samba4", false)) {
+		torture_skip(tctx,
+			     "Skipping broken binding handle check against Samba");
+	}
+
+	r.in.computer_name	= talloc_asprintf(tctx, "\\\\\\\\%s",
+						  dcerpc_server_name(p));
+
+	torture_comment(tctx,
+			"Testing netlogon request with broken binding handle: %s\n",
+			r.in.computer_name);
+
+	status = dcerpc_netr_DsRGetSiteName_r(b, tctx, &r);
+	torture_assert_ntstatus_ok(tctx, status,
+				   "Netlogon request with broken binding handle");
+	torture_assert_werr_equal(tctx, r.out.result,
+				  WERR_INVALID_COMPUTERNAME,
+				  "Netlogon request with broken binding handle");
+
+	r.in.computer_name	= "\\\\\\\\THIS_IS_NOT_VALID";
+
+	torture_comment(tctx,
+			"Testing netlogon request with broken binding handle: %s\n",
+			r.in.computer_name);
+
+	status = dcerpc_netr_DsRGetSiteName_r(b, tctx, &r);
+	torture_assert_ntstatus_ok(tctx, status,
+				   "Netlogon request with broken binding handle");
+	torture_assert_werr_equal(tctx, r.out.result,
+				  WERR_INVALID_COMPUTERNAME,
+				  "Netlogon request with broken binding handle");
+
+	return true;
+}
+
 static bool test_LogonUasLogon(struct torture_context *tctx, 
 			       struct dcerpc_pipe *p)
 {
@@ -2398,17 +2456,6 @@ static bool test_netr_DsRGetSiteName(struct dcerpc_pipe *p, struct torture_conte
 	torture_assert_werr_ok(tctx, r.out.result, "DsRGetSiteName");
 	torture_assert_str_equal(tctx, expected_site, site, "netr_DsRGetSiteName");
 
-	if (torture_setting_bool(tctx, "samba4", false))
-		torture_skip(tctx, "skipping computer name check against Samba4");
-
-	r.in.computer_name		= talloc_asprintf(tctx, "\\\\%s", computer_name);
-	torture_comment(tctx, 
-			"Testing netr_DsRGetSiteName with broken computer name: %s\n", r.in.computer_name);
-
-	status = dcerpc_netr_DsRGetSiteName_r(b, tctx, &r);
-	torture_assert_ntstatus_ok(tctx, status, "DsRGetSiteName");
-	torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_COMPUTERNAME, "netr_DsRGetSiteName");
-
 	return true;
 }
 
@@ -3652,6 +3699,9 @@ struct torture_suite *torture_rpc_netlogon(TALLOC_CTX *mem_ctx)
 	tcase = torture_suite_add_machine_bdc_rpc_iface_tcase(suite, "netlogon",
 						  &ndr_table_netlogon, TEST_MACHINE_NAME);
 
+	torture_rpc_tcase_add_test(tcase, "Broken RPC binding handle",
+				   test_netr_broken_binding_handle);
+
 	torture_rpc_tcase_add_test(tcase, "LogonUasLogon", test_LogonUasLogon);
 	torture_rpc_tcase_add_test(tcase, "LogonUasLogoff", test_LogonUasLogoff);
 	torture_rpc_tcase_add_test_creds(tcase, "SamLogon", test_SamLogon);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list