summaryrefslogtreecommitdiff
path: root/source4/torture/libnet
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-08-02 09:53:27 +0200
committerStefan Metzmacher <metze@samba.org>2010-08-02 17:42:49 +0200
commitb1a584f9dc67bee1ecde408620dd815be3533091 (patch)
treeae09d8fc2baf49b0569e16e4ed8fd9a6668586cc /source4/torture/libnet
parentd3fff4590420a3b2d1858e6c8dbaf4df93447a46 (diff)
downloadsamba-b1a584f9dc67bee1ecde408620dd815be3533091.tar.gz
s4:torture/libnet: avoid dereferencing dcerpc_binding_handle internals
metze
Diffstat (limited to 'source4/torture/libnet')
-rw-r--r--source4/torture/libnet/utils.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source4/torture/libnet/utils.c b/source4/torture/libnet/utils.c
index 372482d9e89..88cebf1fbdc 100644
--- a/source4/torture/libnet/utils.c
+++ b/source4/torture/libnet/utils.c
@@ -107,7 +107,6 @@ bool test_domain_open(struct torture_context *tctx,
* when deleting users.
*/
static bool _get_account_name_for_user_rdn(struct torture_context *tctx,
- struct dcerpc_binding_handle *b,
const char *user_rdn,
TALLOC_CTX *mem_ctx,
const char **_account_name)
@@ -116,7 +115,7 @@ static bool _get_account_name_for_user_rdn(struct torture_context *tctx,
struct ldb_context *ldb;
TALLOC_CTX *tmp_ctx;
bool test_res = true;
- struct dcerpc_pipe *p = talloc_get_type_abort(b->private_data, struct dcerpc_pipe);
+ const char *hostname = torture_setting_string(tctx, "host", NULL);
int ldb_ret;
struct ldb_result *ldb_res;
const char *account_name = NULL;
@@ -125,10 +124,12 @@ static bool _get_account_name_for_user_rdn(struct torture_context *tctx,
NULL
};
+ torture_assert(tctx, hostname != NULL, "Failed to get hostname");
+
tmp_ctx = talloc_new(tctx);
torture_assert(tctx, tmp_ctx != NULL, "Failed to create temporary mem context");
- url = talloc_asprintf(tmp_ctx, "ldap://%s/", p->binding->target_hostname);
+ url = talloc_asprintf(tmp_ctx, "ldap://%s/", hostname);
torture_assert_goto(tctx, url != NULL, test_res, done, "Failed to allocate URL for ldb");
ldb = ldb_wrap_connect(tmp_ctx,
@@ -178,7 +179,7 @@ bool test_user_cleanup(struct torture_context *tctx,
struct samr_Ids rids, types;
const char *account_name;
- if (!_get_account_name_for_user_rdn(tctx, b, user_rdn, mem_ctx, &account_name)) {
+ if (!_get_account_name_for_user_rdn(tctx, user_rdn, mem_ctx, &account_name)) {
torture_result(tctx, TORTURE_FAIL,
__location__": Failed to find samAccountName for %s", user_rdn);
return false;