diff options
author | Günther Deschner <gd@samba.org> | 2008-12-10 02:51:49 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-12-10 11:58:28 +0100 |
commit | c4a5788e821ddcba125464ef0fc8172c0100d959 (patch) | |
tree | 44324b1125518d045bc979d84123866f0b4f92c8 | |
parent | 9fa4dfc4ea1c27aecd74cd89d50e674c4614ebd3 (diff) | |
download | samba-c4a5788e821ddcba125464ef0fc8172c0100d959.tar.gz samba-c4a5788e821ddcba125464ef0fc8172c0100d959.tar.bz2 samba-c4a5788e821ddcba125464ef0fc8172c0100d959.zip |
s4-smbtorture: add simple netr_ServerGetTrustInfo test.
Guenther
-rw-r--r-- | source4/torture/rpc/netlogon.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 5fb36079d6..306c271511 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -2051,6 +2051,47 @@ static bool test_netr_DsRAddressToSitenamesExW(struct torture_context *tctx, return true; } +static bool test_netr_ServerGetTrustInfo(struct torture_context *tctx, + struct dcerpc_pipe *p, + struct cli_credentials *machine_credentials) +{ + NTSTATUS status; + struct netr_ServerGetTrustInfo r; + + struct netr_Authenticator a; + struct netr_Authenticator return_authenticator; + struct samr_Password new_owf_password; + struct samr_Password old_owf_password; + struct netr_TrustInfo *trust_info; + + struct creds_CredentialState *creds; + + if (!test_SetupCredentials3(p, tctx, NETLOGON_NEG_AUTH2_ADS_FLAGS, + machine_credentials, &creds)) { + return false; + } + + creds_client_authenticator(creds, &a); + + r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); + r.in.account_name = talloc_asprintf(tctx, "%s$", TEST_MACHINE_NAME); + r.in.secure_channel_type = SEC_CHAN_BDC; + r.in.computer_name = TEST_MACHINE_NAME; + r.in.credential = &a; + + r.out.return_authenticator = &return_authenticator; + r.out.new_owf_password = &new_owf_password; + r.out.old_owf_password = &old_owf_password; + r.out.trust_info = &trust_info; + + status = dcerpc_netr_ServerGetTrustInfo(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "failed"); + torture_assert(tctx, creds_client_check(creds, &return_authenticator.cred), "Credential chaining failed"); + + return true; +} + + static bool test_GetDomainInfo(struct torture_context *tctx, struct dcerpc_pipe *p, struct cli_credentials *machine_credentials) @@ -2317,6 +2358,7 @@ struct torture_suite *torture_rpc_netlogon(TALLOC_CTX *mem_ctx) torture_rpc_tcase_add_test(tcase, "DsrGetDcSiteCoverageW", test_netr_DsrGetDcSiteCoverageW); torture_rpc_tcase_add_test(tcase, "DsRAddressToSitenamesW", test_netr_DsRAddressToSitenamesW); torture_rpc_tcase_add_test(tcase, "DsRAddressToSitenamesExW", test_netr_DsRAddressToSitenamesExW); + torture_rpc_tcase_add_test_creds(tcase, "ServerGetTrustInfo", test_netr_ServerGetTrustInfo); return suite; } |