[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Wed Sep 8 11:35:35 MDT 2010


The branch, master has been updated
       via  81ece84 s4-smbtorture: add torture ndr nbt testsuite.
       via  1217809 nbt: add nbt_netlogon_response2 to IDL.
       via  8f8ff8b nbt: add NETLOGON_LOGON_REQUEST.
       via  778950c nbt: add decode_nbt_netlogon_packet() to IDL.
      from  958df10 s3-nmbd: fix indentation in process_logon_packet().

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


- Log -----------------------------------------------------------------
commit 81ece84b789c64243db1661df6c9fa590d19490f
Author: Günther Deschner <gd at samba.org>
Date:   Wed Sep 8 11:18:40 2010 +0200

    s4-smbtorture: add torture ndr nbt testsuite.
    
    Guenther

commit 1217809c465a35b0a2727111d820007097b2b611
Author: Günther Deschner <gd at samba.org>
Date:   Tue Sep 7 22:41:06 2010 +0200

    nbt: add nbt_netlogon_response2 to IDL.
    
    Guenther

commit 8f8ff8bb29cb6f07ddcb310a089b695dbe176b34
Author: Günther Deschner <gd at samba.org>
Date:   Tue Sep 7 13:16:27 2010 +0200

    nbt: add NETLOGON_LOGON_REQUEST.
    
    Guenther

commit 778950ca9322700c10c92b411873309398aa8dd1
Author: Günther Deschner <gd at samba.org>
Date:   Wed Sep 8 11:19:48 2010 +0200

    nbt: add decode_nbt_netlogon_packet() to IDL.
    
    Guenther

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

Summary of changes:
 librpc/idl/nbt.idl            |   26 ++++++++++++++-
 source4/torture/config.mk     |    2 +-
 source4/torture/ndr/nbt.c     |   70 +++++++++++++++++++++++++++++++++++++++++
 source4/torture/ndr/ndr.c     |    1 +
 source4/torture/wscript_build |    2 +-
 5 files changed, 98 insertions(+), 3 deletions(-)
 create mode 100644 source4/torture/ndr/nbt.c


Changeset truncated at 500 lines:

diff --git a/librpc/idl/nbt.idl b/librpc/idl/nbt.idl
index caf6da9..165a55c 100644
--- a/librpc/idl/nbt.idl
+++ b/librpc/idl/nbt.idl
@@ -10,7 +10,9 @@
 
 import "misc.idl", "security.idl", "svcctl.idl", "samr.idl";
 [
-	helper("../libcli/netlogon.h", "../libcli/nbt/libnbt.h")
+	helper("../libcli/netlogon.h", "../libcli/nbt/libnbt.h"),
+	helpstring("NBT messages"),
+	uuid("6def41b6-86e4-4c32-997c-ed33af7bcd8e")
 ]
 interface nbt
 {
@@ -377,6 +379,8 @@ interface nbt
 	} netlogon_nt_version_flags;
 
 	typedef [enum16bit,public] enum {
+		LOGON_REQUEST			  = 0,
+		LOGON_RESPONSE2			  = 6,
 		LOGON_PRIMARY_QUERY               = 7,	/* Was also NETLOGON_QUERY_FOR_PDC */
 		NETLOGON_ANNOUNCE_UAS             = 10,
 		NETLOGON_RESPONSE_FROM_PDC        = 12,
@@ -413,6 +417,15 @@ interface nbt
 		uint16               lm20_token;
 	} NETLOGON_SAM_LOGON_REQUEST;
 
+	typedef struct {
+		astring              computer_name;
+		astring              user_name;
+		astring              mailslot_name;
+		uint8                request_count;
+		uint16               lmnt_token;
+		uint16               lm20_token;
+	} NETLOGON_LOGON_REQUEST;
+
 	typedef [flag(NDR_NOALIGN),public] struct {
 		netlogon_command command;
 		nstring              pdc_name;
@@ -492,6 +505,12 @@ interface nbt
 		uint16               lm20_token;
 	} nbt_netlogon_response_from_pdc;
 
+	typedef [flag(NDR_NOALIGN),public] struct {
+		netlogon_command command;
+		astring pdc_name;
+		uint16 lm20_token;
+	} nbt_netlogon_response2;
+
 	typedef enum netr_SamDatabaseID netr_SamDatabaseID;
 
 	/* used to announce SAM changes - MS-NRPC 2.2.1.5.1 */
@@ -520,6 +539,7 @@ interface nbt
 	} NETLOGON_DB_CHANGE;
 
 	typedef [nodiscriminant] union {
+		[case(LOGON_REQUEST)]  NETLOGON_LOGON_REQUEST logon0;
 		[case(LOGON_SAM_LOGON_REQUEST)]       NETLOGON_SAM_LOGON_REQUEST logon;
 		[case(LOGON_PRIMARY_QUERY)] nbt_netlogon_query_for_pdc pdc;
 		[case(NETLOGON_ANNOUNCE_UAS)] NETLOGON_DB_CHANGE uas;
@@ -542,6 +562,10 @@ interface nbt
 		[switch_is(command)] nbt_netlogon_request req;
 	} nbt_netlogon_packet;
 
+	void decode_nbt_netlogon_packet(
+		[in] nbt_netlogon_packet packet
+		);
+
 	/********************************************************/
 	/* \MAILSLOT\BROWSE mailslot requests			*/
 	/* for details see http://ubiqx.org/cifs/Browsing.html  */
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 826b21c..9ee2edf 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -95,7 +95,7 @@ mkinclude libsmbclient/config.mk
 [SUBSYSTEM::TORTURE_NDR]
 PRIVATE_DEPENDENCIES = torture SERVICE_SMB
 
-TORTURE_NDR_OBJ_FILES = $(addprefix $(torturesrcdir)/ndr/, ndr.o winreg.o atsvc.o lsa.o epmap.o dfs.o netlogon.o drsuapi.o spoolss.o samr.o dfsblob.o drsblobs.o)
+TORTURE_NDR_OBJ_FILES = $(addprefix $(torturesrcdir)/ndr/, ndr.o winreg.o atsvc.o lsa.o epmap.o dfs.o netlogon.o drsuapi.o spoolss.o samr.o dfsblob.o drsblobs.o nbt.o)
 
 $(eval $(call proto_header_template,$(torturesrcdir)/ndr/proto.h,$(TORTURE_NDR_OBJ_FILES:.o=.c)))
 
diff --git a/source4/torture/ndr/nbt.c b/source4/torture/ndr/nbt.c
new file mode 100644
index 0000000..8955f4d
--- /dev/null
+++ b/source4/torture/ndr/nbt.c
@@ -0,0 +1,70 @@
+/*
+   Unix SMB/CIFS implementation.
+   test suite for nbt ndr operations
+
+   Copyright (C) Guenther Deschner 2010
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "torture/ndr/ndr.h"
+#include "librpc/gen_ndr/ndr_nbt.h"
+
+static const uint8_t netlogon_logon_request_req_data[] = {
+	0x00, 0x00, 0x57, 0x49, 0x4e, 0x39, 0x38, 0x00, 0x47, 0x44, 0x00, 0x5c,
+	0x4d, 0x41, 0x49, 0x4c, 0x53, 0x4c, 0x4f, 0x54, 0x5c, 0x54, 0x45, 0x4d,
+	0x50, 0x5c, 0x4e, 0x45, 0x54, 0x4c, 0x4f, 0x47, 0x4f, 0x4e, 0x00, 0x01,
+	0x01, 0x00, 0xff, 0xff
+};
+
+static bool netlogon_logon_request_req_check(struct torture_context *tctx,
+					     struct nbt_netlogon_packet *r)
+{
+	torture_assert_int_equal(tctx, r->command, LOGON_REQUEST, "command");
+	torture_assert_str_equal(tctx, r->req.logon0.computer_name, "WIN98", "computer name");
+	torture_assert_str_equal(tctx, r->req.logon0.user_name, "GD", "user_name");
+	torture_assert_str_equal(tctx, r->req.logon0.mailslot_name, "\\MAILSLOT\\TEMP\\NETLOGON", "mailslot_name");
+	torture_assert_int_equal(tctx, r->req.logon0.request_count, 1, "request_count");
+	torture_assert_int_equal(tctx, r->req.logon0.lmnt_token, 1, "lmnt_token");
+	torture_assert_int_equal(tctx, r->req.logon0.lm20_token, 0xffff, "lm20_token");
+
+	return true;
+}
+
+static const uint8_t netlogon_logon_request_resp_data[] = {
+	0x06, 0x00, 0x5c, 0x5c, 0x4d, 0x54, 0x48, 0x45, 0x4c, 0x45, 0x4e, 0x41,
+	0x00, 0xff, 0xff
+};
+
+static bool netlogon_logon_request_resp_check(struct torture_context *tctx,
+					      struct nbt_netlogon_response2 *r)
+{
+	torture_assert_int_equal(tctx, r->command, LOGON_RESPONSE2, "command");
+	torture_assert_str_equal(tctx, r->pdc_name, "\\\\MTHELENA", "pdc_name");
+	torture_assert_int_equal(tctx, r->lm20_token, 0xffff, "lm20_token");
+
+	return true;
+}
+
+struct torture_suite *ndr_nbt_suite(TALLOC_CTX *ctx)
+{
+	struct torture_suite *suite = torture_suite_create(ctx, "nbt");
+
+	torture_suite_add_ndr_pull_fn_test(suite, nbt_netlogon_packet, netlogon_logon_request_req_data, NDR_IN, netlogon_logon_request_req_check);
+
+	torture_suite_add_ndr_pull_fn_test(suite, nbt_netlogon_response2, netlogon_logon_request_resp_data, NDR_IN, netlogon_logon_request_resp_check);
+
+	return suite;
+}
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index 6068e10..9d0f345 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -267,6 +267,7 @@ struct torture_suite *torture_local_ndr(TALLOC_CTX *mem_ctx)
 	torture_suite_add_suite(suite, ndr_spoolss_suite(suite));
 	torture_suite_add_suite(suite, ndr_samr_suite(suite));
 	torture_suite_add_suite(suite, ndr_drsblobs_suite(suite));
+	torture_suite_add_suite(suite, ndr_nbt_suite(suite));
 
 	torture_suite_add_simple_test(suite, "string terminator", 
 								   test_check_string_terminator);
diff --git a/source4/torture/wscript_build b/source4/torture/wscript_build
index 47b2b3d..715bec5 100644
--- a/source4/torture/wscript_build
+++ b/source4/torture/wscript_build
@@ -33,7 +33,7 @@ bld.RECURSE('libnetapi')
 bld.RECURSE('libsmbclient')
 
 bld.SAMBA_SUBSYSTEM('TORTURE_NDR',
-	source='ndr/ndr.c ndr/winreg.c ndr/atsvc.c ndr/lsa.c ndr/epmap.c ndr/dfs.c ndr/netlogon.c ndr/drsuapi.c ndr/spoolss.c ndr/samr.c ndr/dfsblob.c ndr/drsblobs.c',
+	source='ndr/ndr.c ndr/winreg.c ndr/atsvc.c ndr/lsa.c ndr/epmap.c ndr/dfs.c ndr/netlogon.c ndr/drsuapi.c ndr/spoolss.c ndr/samr.c ndr/dfsblob.c ndr/drsblobs.c ndr/nbt.c',
 	autoproto='ndr/proto.h',
 	deps='torture SERVICE_SMB'
 	)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list