From ae7b8b2445d78687d2553f37a5b72504b78fd96e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 24 Jul 2009 10:20:36 +1000 Subject: [PATCH] Rework new GetDomainInfo test (show failure against Win2k8) The new GetDomainInfo code does not pass against Windows 2008. However, this patch is required to get the test to procede to a point where this can be seen. Andrew Bartlett --- source4/torture/rpc/netlogon.c | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-) diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index fecd72d..952ce9d 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -40,6 +40,7 @@ #include "libcli/security/security.h" #include "lib/ldb/include/ldb.h" #include "lib/util/util_ldb.h" +#include "lib/ldb_wrap.h" #define TEST_MACHINE_NAME "torturetest" #define TEST_MACHINE_DNS_SUFFIX "torturedomain" @@ -2128,7 +2129,8 @@ static bool test_GetDomainInfo(struct torture_context *tctx, char *url; struct ldb_context *sam_ctx; struct ldb_message **res; - int ret; + struct ldb_message_element *spn_el; + int ret, i; char *version_str; torture_comment(tctx, "Testing netr_LogonGetDomainInfo\n"); @@ -2139,10 +2141,13 @@ static bool test_GetDomainInfo(struct torture_context *tctx, } /* Set up connection to SAMDB on DC */ - sam_ctx = ldb_init(tctx, tctx->ev); - url = talloc_asprintf(tctx, "ldap://%s/", dcerpc_server_name(p)); - ret = ldb_connect(sam_ctx, url, 0, NULL); - torture_assert(tctx, ret == LDB_SUCCESS, "Connection to the SAMDB on DC failed!"); + url = talloc_asprintf(tctx, "ldap://%s", dcerpc_server_name(p)); + sam_ctx = ldb_wrap_connect(tctx, tctx->ev, tctx->lp_ctx, url, + NULL, + cmdline_credentials, + 0, NULL); + + torture_assert(tctx, sam_ctx, "Connection to the SAMDB on DC failed!"); ZERO_STRUCT(r); @@ -2199,9 +2204,17 @@ static bool test_GetDomainInfo(struct torture_context *tctx, /* TODO: Test "servicePrincipalName"s */ + spn_el = ldb_msg_find_element(res[0], "servicePrincipalName"); + for (i=0; i < spn_el->num_values; i++) { + printf("SPN: %s\n", spn_el->values[i].data); + } + torture_comment(tctx, "Testing netr_LogonGetDomainInfo 2nd call\n"); netlogon_creds_client_authenticator(creds, &a); + /* Wipe out the osVersion, and prove the values still 'stick' */ + q1.os_version.os = NULL; + status = dcerpc_netr_LogonGetDomainInfo(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "netr_LogonGetDomainInfo"); torture_assert(tctx, netlogon_creds_client_check(creds, &a.cred), "Credential chaining failed"); -- 1.6.0.6