The branch, master has been updated
       via  7182da7 s4-smbtorture: add (disabled) ndr torture test to check for 
a w2k samlogon reply we can't currently parse.
       via  6957109 s4-smbtorture: add NDR tests for netr_LogonSamLogon.
      from  95e644f s4-acl: Fixed returning uninitialized ldap error in case of 
some critical errors.

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


- Log -----------------------------------------------------------------
commit 7182da7f919b9201126129cb2628004b588a2e60
Author: Günther Deschner <[email protected]>
Date:   Fri Jan 28 15:33:51 2011 +0100

    s4-smbtorture: add (disabled) ndr torture test to check for a w2k samlogon 
reply we can't currently parse.
    
    Guenther
    
    Autobuild-User: Günther Deschner <[email protected]>
    Autobuild-Date: Fri Jan 28 16:23:30 CET 2011 on sn-devel-104

commit 6957109e8deb5e6761195c1e69b2b1514ff5b788
Author: Günther Deschner <[email protected]>
Date:   Fri Jan 28 14:18:31 2011 +0100

    s4-smbtorture: add NDR tests for netr_LogonSamLogon.
    
    Guenther

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

Summary of changes:
 librpc/idl/netlogon.idl        |    2 +-
 source4/torture/ndr/netlogon.c |   92 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 92 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/netlogon.idl b/librpc/idl/netlogon.idl
index 6818a50..ca974a6 100644
--- a/librpc/idl/netlogon.idl
+++ b/librpc/idl/netlogon.idl
@@ -302,7 +302,7 @@ interface netlogon
                time_t timestamp;
        } netr_Authenticator;
 
-       NTSTATUS netr_LogonSamLogon(
+       [public] NTSTATUS netr_LogonSamLogon(
                [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [in,unique] [string,charset(UTF16)] uint16 *computer_name,
                [in,unique] netr_Authenticator *credential,
diff --git a/source4/torture/ndr/netlogon.c b/source4/torture/ndr/netlogon.c
index ea11a20..d247eb1 100644
--- a/source4/torture/ndr/netlogon.c
+++ b/source4/torture/ndr/netlogon.c
@@ -3,6 +3,7 @@
    test suite for netlogon ndr operations
 
    Copyright (C) Jelmer Vernooij 2007
+   Copyright (C) Guenther Deschner 2011
    
    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
@@ -104,6 +105,89 @@ static bool netrserverreqchallenge_out_check(struct 
torture_context *tctx,
        return true;
 }
 
+static const uint8_t netrlogonsamlogon_in_data[] = {
+       0x00, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x09, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x5c, 0x00, 0x57, 0x00, 0x32, 0x00,
+       0x4b, 0x00, 0x53, 0x00, 0x52, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x04, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x09, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x54, 0x00, 0x48, 0x00, 0x45, 0x00,
+       0x4c, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x08, 0x00, 0x02, 0x00, 0x08, 0xaf, 0x72, 0x50, 0xa0, 0x5b, 0x50, 0x19,
+       0x02, 0xc3, 0x39, 0x4d, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
+       0x10, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x14, 0x00, 0x02, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0xad, 0xde, 0x00, 0x00, 0xef, 0xbe, 0x00, 0x00,
+       0x1a, 0x00, 0x1a, 0x00, 0x18, 0x00, 0x02, 0x00, 0x14, 0x00, 0x14, 0x00,
+       0x1c, 0x00, 0x02, 0x00, 0x31, 0xeb, 0xf4, 0x68, 0x62, 0x93, 0xfe, 0x38,
+       0x51, 0xc1, 0x1d, 0x41, 0x0a, 0xbd, 0x5d, 0xdf, 0xe3, 0x4f, 0x76, 0x7f,
+       0x19, 0x12, 0xcd, 0xfe, 0x9c, 0x68, 0xed, 0x9b, 0x1e, 0x9c, 0x66, 0xf6,
+       0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+       0x57, 0x00, 0x32, 0x00, 0x4b, 0x00, 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00,
+       0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
+       0x61, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00,
+       0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x6f, 0x00,
+       0x72, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x0a, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x5c, 0x00, 0x6d, 0x00, 0x74, 0x00,
+       0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00,
+       0x06, 0x00
+};
+
+static bool netrlogonsamlogon_in_check(struct torture_context *tctx,
+                                      struct netr_LogonSamLogon *r)
+{
+       uint8_t credential_expected[8] = { 0x08, 0xaf, 0x72, 0x50, 0xa0, 0x5b, 
0x50, 0x19 };
+       uint8_t return_authenticator_expected[8] = { 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00 };
+       uint8_t lmpassword_expected[16] = { 0x31, 0xeb, 0xf4, 0x68, 0x62, 0x93, 
0xfe, 0x38, 0x51, 0xc1, 0x1d, 0x41, 0x0a, 0xbd, 0x5d, 0xdf };
+       uint8_t ntpassword_expected[16] = { 0xe3, 0x4f, 0x76, 0x7f, 0x19, 0x12, 
0xcd, 0xfe, 0x9c, 0x68, 0xed, 0x9b, 0x1e, 0x9c, 0x66, 0xf6 };
+
+       torture_assert_str_equal(tctx, r->in.server_name, "\\\\W2KSRV", 
"server_name");
+       torture_assert_str_equal(tctx, r->in.computer_name, "MTHELENA", 
"computer_name");
+       torture_assert_mem_equal(tctx, r->in.credential->cred.data, 
credential_expected, 8, "credential");
+/*     torture_assert_int_equal(tctx, r->in.credential->timestamp, 0, 
"credential.timestamp"); */
+       torture_assert_mem_equal(tctx, r->in.return_authenticator->cred.data, 
return_authenticator_expected, 8, "return_authenticator.cred.data");
+       torture_assert_int_equal(tctx, r->in.return_authenticator->timestamp, 
0, "return_authenticator.timestamp");
+       torture_assert_int_equal(tctx, r->in.logon_level, 
NetlogonInteractiveInformation, "logon_level");
+       torture_assert(tctx, r->in.logon, "logon NULL pointer");
+       torture_assert(tctx, r->in.logon->password, "logon->password NULL 
pointer");
+       torture_assert_int_equal(tctx, 
r->in.logon->password->identity_info.domain_name.length, 12, 
"domain_name.length");
+       torture_assert_int_equal(tctx, 
r->in.logon->password->identity_info.domain_name.size, 12, "domain_name.size");
+       torture_assert_str_equal(tctx, 
r->in.logon->password->identity_info.domain_name.string, "W2KDOM", 
"domain_name.string");
+       torture_assert_int_equal(tctx, 
r->in.logon->password->identity_info.parameter_control, 0, "parameter_control");
+       torture_assert_int_equal(tctx, 
r->in.logon->password->identity_info.logon_id_low, 0xdead, "logon_id_low");
+       torture_assert_int_equal(tctx, 
r->in.logon->password->identity_info.logon_id_high, 0xbeef, "logon_id_high");
+       torture_assert_int_equal(tctx, 
r->in.logon->password->identity_info.account_name.length, 26, 
"account_name.length");
+       torture_assert_int_equal(tctx, 
r->in.logon->password->identity_info.account_name.size, 26, 
"account_name.size");
+       torture_assert_str_equal(tctx, 
r->in.logon->password->identity_info.account_name.string, "administrator", 
"account_name.string");
+       torture_assert_int_equal(tctx, 
r->in.logon->password->identity_info.workstation.length, 20, 
"workstation.length");
+       torture_assert_int_equal(tctx, 
r->in.logon->password->identity_info.workstation.size, 20, "workstation.size");
+       torture_assert_str_equal(tctx, 
r->in.logon->password->identity_info.workstation.string, "\\\\mthelena", 
"workstation.string");
+       torture_assert_mem_equal(tctx, r->in.logon->password->lmpassword.hash, 
lmpassword_expected, 16, "lmpassword");
+       torture_assert_mem_equal(tctx, r->in.logon->password->ntpassword.hash, 
ntpassword_expected, 16, "ntpassword");
+       torture_assert_int_equal(tctx, r->in.validation_level, 6, 
"validation_level");
+
+       return true;
+}
+
+static const uint8_t netrlogonsamlogon_out_data[] = {
+       0x6c, 0xdb, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+       0x03, 0x00, 0x00, 0xc0
+};
+
+static bool netrlogonsamlogon_out_check(struct torture_context *tctx,
+                                       struct netr_LogonSamLogon *r)
+{
+       uint8_t return_authenticator_expected[8] = { 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00 };
+
+       torture_assert_mem_equal(tctx, r->out.return_authenticator->cred.data, 
return_authenticator_expected, 8, "return_authenticator.cred.data");
+       torture_assert_int_equal(tctx, r->out.return_authenticator->timestamp, 
0, "return_authenticator.timestamp");
+       torture_assert(tctx, r->out.validation, "validation NULL pointer");
+       torture_assert(tctx, (r->out.validation->sam6 == NULL), "sam6 not 
NULL");
+       torture_assert_int_equal(tctx, *r->out.authoritative, 1, 
"authoritative");
+       torture_assert_ntstatus_equal(tctx, r->out.result, 
NT_STATUS_INVALID_INFO_CLASS, "unexpected result");
+
+       return true;
+}
 
 struct torture_suite *ndr_netlogon_suite(TALLOC_CTX *ctx)
 {
@@ -115,6 +199,12 @@ struct torture_suite *ndr_netlogon_suite(TALLOC_CTX *ctx)
        torture_suite_add_ndr_pull_fn_test(suite, netr_ServerAuthenticate3, 
netrserverauthenticate3_in_data, NDR_IN, netrserverauthenticate3_in_check );
        torture_suite_add_ndr_pull_fn_test(suite, netr_ServerAuthenticate3, 
netrserverauthenticate3_out_data, NDR_OUT, netrserverauthenticate3_out_check );
 
+       torture_suite_add_ndr_pull_fn_test(suite, netr_LogonSamLogon, 
netrlogonsamlogon_in_data, NDR_IN, netrlogonsamlogon_in_check );
+#if 0
+       /* samba currently fails to parse a validation level 6 samlogon reply
+        * from w2k and other servers - gd */
+       torture_suite_add_ndr_pull_io_test(suite, netr_LogonSamLogon, 
netrlogonsamlogon_in_data, netrlogonsamlogon_out_data, 
netrlogonsamlogon_out_check);
+#endif
+
        return suite;
 }
-


-- 
Samba Shared Repository

Reply via email to