summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-09-23 11:15:46 -0700
committerAndrew Tridgell <tridge@samba.org>2008-09-23 11:15:46 -0700
commit66092ced5e1dc4d35923a3c90bcb3214a885b17d (patch)
treed40fd46e86244f1b45abda2a95c8fe84bfc88c3c /source4/torture/rpc
parent9cf29abee296ea2fcdf712687a6ce2cf9fd9d74c (diff)
parent353aaf26c5f71d9a94e799a1c1e37449211e7a87 (diff)
downloadsamba-66092ced5e1dc4d35923a3c90bcb3214a885b17d.tar.gz
samba-66092ced5e1dc4d35923a3c90bcb3214a885b17d.tar.bz2
samba-66092ced5e1dc4d35923a3c90bcb3214a885b17d.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/netlogon.c4
-rw-r--r--source4/torture/rpc/remote_pac.c57
-rw-r--r--source4/torture/rpc/winreg.c16
3 files changed, 21 insertions, 56 deletions
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 5ec2c29a20..2522062696 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -250,6 +250,10 @@ static bool test_SetupCredentials3(struct dcerpc_pipe *p, struct torture_context
torture_assert(tctx, creds_client_check(creds, &credentials3), "Credential chaining failed");
torture_comment(tctx, "negotiate_flags=0x%08x\n", negotiate_flags);
+
+ /* Prove that requesting a challenge again won't break it */
+ status = dcerpc_netr_ServerReqChallenge(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status, "ServerReqChallenge");
*creds_out = creds;
return true;
diff --git a/source4/torture/rpc/remote_pac.c b/source4/torture/rpc/remote_pac.c
index 6419e40014..a4111d1c3e 100644
--- a/source4/torture/rpc/remote_pac.c
+++ b/source4/torture/rpc/remote_pac.c
@@ -68,8 +68,6 @@ static bool test_PACVerify(struct torture_context *tctx,
TALLOC_CTX *tmp_ctx = talloc_new(tctx);
- int i;
-
torture_assert(tctx, tmp_ctx != NULL, "talloc_new() failed");
if (!test_SetupCredentials2(p, tctx, NETLOGON_NEG_AUTH2_ADS_FLAGS,
@@ -118,16 +116,12 @@ static bool test_PACVerify(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, status, "gensec_update (client) failed");
}
- if (client_to_server.length == 0) {
- break;
- }
-
status = gensec_update(gensec_server_context, tmp_ctx, client_to_server, &server_to_client);
if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {;
torture_assert_ntstatus_ok(tctx, status, "gensec_update (server) failed");
}
- if (server_to_client.length == 0) {
+ if (NT_STATUS_IS_OK(status)) {
break;
}
} while (1);
@@ -137,7 +131,6 @@ static bool test_PACVerify(struct torture_context *tctx,
status = gensec_session_info(gensec_server_context, &session_info);
torture_assert_ntstatus_ok(tctx, status, "gensec_session_info failed");
- pac_wrapped_struct.MessageType = 0x3;
pac_wrapped_struct.ChecksumLength = session_info->server_info->pac_srv_sig.signature.length;
pac_wrapped_struct.SignatureType = session_info->server_info->pac_kdc_sig.type;
pac_wrapped_struct.SignatureLength = session_info->server_info->pac_kdc_sig.signature.length;
@@ -207,51 +200,6 @@ static bool test_PACVerify(struct torture_context *tctx,
torture_assert(tctx, creds_client_check(creds, &r.out.return_authenticator->cred),
"Credential chaining failed");
- /* This will break message type, check that however we still get NT_STATUS_OK */
- for (i=0; i < 256; i++) {
- pac_wrapped_struct.MessageType = i;
- pac_wrapped_struct.ChecksumLength = session_info->server_info->pac_srv_sig.signature.length;
- pac_wrapped_struct.SignatureType = session_info->server_info->pac_kdc_sig.type;
- pac_wrapped_struct.SignatureLength = session_info->server_info->pac_kdc_sig.signature.length;
- pac_wrapped_struct.ChecksumAndSignature = payload
- = data_blob_talloc(tmp_ctx, NULL,
- pac_wrapped_struct.ChecksumLength
- + pac_wrapped_struct.SignatureLength);
- memcpy(&payload.data[0],
- session_info->server_info->pac_srv_sig.signature.data,
- pac_wrapped_struct.ChecksumLength);
- memcpy(&payload.data[pac_wrapped_struct.ChecksumLength],
- session_info->server_info->pac_kdc_sig.signature.data,
- pac_wrapped_struct.SignatureLength);
-
- ndr_err = ndr_push_struct_blob(&pac_wrapped, tmp_ctx, lp_iconv_convenience(tctx->lp_ctx), &pac_wrapped_struct,
- (ndr_push_flags_fn_t)ndr_push_PAC_Validate);
- torture_assert(tctx, NDR_ERR_CODE_IS_SUCCESS(ndr_err), "ndr_push_struct_blob of PACValidate structure failed");
-
- torture_assert(tctx, (creds->negotiate_flags & NETLOGON_NEG_ARCFOUR), "not willing to even try a PACValidate without RC4 encryption");
- creds_arcfour_crypt(creds, pac_wrapped.data, pac_wrapped.length);
-
- generic.length = pac_wrapped.length;
- generic.data = pac_wrapped.data;
-
- ZERO_STRUCT(auth2);
- creds_client_authenticator(creds, &auth);
- r.in.credential = &auth;
- r.in.return_authenticator = &auth2;
- r.in.logon_level = NetlogonGenericInformation;
- r.in.logon.generic = &generic;
- r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
- r.in.computer_name = cli_credentials_get_workstation(credentials);
- r.in.validation_level = NetlogonValidationGenericInfo2;
-
- status = dcerpc_netr_LogonSamLogon(p, tctx, &r);
-
- torture_assert_ntstatus_ok(tctx, status, "LogonSamLogon failed");
-
- torture_assert(tctx, creds_client_check(creds, &r.out.return_authenticator->cred),
- "Credential chaining failed");
- }
-
/* This will break the parsing nicely (even in the crypto wrapping), check we get INVALID_PARAMETER */
generic.length--;
@@ -272,7 +220,6 @@ static bool test_PACVerify(struct torture_context *tctx,
torture_assert(tctx, creds_client_check(creds, &r.out.return_authenticator->cred),
"Credential chaining failed");
- pac_wrapped_struct.MessageType = 0x3;
pac_wrapped_struct.ChecksumLength = session_info->server_info->pac_srv_sig.signature.length;
pac_wrapped_struct.SignatureType = session_info->server_info->pac_kdc_sig.type;
@@ -318,8 +265,6 @@ static bool test_PACVerify(struct torture_context *tctx,
torture_assert(tctx, creds_client_check(creds, &r.out.return_authenticator->cred),
"Credential chaining failed");
-
- pac_wrapped_struct.MessageType = 0x3;
pac_wrapped_struct.ChecksumLength = session_info->server_info->pac_srv_sig.signature.length;
pac_wrapped_struct.SignatureType = session_info->server_info->pac_kdc_sig.type;
pac_wrapped_struct.SignatureLength = session_info->server_info->pac_kdc_sig.signature.length;
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 8b602ef652..898813f807 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -80,6 +80,7 @@ static bool test_NotifyChangeKeyValue(struct dcerpc_pipe *p,
{
struct winreg_NotifyChangeKeyValue r;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.in.watch_subtree = true;
r.in.notify_filter = 0;
@@ -109,6 +110,7 @@ static bool test_CreateKey(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle newhandle;
enum winreg_CreateAction action_taken = 0;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.out.new_handle = &newhandle;
init_winreg_String(&r.in.name, name);
@@ -163,6 +165,7 @@ static bool test_CreateKey_sd(struct dcerpc_pipe *p,
secbuf.length = sdblob.length-10;
secbuf.inherit = 0;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.out.new_handle = newhandle;
init_winreg_String(&r.in.name, name);
@@ -317,6 +320,7 @@ static bool test_CloseKey(struct dcerpc_pipe *p, struct torture_context *tctx,
{
struct winreg_CloseKey r;
+ ZERO_STRUCT(r);
r.in.handle = r.out.handle = handle;
torture_assert_ntstatus_ok(tctx, dcerpc_winreg_CloseKey(p, tctx, &r),
@@ -332,6 +336,7 @@ static bool test_FlushKey(struct dcerpc_pipe *p, struct torture_context *tctx,
{
struct winreg_FlushKey r;
+ ZERO_STRUCT(r);
r.in.handle = handle;
torture_assert_ntstatus_ok(tctx, dcerpc_winreg_FlushKey(p, tctx, &r),
@@ -351,6 +356,7 @@ static bool _test_OpenKey(struct dcerpc_pipe *p, struct torture_context *tctx,
{
struct winreg_OpenKey r;
+ ZERO_STRUCT(r);
r.in.parent_handle = hive_handle;
init_winreg_String(&r.in.keyname, keyname);
r.in.unknown = 0x00000000;
@@ -384,6 +390,7 @@ static bool test_Cleanup(struct dcerpc_pipe *p, struct torture_context *tctx,
{
struct winreg_DeleteKey r;
+ ZERO_STRUCT(r);
r.in.handle = handle;
init_winreg_String(&r.in.key, key);
@@ -1435,6 +1442,7 @@ static bool test_EnumKey(struct dcerpc_pipe *p, struct torture_context *tctx,
class.name = "";
class.size = 1024;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.in.enum_index = 0;
r.in.name = &name;
@@ -1486,6 +1494,7 @@ static bool test_QueryMultipleValues(struct dcerpc_pipe *p,
NTSTATUS status;
uint32_t bufsize=0;
+ ZERO_STRUCT(r);
r.in.key_handle = handle;
r.in.values = r.out.values = talloc_array(tctx, struct QueryMultipleValue, 1);
r.in.values[0].name = talloc(tctx, struct winreg_String);
@@ -1527,6 +1536,7 @@ static bool test_QueryValue(struct dcerpc_pipe *p,
uint32_t offered = 0xfff;
uint32_t zero = 0;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.in.data = NULL;
r.in.value_name.name = valuename;
@@ -1558,6 +1568,7 @@ static bool test_EnumValue(struct dcerpc_pipe *p, struct torture_context *tctx,
name.name = "";
name.size = 1024;
+ ZERO_STRUCT(r);
r.in.handle = handle;
r.in.enum_index = 0;
r.in.name = &name;
@@ -1594,6 +1605,7 @@ static bool test_AbortSystemShutdown(struct dcerpc_pipe *p,
struct winreg_AbortSystemShutdown r;
uint16_t server = 0x0;
+ ZERO_STRUCT(r);
r.in.server = &server;
torture_assert_ntstatus_ok(tctx,
@@ -1612,6 +1624,7 @@ static bool test_InitiateSystemShutdown(struct torture_context *tctx,
struct winreg_InitiateSystemShutdown r;
uint16_t hostname = 0x0;
+ ZERO_STRUCT(r);
r.in.hostname = &hostname;
r.in.message = talloc(tctx, struct lsa_StringLarge);
init_lsa_StringLarge(r.in.message, "spottyfood");
@@ -1636,6 +1649,7 @@ static bool test_InitiateSystemShutdownEx(struct torture_context *tctx,
struct winreg_InitiateSystemShutdownEx r;
uint16_t hostname = 0x0;
+ ZERO_STRUCT(r);
r.in.hostname = &hostname;
r.in.message = talloc(tctx, struct lsa_StringLarge);
init_lsa_StringLarge(r.in.message, "spottyfood");
@@ -1694,6 +1708,7 @@ static bool test_Open_Security(struct torture_context *tctx,
winreg_open_fn open_fn = userdata;
+ ZERO_STRUCT(r);
r.in.system_name = 0;
r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r.out.handle = &handle;
@@ -1767,6 +1782,7 @@ static bool test_Open(struct torture_context *tctx, struct dcerpc_pipe *p,
winreg_open_fn open_fn = userdata;
+ ZERO_STRUCT(r);
r.in.system_name = 0;
r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r.out.handle = &handle;