summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/dssync.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/rpc/dssync.c')
-rw-r--r--source4/torture/rpc/dssync.c95
1 files changed, 48 insertions, 47 deletions
diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c
index 6357fa9ee5..15125ac365 100644
--- a/source4/torture/rpc/dssync.c
+++ b/source4/torture/rpc/dssync.c
@@ -32,6 +32,7 @@
#include "auth/credentials/credentials.h"
#include "libcli/auth/libcli_auth.h"
#include "auth/gensec/gensec.h"
+#include "param/param.h"
struct DsSyncBindInfo {
struct dcerpc_pipe *pipe;
@@ -83,7 +84,7 @@ static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx)
struct DsSyncTest *ctx;
struct drsuapi_DsBindInfo28 *our_bind_info28;
struct drsuapi_DsBindInfoCtr *our_bind_info_ctr;
- const char *binding = lp_parm_string(-1, "torture", "binding");
+ const char *binding = lp_parm_string(global_loadparm, NULL, "torture", "binding");
ctx = talloc_zero(mem_ctx, struct DsSyncTest);
if (!ctx) return NULL;
@@ -148,7 +149,7 @@ static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx)
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(-1,"dssync","xpress",False)) {
+ if (lp_parm_bool(global_loadparm, NULL, "dssync", "xpress", false)) {
our_bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS;
}
our_bind_info28->site_guid = GUID_zero();
@@ -172,10 +173,10 @@ static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx)
return ctx;
}
-static BOOL _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncBindInfo *b)
+static bool _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncBindInfo *b)
{
NTSTATUS status;
- BOOL ret = True;
+ bool ret = true;
struct event_context *event = NULL;
status = dcerpc_pipe_connect_b(ctx,
@@ -185,7 +186,7 @@ static BOOL _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credent
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
- return False;
+ return false;
}
status = dcerpc_drsuapi_DsBind(b->pipe, ctx, &b->req);
@@ -195,10 +196,10 @@ static BOOL _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credent
errstr = dcerpc_errstr(ctx, b->pipe->last_fault_code);
}
printf("dcerpc_drsuapi_DsBind failed - %s\n", errstr);
- ret = False;
+ ret = false;
} else if (!W_ERROR_IS_OK(b->req.out.result)) {
printf("DsBind failed - %s\n", win_errstr(b->req.out.result));
- ret = False;
+ ret = false;
}
ZERO_STRUCT(b->peer_bind_info28);
@@ -222,15 +223,15 @@ static BOOL _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credent
return ret;
}
-static BOOL test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncLDAPInfo *l)
+static bool test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncLDAPInfo *l)
{
NTSTATUS status;
- BOOL ret = True;
+ bool ret = true;
status = torture_ldap_connection(ctx, &l->conn, ctx->ldap_url);
if (!NT_STATUS_IS_OK(status)) {
printf("failed to connect to LDAP: %s\n", ctx->ldap_url);
- return False;
+ return false;
}
printf("connected to LDAP: %s\n", ctx->ldap_url);
@@ -238,19 +239,19 @@ static BOOL test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *creden
status = torture_ldap_bind_sasl(l->conn, credentials);
if (!NT_STATUS_IS_OK(status)) {
printf("failed to bind to LDAP:\n");
- return False;
+ return false;
}
printf("bound to LDAP.\n");
return ret;
}
-static BOOL test_GetInfo(struct DsSyncTest *ctx)
+static bool test_GetInfo(struct DsSyncTest *ctx)
{
NTSTATUS status;
struct drsuapi_DsCrackNames r;
struct drsuapi_DsNameString names[1];
- BOOL ret = True;
+ bool ret = true;
struct cldap_socket *cldap = cldap_socket_init(ctx, NULL);
struct cldap_netlogon search;
@@ -264,7 +265,7 @@ static BOOL test_GetInfo(struct DsSyncTest *ctx)
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());
+ names[0].str = talloc_asprintf(ctx, "%s\\", lp_workgroup(global_loadparm));
status = dcerpc_drsuapi_DsCrackNames(ctx->admin.drsuapi.pipe, ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -273,10 +274,10 @@ static BOOL test_GetInfo(struct DsSyncTest *ctx)
errstr = dcerpc_errstr(ctx, ctx->admin.drsuapi.pipe->last_fault_code);
}
printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr);
- return False;
+ return false;
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsCrackNames failed - %s\n", win_errstr(r.out.result));
- return False;
+ return false;
}
ctx->domain_dn = r.out.ctr.ctr1->array[0].result_name;
@@ -419,17 +420,17 @@ static void test_analyse_objects(struct DsSyncTest *ctx,
static uint32_t object_id;
const char *save_values_dir;
- if (!lp_parm_bool(-1,"dssync","print_pwd_blobs", false)) {
+ if (!lp_parm_bool(global_loadparm, NULL,"dssync","print_pwd_blobs", false)) {
return;
}
- save_values_dir = lp_parm_string(-1,"dssync","save_pwd_blobs_dir");
+ save_values_dir = lp_parm_string(global_loadparm, NULL, "dssync", "save_pwd_blobs_dir");
for (; cur; cur = cur->next_object) {
const char *dn;
struct dom_sid *sid = NULL;
uint32_t rid = 0;
- BOOL dn_printed = False;
+ bool dn_printed = false;
uint32_t i;
if (!cur->object.identifier) continue;
@@ -503,7 +504,7 @@ static void test_analyse_objects(struct DsSyncTest *ctx,
if (!dn_printed) {
object_id++;
DEBUG(0,("DN[%u] %s\n", object_id, dn));
- dn_printed = True;
+ dn_printed = true;
}
DEBUGADD(0,("ATTR: %s enc.length=%lu plain.length=%lu\n",
name, (long)enc_data->length, (long)plain_data.length));
@@ -530,10 +531,10 @@ static void test_analyse_objects(struct DsSyncTest *ctx,
}
}
-static BOOL test_FetchData(struct DsSyncTest *ctx)
+static bool test_FetchData(struct DsSyncTest *ctx)
{
NTSTATUS status;
- BOOL ret = True;
+ bool ret = true;
int i, y = 0;
uint64_t highest_usn = 0;
const char *partition = NULL;
@@ -559,17 +560,17 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
ZERO_STRUCT(null_guid);
ZERO_STRUCT(null_sid);
- partition = lp_parm_string(-1, "dssync", "partition");
+ partition = lp_parm_string(global_loadparm, 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(-1, "dssync", "highest_usn", 0);
+ highest_usn = lp_parm_int(global_loadparm, NULL, "dssync", "highest_usn", 0);
- array[0].level = lp_parm_int(-1, "dssync", "get_nc_changes_level", array[0].level);
+ array[0].level = lp_parm_int(global_loadparm, NULL, "dssync", "get_nc_changes_level", array[0].level);
- if (lp_parm_bool(-1,"dssync","print_pwd_blobs",False)) {
+ if (lp_parm_bool(global_loadparm, NULL, "dssync", "print_pwd_blobs", false)) {
const struct samr_Password *nthash;
nthash = cli_credentials_get_nt_hash(ctx->new_dc.credentials, ctx);
if (nthash) {
@@ -581,7 +582,7 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
&gensec_skey);
if (!NT_STATUS_IS_OK(status)) {
printf("failed to get gensec session key: %s\n", nt_errstr(status));
- return False;
+ return false;
}
for (i=0; i < ARRAY_SIZE(array); i++) {
@@ -605,10 +606,10 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
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(-1,"dssync","compression",False)) {
+ if (lp_parm_bool(global_loadparm, NULL, "dssync", "compression", false)) {
r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
}
- if (lp_parm_bool(-1,"dssync","neighbour_writeable",True)) {
+ if (lp_parm_bool(global_loadparm, 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
@@ -636,10 +637,10 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
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(-1,"dssync","compression",False)) {
+ if (lp_parm_bool(global_loadparm, NULL, "dssync", "compression", false)) {
r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
}
- if (lp_parm_bool(-1,"dssync","neighbour_writeable",True)) {
+ if (lp_parm_bool(global_loadparm, 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
@@ -685,16 +686,16 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
errstr = dcerpc_errstr(ctx, ctx->new_dc.drsuapi.pipe->last_fault_code);
}
printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", errstr);
- ret = False;
+ ret = false;
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsGetNCChanges failed - %s\n", win_errstr(r.out.result));
- ret = False;
+ ret = false;
}
- if (ret == True && *r.out.level == 1) {
+ if (ret == true && *r.out.level == 1) {
out_level = 1;
ctr1 = &r.out.ctr.ctr1;
- } else if (ret == True && *r.out.level == 2) {
+ } else if (ret == true && *r.out.level == 2) {
out_level = 1;
ctr1 = r.out.ctr.ctr2.ctr.mszip1.ctr1;
}
@@ -712,10 +713,10 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
}
}
- if (ret == True && *r.out.level == 6) {
+ if (ret == true && *r.out.level == 6) {
out_level = 6;
ctr6 = &r.out.ctr.ctr6;
- } else if (ret == True && *r.out.level == 7
+ } else if (ret == true && *r.out.level == 7
&& r.out.ctr.ctr7.level == 6
&& r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP) {
out_level = 6;
@@ -742,10 +743,10 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
return ret;
}
-static BOOL test_FetchNT4Data(struct DsSyncTest *ctx)
+static bool test_FetchNT4Data(struct DsSyncTest *ctx)
{
NTSTATUS status;
- BOOL ret = True;
+ bool ret = true;
struct drsuapi_DsGetNT4ChangeLog r;
struct GUID null_guid;
struct dom_sid null_sid;
@@ -759,8 +760,8 @@ static BOOL test_FetchNT4Data(struct DsSyncTest *ctx)
r.in.bind_handle = &ctx->new_dc.drsuapi.bind_handle;
r.in.level = 1;
- r.in.req.req1.unknown1 = lp_parm_int(-1, "dssync", "nt4-1", 3);
- r.in.req.req1.unknown2 = lp_parm_int(-1, "dssync", "nt4-2", 0x00004000);
+ 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);
while (1) {
r.in.req.req1.length = cookie.length;
@@ -773,16 +774,16 @@ static BOOL test_FetchNT4Data(struct DsSyncTest *ctx)
errstr = dcerpc_errstr(ctx, ctx->new_dc.drsuapi.pipe->last_fault_code);
}
printf("dcerpc_drsuapi_DsGetNT4ChangeLog failed - %s\n", errstr);
- ret = False;
+ ret = false;
} else if (W_ERROR_EQUAL(r.out.result, WERR_INVALID_DOMAIN_ROLE)) {
printf("DsGetNT4ChangeLog not supported by target server\n");
break;
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsGetNT4ChangeLog failed - %s\n", win_errstr(r.out.result));
- ret = False;
+ ret = false;
} else if (r.out.level != 1) {
printf("DsGetNT4ChangeLog unknown level - %u\n", r.out.level);
- ret = False;
+ ret = false;
} else if (NT_STATUS_IS_OK(r.out.info.info1.status)) {
} else if (NT_STATUS_EQUAL(r.out.info.info1.status, STATUS_MORE_ENTRIES)) {
cookie.length = r.out.info.info1.length1;
@@ -790,7 +791,7 @@ static BOOL test_FetchNT4Data(struct DsSyncTest *ctx)
continue;
} else {
printf("DsGetNT4ChangeLog failed - %s\n", nt_errstr(r.out.info.info1.status));
- ret = False;
+ ret = false;
}
break;
@@ -799,9 +800,9 @@ static BOOL test_FetchNT4Data(struct DsSyncTest *ctx)
return ret;
}
-BOOL torture_rpc_dssync(struct torture_context *torture)
+bool torture_rpc_dssync(struct torture_context *torture)
{
- BOOL ret = True;
+ bool ret = true;
TALLOC_CTX *mem_ctx;
struct DsSyncTest *ctx;