while(next_token( &p, desthost, LIST_SEP, sizeof(desthost))) {
strupper(desthost);
- if(!resolve_name( desthost, &dest_ip, 0x20)) {
+ if(!resolve_name( desthost, &dest_ip, 0x20, lp_name_resolve_order(global_loadparm))) {
DEBUG(1,("server_cryptkey: Can't resolve address for %s\n",desthost));
continue;
}
}
if (session_info) {
- nt_status = auth_generate_session_info(tmp_ctx, server_info, session_info);
+ nt_status = auth_generate_session_info(tmp_ctx, lp_ctx, server_info, session_info);
if (NT_STATUS_IS_OK(nt_status)) {
talloc_steal(mem_ctx, *session_info);
}
/* references the server_info into the session_info */
- nt_status = auth_generate_session_info(mem_ctx, server_info, &session_info);
+ nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
talloc_free(mem_ctx);
return nt_status;
}
/* references the server_info into the session_info */
- nt_status = auth_generate_session_info(mem_ctx, server_info, &session_info);
+ nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
talloc_free(mem_ctx);
NTSTATUS nt_status;
struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
- nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_ntlmssp_state->server_info, session_info);
+ nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info);
NT_STATUS_NOT_OK_RETURN(nt_status);
(*session_info)->session_key = data_blob_talloc(*session_info,
}
/* references the server_info into the session_info */
- nt_status = auth_generate_session_info(parent_ctx, server_info, &session_info);
+ nt_status = auth_generate_session_info(parent_ctx, lp_ctx, server_info, &session_info);
talloc_free(mem_ctx);
NT_STATUS_NOT_OK_RETURN(nt_status);
}
NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct auth_serversupplied_info *server_info,
struct auth_session_info **_session_info)
{
session_info->session_key = server_info->user_session_key;
nt_status = security_token_create(session_info,
- global_loadparm,
+ lp_ctx,
server_info->account_sid,
server_info->primary_group_sid,
server_info->n_domain_groups,
return(handle);
}
-static void set_max_xmit(uint64_t iomax)
+static void set_max_xmit(struct loadparm_context *lp_ctx, uint64_t iomax)
{
char buf[64];
snprintf(buf, sizeof(buf), "%llu", (unsigned long long)iomax);
- lp_set_cmdline(global_loadparm, "max xmit", buf);
+ lp_set_cmdline(lp_ctx, "max xmit", buf);
}
static int copy_files(void)
return(EOM_EXIT_CODE);
}
- set_max_xmit(MAX(ibs, obs));
+ set_max_xmit(global_loadparm, MAX(ibs, obs));
DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n",
(unsigned long long)iomax, lp_max_xmit(global_loadparm)));
{
iconv_t cd;
- if (!lp_parm_bool(global_loadparm, NULL, "iconv", "native", true))
+ if (!lp_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true))
torture_skip(tctx, "system iconv disabled - skipping test");
cd = iconv_open("UTF-16LE", "UCS-4LE");
state->msg_ctx = msg_ctx;
make_nbt_name(&name, state->domain_name, name_type);
- creq = resolve_name_send(&name, event_ctx,
- methods);
+ creq = resolve_name_send(&name, event_ctx, methods);
composite_continue(c, creq, finddcs_name_resolved, state);
return c;
}
make_nbt_name(&nbt_name, host, name_type);
- status = resolve_name(&nbt_name, tmp_ctx, &address, event_ctx);
+ status = resolve_name(&nbt_name, tmp_ctx, &address, event_ctx, lp_name_resolve_order(global_loadparm));
if (!NT_STATUS_IS_OK(status)) {
talloc_free(tmp_ctx);
return NULL;
/*
general name resolution - sync call
*/
-NTSTATUS resolve_name(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr,
- struct event_context *ev)
+NTSTATUS resolve_name(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr, struct event_context *ev, const char **name_resolve_order)
{
- struct composite_context *c = resolve_name_send(name, ev,
- lp_name_resolve_order(global_loadparm));
+ struct composite_context *c = resolve_name_send(name, ev, name_resolve_order);
return resolve_name_recv(c, mem_ctx, reply_addr);
}
#include "lib/ldb/include/ldb_errors.h"
#include "librpc/rpc/dcerpc.h"
#include "libcli/resolve/resolve.h"
+#include "param/param.h"
-/*
+/**
* 1. Setup a CLDAP socket.
* 2. Lookup the default Site-Name.
*/
}
make_nbt_name_client(&name, libnet_r->out.samr_binding->host);
- status = resolve_name(&name, r, &dest_addr, NULL);
+ status = resolve_name(&name, r, &dest_addr, NULL, lp_name_resolve_order(global_loadparm));
if (!NT_STATUS_IS_OK(status)) {
libnet_r->out.error_string = NULL;
talloc_free(tmp_ctx);
goto done;
}
- nt_status = auth_generate_session_info(tmp_ctx, server_info, &session_info);
+ nt_status = auth_generate_session_info(tmp_ctx, global_loadparm, server_info, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
mprSetPropertyValue(auth, "report", mprString("Session Info generation failed"));
mprSetPropertyValue(auth, "result", mprCreateBoolVar(false));
result = 0;
- nt_status = resolve_name(&name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx));
+ nt_status = resolve_name(&name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx), lp_name_resolve_order(global_loadparm));
if (NT_STATUS_IS_OK(nt_status)) {
mprSetPropertyValue(argv[0], "value", mprString(reply_addr));
if (!NT_STATUS_IS_OK(status)) goto failed;
/* This references server_info into session_info */
- status = auth_generate_session_info(req, server_info, &session_info);
+ status = auth_generate_session_info(req, global_loadparm, server_info, &session_info);
if (!NT_STATUS_IS_OK(status)) goto failed;
/* allocate a new session */
if (!NT_STATUS_IS_OK(status)) goto failed;
/* This references server_info into session_info */
- status = auth_generate_session_info(req, server_info, &session_info);
+ status = auth_generate_session_info(req, global_loadparm, server_info, &session_info);
if (!NT_STATUS_IS_OK(status)) goto failed;
/* allocate a new session */
#include "libcli/cldap/cldap.h"
#include "libcli/resolve/resolve.h"
#include "torture/torture.h"
+#include "param/param.h"
struct bench_state {
int pass_count, fail_count;
make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
/* do an initial name resolution to find its IP */
- status = resolve_name(&name, torture, &address, event_context_find(torture));
+ status = resolve_name(&name, torture, &address, event_context_find(torture), lp_name_resolve_order(torture->lp_ctx));
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to resolve %s - %s\n",
name.name, nt_errstr(status));
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(&name, tctx, &address, event_context_find(tctx)),
+ resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(global_loadparm)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(&name, tctx, &address, event_context_find(tctx)),
+ resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(&name, tctx, &address, event_context_find(tctx)),
+ resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
#include "torture/nbt/proto.h"
#include "torture/ui.h"
#include "libcli/resolve/resolve.h"
+#include "param/param.h"
bool torture_nbt_get_name(struct torture_context *tctx,
struct nbt_name *name,
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(name, tctx, address, NULL),
+ resolve_name(name, tctx, address, NULL, lp_name_resolve_order(tctx->lp_ctx)),
talloc_asprintf(tctx,
"Failed to resolve %s", name->name));
} old_dc;
};
-static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx)
+static struct DsSyncTest *test_create_context(struct torture_context *tctx)
{
NTSTATUS status;
struct DsSyncTest *ctx;
struct drsuapi_DsBindInfo28 *our_bind_info28;
struct drsuapi_DsBindInfoCtr *our_bind_info_ctr;
- const char *binding = lp_parm_string(global_loadparm, NULL, "torture", "binding");
- ctx = talloc_zero(mem_ctx, struct DsSyncTest);
+ const char *binding = torture_setting_string(tctx, "binding", NULL);
+ ctx = talloc_zero(tctx, struct DsSyncTest);
if (!ctx) return NULL;
status = dcerpc_parse_binding(ctx, binding, &ctx->drsuapi_binding);
our_bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3;
our_bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7;
our_bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT;
- if (lp_parm_bool(global_loadparm, NULL, "dssync", "xpress", false)) {
+ if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "xpress", false)) {
our_bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS;
}
our_bind_info28->site_guid = GUID_zero();
return ret;
}
-static bool test_GetInfo(struct DsSyncTest *ctx)
+static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
{
NTSTATUS status;
struct drsuapi_DsCrackNames r;
r.in.req.req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS;
r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
- names[0].str = talloc_asprintf(ctx, "%s\\", lp_workgroup(global_loadparm));
+ names[0].str = talloc_asprintf(ctx, "%s\\", lp_workgroup(tctx->lp_ctx));
status = dcerpc_drsuapi_DsCrackNames(ctx->admin.drsuapi.pipe, ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
return plain_buffer;
}
-static void test_analyse_objects(struct DsSyncTest *ctx,
+static void test_analyse_objects(struct torture_context *tctx,
+ struct DsSyncTest *ctx,
const DATA_BLOB *gensec_skey,
struct drsuapi_DsReplicaObjectListItemEx *cur)
{
static uint32_t object_id;
const char *save_values_dir;
- if (!lp_parm_bool(global_loadparm, NULL, "dssync", "print_pwd_blobs", false)) {
+ if (!lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "print_pwd_blobs", false)) {
return;
}
- save_values_dir = lp_parm_string(global_loadparm, NULL, "dssync", "save_pwd_blobs_dir");
+ save_values_dir = lp_parm_string(tctx->lp_ctx, NULL, "dssync", "save_pwd_blobs_dir");
for (; cur; cur = cur->next_object) {
const char *dn;
}
}
-static bool test_FetchData(struct DsSyncTest *ctx)
+static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx)
{
NTSTATUS status;
bool ret = true;
ZERO_STRUCT(null_guid);
ZERO_STRUCT(null_sid);
- partition = lp_parm_string(global_loadparm, NULL, "dssync", "partition");
+ partition = lp_parm_string(tctx->lp_ctx, NULL, "dssync", "partition");
if (partition == NULL) {
partition = ctx->domain_dn;
printf("dssync:partition not specified, defaulting to %s.\n", ctx->domain_dn);
}
- highest_usn = lp_parm_int(global_loadparm, NULL, "dssync", "highest_usn", 0);
+ highest_usn = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "highest_usn", 0);
- array[0].level = lp_parm_int(global_loadparm, NULL, "dssync", "get_nc_changes_level", array[0].level);
+ array[0].level = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "get_nc_changes_level", array[0].level);
- if (lp_parm_bool(global_loadparm, NULL, "dssync", "print_pwd_blobs", false)) {
+ if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "print_pwd_blobs", false)) {
const struct samr_Password *nthash;
nthash = cli_credentials_get_nt_hash(ctx->new_dc.credentials, ctx);
if (nthash) {
r.in.req.req5.highwatermark.highest_usn = highest_usn;
r.in.req.req5.uptodateness_vector = NULL;
r.in.req.req5.replica_flags = 0;
- if (lp_parm_bool(global_loadparm, NULL, "dssync", "compression", false)) {
+ if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "compression", false)) {
r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
}
- if (lp_parm_bool(global_loadparm, NULL, "dssync", "neighbour_writeable", true)) {
+ if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "neighbour_writeable", true)) {
r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
}
r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
r.in.req.req8.highwatermark.highest_usn = highest_usn;
r.in.req.req8.uptodateness_vector = NULL;
r.in.req.req8.replica_flags = 0;
- if (lp_parm_bool(global_loadparm, NULL, "dssync", "compression", false)) {
+ if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "compression", false)) {
r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
}
- if (lp_parm_bool(global_loadparm, NULL, "dssync", "neighbour_writeable", true)) {
+ if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "neighbour_writeable", true)) {
r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
}
r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
(long long)ctr1->new_highwatermark.tmp_highest_usn,
(long long)ctr1->new_highwatermark.highest_usn));
- test_analyse_objects(ctx, &gensec_skey, ctr1->first_object);
+ test_analyse_objects(tctx, ctx, &gensec_skey, ctr1->first_object);
if (ctr1->new_highwatermark.tmp_highest_usn > ctr1->new_highwatermark.highest_usn) {
r.in.req.req5.highwatermark = ctr1->new_highwatermark;
(long long)ctr6->new_highwatermark.tmp_highest_usn,
(long long)ctr6->new_highwatermark.highest_usn));
- test_analyse_objects(ctx, &gensec_skey, ctr6->first_object);
+ test_analyse_objects(tctx, ctx, &gensec_skey, ctr6->first_object);
if (ctr6->new_highwatermark.tmp_highest_usn > ctr6->new_highwatermark.highest_usn) {
r.in.req.req8.highwatermark = ctr6->new_highwatermark;
return ret;
}
-static bool test_FetchNT4Data(struct DsSyncTest *ctx)
+static bool test_FetchNT4Data(struct torture_context *tctx,
+ struct DsSyncTest *ctx)
{
NTSTATUS status;
bool ret = true;
r.in.bind_handle = &ctx->new_dc.drsuapi.bind_handle;
r.in.level = 1;
- r.in.req.req1.unknown1 = lp_parm_int(global_loadparm, NULL, "dssync", "nt4-1", 3);
- r.in.req.req1.unknown2 = lp_parm_int(global_loadparm, NULL, "dssync", "nt4-2", 0x00004000);
+ r.in.req.req1.unknown1 = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "nt4-1", 3);
+ r.in.req.req1.unknown2 = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "nt4-2", 0x00004000);
while (1) {
r.in.req.req1.length = cookie.length;
struct DsSyncTest *ctx;
mem_ctx = talloc_init("torture_rpc_dssync");
- ctx = test_create_context(mem_ctx);
+ ctx = test_create_context(torture);
ret &= _test_DsBind(ctx, ctx->admin.credentials, &ctx->admin.drsuapi);
if (!ret) {
if (!ret) {
return ret;
}
- ret &= test_GetInfo(ctx);
+ ret &= test_GetInfo(torture, ctx);
ret &= _test_DsBind(ctx, ctx->new_dc.credentials, &ctx->new_dc.drsuapi);
if (!ret) {
return ret;
}
- ret &= test_FetchData(ctx);
- ret &= test_FetchNT4Data(ctx);
+ ret &= test_FetchData(torture, ctx);
+ ret &= test_FetchNT4Data(torture, ctx);
return ret;
}