diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-09-08 16:46:30 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:05:43 -0500 |
commit | 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 (patch) | |
tree | 044b24a249cc2b63c2f69214d7e7da288c170c74 /source4/torture | |
parent | ce0ff008b5c5af931526d14fa6232f8647e0880f (diff) | |
download | samba-98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8.tar.gz samba-98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8.tar.bz2 samba-98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8.zip |
r25035: Fix some more warnings, use service pointer rather than service number in more places.
(This used to be commit df9cebcb97e20564359097148665bd519f31bc6f)
Diffstat (limited to 'source4/torture')
54 files changed, 167 insertions, 169 deletions
diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c index e97338d3a6..23269a0160 100644 --- a/source4/torture/auth/ntlmssp.c +++ b/source4/torture/auth/ntlmssp.c @@ -44,7 +44,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) gensec_start_mech_by_oid(gensec_security, GENSEC_OID_NTLMSSP), "Failed to start GENSEC for NTLMSSP"); - gensec_ntlmssp_state = gensec_security->private_data; + gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; gensec_ntlmssp_state->session_key = strhex_to_data_blob("0102030405060708090a0b0c0d0e0f00"); dump_data_pw("NTLMSSP session key: \n", @@ -98,7 +98,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) gensec_start_mech_by_oid(gensec_security, GENSEC_OID_NTLMSSP), "GENSEC start mech by oid"); - gensec_ntlmssp_state = gensec_security->private_data; + gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; gensec_ntlmssp_state->session_key = strhex_to_data_blob("0102030405e538b0"); dump_data_pw("NTLMSSP session key: \n", diff --git a/source4/torture/ldap/cldap.c b/source4/torture/ldap/cldap.c index 8b7fa20b74..585cab9b27 100644 --- a/source4/torture/ldap/cldap.c +++ b/source4/torture/ldap/cldap.c @@ -270,10 +270,10 @@ done: return ret; } -BOOL torture_cldap(struct torture_context *torture) +bool torture_cldap(struct torture_context *torture) { TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; const char *host = torture_setting_string(torture, "host", NULL); mem_ctx = talloc_init("torture_cldap"); diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 9d67e093b1..9e870d9f26 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -442,7 +442,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s, return werror_to_ntstatus(status); } - if (lp_parm_bool(-1, "become dc", "dump objects", False)) { + if (lp_parm_bool(NULL, "become dc", "dump objects", false)) { for (i=0; i < objs->num_objects; i++) { struct ldb_ldif ldif; fprintf(stdout, "#\n"); @@ -670,7 +670,7 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data, return werror_to_ntstatus(status); } - if (lp_parm_bool(-1, "become dc", "dump objects", False)) { + if (lp_parm_bool(NULL, "become dc", "dump objects", false)) { for (i=0; i < objs->num_objects; i++) { struct ldb_ldif ldif; fprintf(stdout, "#\n"); @@ -700,7 +700,7 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data, return NT_STATUS_FOOBAR; } - if (lp_parm_bool(-1, "become dc", "dump objects", False)) { + if (lp_parm_bool(NULL, "become dc", "dump objects", false)) { DEBUG(0,("# %s\n", sa->lDAPDisplayName)); NDR_PRINT_DEBUG(drsuapi_DsReplicaLinkedAttribute, &linked_attributes[i]); dump_data(0, @@ -726,7 +726,7 @@ BOOL torture_net_become_dc(struct torture_context *torture) s = talloc_zero(torture, struct test_become_dc_state); if (!s) return False; - s->netbios_name = lp_parm_string(-1, "become dc", "smbtorture dc"); + s->netbios_name = lp_parm_string(NULL, "become dc", "smbtorture dc"); if (!s->netbios_name || !s->netbios_name[0]) { s->netbios_name = "smbtorturedc"; } @@ -834,7 +834,7 @@ BOOL torture_net_become_dc(struct torture_context *torture) goto cleanup; } - if (lp_parm_bool(-1, "become dc", "do not unjoin", false)) { + if (lp_parm_bool(NULL, "become dc", "do not unjoin", false)) { talloc_free(s); return ret; } diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index 186bd98aa5..a642d4bf52 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -418,7 +418,7 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, case acct_expiry: continue_if_field_set(r->in.acct_expiry); now = timeval_add(&now, (random() % (31*24*60*60)), 0); - r->in.acct_expiry = talloc_memdup(mem_ctx, &now, sizeof(now)); + r->in.acct_expiry = (struct timeval *)talloc_memdup(mem_ctx, &now, sizeof(now)); fldname = "acct_expiry"; break; diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index 95975e630e..314bc6d4da 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.c @@ -300,7 +300,7 @@ static BOOL test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -BOOL torture_userinfo(struct torture_context *torture) +bool torture_userinfo(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index deebfd9014..51e0016ea0 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -357,7 +357,7 @@ static BOOL test_usermod(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, case acct_expiry: continue_if_field_set(mod->in.change.acct_expiry); now = timeval_add(&now, (random() % (31*24*60*60)), 0); - mod->in.change.acct_expiry = talloc_memdup(mem_ctx, &now, sizeof(now)); + mod->in.change.acct_expiry = (struct timeval *)talloc_memdup(mem_ctx, &now, sizeof(now)); mod->in.change.fields |= USERMOD_FIELD_ACCT_EXPIRY; fldname = "acct_expiry"; break; @@ -533,7 +533,7 @@ done: } -BOOL torture_userdel(struct torture_context *torture) +bool torture_userdel(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c index 2a9eb49d01..fb4e5c3c3a 100644 --- a/source4/torture/local/dbspeed.c +++ b/source4/torture/local/dbspeed.c @@ -29,7 +29,8 @@ float tdb_speed; -static BOOL tdb_add_record(struct tdb_wrap *tdbw, const char *fmt1, const char *fmt2, int i) +static bool tdb_add_record(struct tdb_wrap *tdbw, const char *fmt1, + const char *fmt2, int i) { TDB_DATA key, data; int ret; diff --git a/source4/torture/local/event.c b/source4/torture/local/event.c index e2c7de1c72..46acf5938e 100644 --- a/source4/torture/local/event.c +++ b/source4/torture/local/event.c @@ -29,7 +29,7 @@ static int fde_count; static void fde_handler(struct event_context *ev_ctx, struct fd_event *f, uint16_t flags, void *private) { - int *fd = private; + int *fd = (int *)private; char c; #ifdef SA_SIGINFO kill(getpid(), SIGUSR1); @@ -43,14 +43,14 @@ static void fde_handler(struct event_context *ev_ctx, struct fd_event *f, static void finished_handler(struct event_context *ev_ctx, struct timed_event *te, struct timeval tval, void *private) { - int *finished = private; + int *finished = (int *)private; (*finished) = 1; } static void count_handler(struct event_context *ev_ctx, struct signal_event *te, int signum, int count, void *info, void *private) { - int *countp = private; + int *countp = (int *)private; (*countp) += count; } diff --git a/source4/torture/local/iconv.c b/source4/torture/local/iconv.c index 8c2d5a3054..06659b5e9c 100644 --- a/source4/torture/local/iconv.c +++ b/source4/torture/local/iconv.c @@ -34,7 +34,7 @@ static bool iconv_untestable(struct torture_context *tctx) { iconv_t cd; - if (!lp_parm_bool(-1, "iconv", "native", true)) + if (!lp_parm_bool(NULL, "iconv", "native", true)) torture_skip(tctx, "system iconv disabled - skipping test"); cd = iconv_open("UTF-16LE", "UCS-4LE"); @@ -314,10 +314,10 @@ static bool test_codepoint(struct torture_context *tctx, unsigned int codepoint) static bool test_next_codepoint(struct torture_context *tctx) { + unsigned int codepoint; if (iconv_untestable(tctx)) return true; - unsigned int codepoint; for (codepoint=0;codepoint<(1<<20);codepoint++) { if (!test_codepoint(tctx, codepoint)) return false; @@ -403,13 +403,13 @@ struct torture_suite *torture_local_iconv(TALLOC_CTX *mem_ctx) struct torture_suite *suite = torture_suite_create(mem_ctx, "ICONV"); torture_suite_add_simple_test(suite, "next_codepoint()", - test_next_codepoint); + test_next_codepoint); torture_suite_add_simple_test(suite, "first 1M codepoints", - test_first_1m); + test_first_1m); torture_suite_add_simple_test(suite, "5M random UTF-16LE sequences", - test_random_5m); + test_random_5m); return suite; } diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c index 7c5de2dd56..e113b63804 100644 --- a/source4/torture/local/irpc.c +++ b/source4/torture/local/irpc.c @@ -86,7 +86,7 @@ static bool test_addone(struct torture_context *test, const void *_data, { struct echo_AddOne r; NTSTATUS status; - const struct irpc_test_data *data = _data; + const struct irpc_test_data *data = (const struct irpc_test_data *)_data; uint32_t value = (uint32_t)_value; /* make the call */ @@ -115,7 +115,7 @@ static bool test_echodata(struct torture_context *tctx, { struct echo_EchoData r; NTSTATUS status; - const struct irpc_test_data *data = tcase_data; + const struct irpc_test_data *data = (const struct irpc_test_data *)tcase_data; TALLOC_CTX *mem_ctx = tctx; /* make the call */ @@ -144,7 +144,7 @@ static bool test_echodata(struct torture_context *tctx, static void irpc_callback(struct irpc_request *irpc) { - struct echo_AddOne *r = irpc->r; + struct echo_AddOne *r = (struct echo_AddOne *)irpc->r; int *pong_count = (int *)irpc->async.private; NTSTATUS status = irpc_call_recv(irpc); if (!NT_STATUS_IS_OK(status)) { @@ -166,7 +166,7 @@ static bool test_speed(struct torture_context *tctx, { int ping_count = 0; int pong_count = 0; - const struct irpc_test_data *data = tcase_data; + const struct irpc_test_data *data = (const struct irpc_test_data *)tcase_data; struct timeval tv; struct echo_AddOne r; TALLOC_CTX *mem_ctx = tctx; diff --git a/source4/torture/local/sddl.c b/source4/torture/local/sddl.c index ac10627783..3e6382309e 100644 --- a/source4/torture/local/sddl.c +++ b/source4/torture/local/sddl.c @@ -33,7 +33,7 @@ static bool test_sddl(struct torture_context *tctx, { struct security_descriptor *sd, *sd2; struct dom_sid *domain; - const char *sddl = test_data; + const char *sddl = (const char *)test_data; const char *sddl2; TALLOC_CTX *mem_ctx = tctx; diff --git a/source4/torture/local/share.c b/source4/torture/local/share.c index 528f34f861..a4250bccf9 100644 --- a/source4/torture/local/share.c +++ b/source4/torture/local/share.c @@ -27,7 +27,7 @@ static bool test_list_empty(struct torture_context *tctx, const void *tcase_data, const void *test_data) { - struct share_context *ctx = discard_const(tcase_data); + struct share_context *ctx = (struct share_context *)discard_const(tcase_data); int count; const char **names; @@ -41,7 +41,7 @@ static bool test_create(struct torture_context *tctx, const void *tcase_data, const void *test_data) { - struct share_context *ctx = discard_const(tcase_data); + struct share_context *ctx = (struct share_context *)discard_const(tcase_data); int count; const char **names; int i; @@ -79,7 +79,7 @@ static bool test_create_invalid(struct torture_context *tctx, const void *tcase_data, const void *test_data) { - struct share_context *ctx = discard_const(tcase_data); + struct share_context *ctx = (struct share_context *)discard_const(tcase_data); NTSTATUS status; status = share_create(ctx, "bla", NULL, 0); @@ -102,7 +102,7 @@ static bool test_share_remove_invalid(struct torture_context *tctx, const void *tcase_data, const void *test_data) { - struct share_context *ctx = discard_const(tcase_data); + struct share_context *ctx = (struct share_context *)discard_const(tcase_data); NTSTATUS status; status = share_remove(ctx, "nonexistant"); @@ -121,7 +121,7 @@ static bool test_share_remove(struct torture_context *tctx, const void *tcase_data, const void *test_data) { - struct share_context *ctx = discard_const(tcase_data); + struct share_context *ctx = (struct share_context *)discard_const(tcase_data); struct share_info inf[] = { { SHARE_INFO_STRING, SHARE_TYPE, discard_const_p(void *, "IPC$") }, { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "/tmp/bla") } @@ -144,7 +144,7 @@ static bool test_double_create(struct torture_context *tctx, const void *tcase_data, const void *test_data) { - struct share_context *ctx = discard_const(tcase_data); + struct share_context *ctx = (struct share_context *)discard_const(tcase_data); struct share_info inf[] = { { SHARE_INFO_STRING, SHARE_TYPE, discard_const_p(void *, "IPC$") }, { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "/tmp/bla") } diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 4f0bfa8e06..d18a1cb6e9 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -123,7 +123,7 @@ static struct smbcli_state *connect_one(char *share, int snum, int conn) char **unc_list = NULL; int num_unc_names; const char *p; - p = lp_parm_string(-1, "torture", "unclist"); + p = lp_parm_string(NULL, "torture", "unclist"); if (p) { char *h, *s; unc_list = file_lines_load(p, &num_unc_names, NULL); diff --git a/source4/torture/ndr/lsa.c b/source4/torture/ndr/lsa.c index 768c8db63e..a72a03fa38 100644 --- a/source4/torture/ndr/lsa.c +++ b/source4/torture/ndr/lsa.c @@ -1747,7 +1747,7 @@ static const uint8_t lsarlookupsids3_out_data[] = { }; static bool lsarlookupsids3_out_check(struct torture_context *tctx, - struct lsa_LookupSids3 *r) + struct lsa_LookupSids3 *r) { /* FIXME: Handle */ torture_assert(tctx, r->out.names != NULL, "names ptr"); diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c index 5c7dfc7c29..18ede54867 100644 --- a/source4/torture/ndr/ndr.c +++ b/source4/torture/ndr/ndr.c @@ -36,7 +36,7 @@ static bool wrap_ndr_pull_test(struct torture_context *tctx, struct torture_test *test) { bool (*check_fn) (struct torture_context *ctx, void *data) = test->fn; - const struct ndr_pull_test_data *data = test->data; + const struct ndr_pull_test_data *data = (const struct ndr_pull_test_data *)test->data; void *ds = talloc_zero_size(tctx, data->struct_size); struct ndr_pull *ndr = ndr_pull_init_blob(&(data->data), tctx); diff --git a/source4/torture/ndr/winreg.c b/source4/torture/ndr/winreg.c index d7c956efd6..ab256a7152 100644 --- a/source4/torture/ndr/winreg.c +++ b/source4/torture/ndr/winreg.c @@ -240,7 +240,7 @@ static const uint8_t querymultiplevalues_in_data[] = { }; static bool querymultiplevalues_in_check(struct torture_context *tctx, - struct winreg_QueryMultipleValues *r) + struct winreg_QueryMultipleValues *r) { torture_assert_int_equal(tctx, r->in.num_values, 1, "num values"); torture_assert_str_equal(tctx, r->in.values[0].name->name, "HOMEPATH", @@ -272,7 +272,7 @@ static const uint8_t querymultiplevalues_out_data[] = { }; static bool querymultiplevalues_out_check(struct torture_context *tctx, - struct winreg_QueryMultipleValues *r) + struct winreg_QueryMultipleValues *r) { torture_assert_str_equal(tctx, r->out.values[0].name->name, "HOMEPATH", "name"); @@ -458,7 +458,7 @@ static const uint8_t getkeysecurity_in_data[] = { }; static bool getkeysecurity_in_check(struct torture_context *tctx, - struct winreg_GetKeySecurity *r) + struct winreg_GetKeySecurity *r) { /* FIXME: Handle */ torture_assert_int_equal(tctx, r->in.sec_info, 2, "sec info"); @@ -476,7 +476,7 @@ static const uint8_t getkeysecurity_out_data[] = { }; static bool getkeysecurity_out_check(struct torture_context *tctx, - struct winreg_GetKeySecurity *r) + struct winreg_GetKeySecurity *r) { torture_assert_int_equal(tctx, r->in.sd->size, 20, "sd size"); torture_assert_int_equal(tctx, r->in.sd->len, 20, "sd len"); diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c index 026384cb8b..ab112658e2 100644 --- a/source4/torture/raw/acls.c +++ b/source4/torture/raw/acls.c @@ -1736,7 +1736,7 @@ done: */ bool torture_raw_acls(struct torture_context *tctx, struct smbcli_state *cli) { - BOOL ret = True; + bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { return false; diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index ea5c09c335..370c1f510b 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -87,7 +87,7 @@ static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("waiting for completion\n"); while (*count != num_ops) { event_loop_once(cli->transport->socket->event.ctx); - if (lp_parm_bool(-1, "torture", "progress", true)) { + if (lp_parm_bool(NULL, "torture", "progress", true)) { printf("count=%d\r", *count); fflush(stdout); } @@ -152,10 +152,10 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - io2.in.dest_host = lp_parm_string(-1, "torture", "host"); + io2.in.dest_host = lp_parm_string(NULL, "torture", "host"); io2.in.port = 0; - io2.in.called_name = lp_parm_string(-1, "torture", "host"); - io2.in.service = lp_parm_string(-1, "torture", "share"); + io2.in.called_name = lp_parm_string(NULL, "torture", "host"); + io2.in.service = lp_parm_string(NULL, "torture", "share"); io2.in.service_type = "A:"; io2.in.credentials = cmdline_credentials; @@ -177,7 +177,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) while (*count != torture_numops) { event_loop_once(event_ctx); - if (lp_parm_bool(-1, "torture", "progress", true)) { + if (lp_parm_bool(NULL, "torture", "progress", true)) { printf("count=%d\r", *count); fflush(stdout); } @@ -297,7 +297,7 @@ static BOOL test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("waiting for completion\n"); while (*count != num_ops) { event_loop_once(event_ctx); - if (lp_parm_bool(-1, "torture", "progress", true)) { + if (lp_parm_bool(NULL, "torture", "progress", true)) { printf("count=%d\r", *count); fflush(stdout); } @@ -340,10 +340,10 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) int *count = talloc_zero(mem_ctx, int); BOOL ret = True; - io1.in.dest_host = lp_parm_string(-1, "torture", "host"); + io1.in.dest_host = lp_parm_string(NULL, "torture", "host"); io1.in.port = 0; - io1.in.called_name = lp_parm_string(-1, "torture", "host"); - io1.in.service = lp_parm_string(-1, "torture", "share"); + io1.in.called_name = lp_parm_string(NULL, "torture", "host"); + io1.in.service = lp_parm_string(NULL, "torture", "share"); io1.in.service_type = "A:"; io1.in.credentials = cmdline_credentials; io1.in.workgroup = lp_workgroup(); @@ -364,7 +364,7 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) while (*count < torture_numops) { event_loop_once(event_ctx); - if (lp_parm_bool(-1, "torture", "progress", true)) { + if (lp_parm_bool(NULL, "torture", "progress", true)) { printf("count=%d\r", *count); fflush(stdout); } diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 79771a004d..dacc9958be 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -277,8 +277,8 @@ static BOOL test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - share = lp_parm_string(-1, "torture", "share"); - host = lp_parm_string(-1, "torture", "host"); + share = lp_parm_string(NULL, "torture", "share"); + host = lp_parm_string(NULL, "torture", "host"); printf("create a second tree context on the same session\n"); tree = smbcli_tree_init(cli->session, mem_ctx, False); @@ -385,8 +385,8 @@ static BOOL test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - share = lp_parm_string(-1, "torture", "share"); - host = lp_parm_string(-1, "torture", "host"); + share = lp_parm_string(NULL, "torture", "share"); + host = lp_parm_string(NULL, "torture", "host"); printf("create the first new sessions\n"); session1 = smbcli_session_init(cli->transport, mem_ctx, False); @@ -746,8 +746,8 @@ static BOOL test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - share = lp_parm_string(-1, "torture", "share"); - host = lp_parm_string(-1, "torture", "host"); + share = lp_parm_string(NULL, "torture", "share"); + host = lp_parm_string(NULL, "torture", "host"); printf("create a second tree context on the same session\n"); tree = smbcli_tree_init(cli->session, mem_ctx, False); diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c index 5e80564380..810667134a 100644 --- a/source4/torture/raw/eas.c +++ b/source4/torture/raw/eas.c @@ -247,10 +247,10 @@ static BOOL test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("TESTING SETFILEINFO MAX. EA_SET\n"); - maxeasize = lp_parm_int(-1, "torture", "maxeasize", 65536); - maxeanames = lp_parm_int(-1, "torture", "maxeanames", 101); - maxeastart = lp_parm_int(-1, "torture", "maxeastart", 1); - maxeadebug = lp_parm_int(-1, "torture", "maxeadebug", 0); + maxeasize = lp_parm_int(NULL, "torture", "maxeasize", 65536); + maxeanames = lp_parm_int(NULL, "torture", "maxeanames", 101); + maxeastart = lp_parm_int(NULL, "torture", "maxeastart", 1); + maxeadebug = lp_parm_int(NULL, "torture", "maxeadebug", 0); /* Do some sanity check on possibly passed parms */ if (maxeasize <= 0) { @@ -447,7 +447,7 @@ done: */ bool torture_raw_eas(struct torture_context *torture, struct smbcli_state *cli) { - BOOL ret = True; + bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { return False; diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index e4ab9d9e4a..c47f3c7978 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -599,8 +599,8 @@ static bool test_async(struct torture_context *tctx, session->vuid = setup.out.vuid; printf("create new tree context\n"); - share = lp_parm_string(-1, "torture", "share"); - host = lp_parm_string(-1, "torture", "host"); + share = lp_parm_string(NULL, "torture", "share"); + host = lp_parm_string(NULL, "torture", "host"); tree = smbcli_tree_init(session, tctx, False); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 6ef33be759..55cab9e117 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -318,7 +318,7 @@ BOOL torture_bench_lock(struct torture_context *torture) progress = torture_setting_bool(torture, "progress", true); - nprocs = lp_parm_int(-1, "torture", "nprocs", 4); + nprocs = lp_parm_int(NULL, "torture", "nprocs", 4); state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs); diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c index c4d7bc2534..2df2c6c84e 100644 --- a/source4/torture/raw/mkdir.c +++ b/source4/torture/raw/mkdir.c @@ -130,7 +130,7 @@ static BOOL test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) md.t2mkdir.in.eas[2].value = data_blob_talloc(mem_ctx, "xx1", 3); status = smb_raw_mkdir(cli->tree, &md); - if (lp_parm_bool(-1, "torture", "samba3", False) + if (lp_parm_bool(NULL, "torture", "samba3", false) && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)) { d_printf("EAS not supported -- not treating as fatal\n"); } diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c index b67d756ed9..95ba319eea 100644 --- a/source4/torture/raw/mux.c +++ b/source4/torture/raw/mux.c @@ -176,7 +176,7 @@ static BOOL test_mux_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.writex.in.wmode = 0; io.writex.in.remaining = 0; io.writex.in.count = 4; - io.writex.in.data = (void *)&fnum; + io.writex.in.data = (const uint8_t *)&fnum; req = smb_raw_write_send(cli->tree, &io); /* unlock the range */ diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index d744a891e5..b9d1d07b5e 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -434,7 +434,6 @@ static BOOL test_notify_mask_change(struct smbcli_state *cli, TALLOC_CTX *mem_ct union smb_open io; int fnum; struct smbcli_request *req1, *req2; - union smb_setfileinfo sfinfo; printf("TESTING CHANGE NOTIFY WITH MASK CHANGE\n"); @@ -712,7 +711,7 @@ static BOOL test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_ATTRIBUTES, 1); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { printf("Samba3 does not yet support create times " "everywhere\n"); } diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index 104a2056e3..c0a32e00f4 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -398,7 +398,7 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io.openx.in.file_attrs = FILE_ATTRIBUTE_SYSTEM; status = smb_raw_open(cli->tree, mem_ctx, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE, attrib & ~(FILE_ATTRIBUTE_NONINDEXED| FILE_ATTRIBUTE_SPARSE)); @@ -569,7 +569,7 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_raw_open(cli->tree, mem_ctx, &io); if ((io.t2open.in.num_eas != 0) && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED) - && lp_parm_bool(-1, "torture", "samba3", False)) { + && lp_parm_bool(NULL, "torture", "samba3", false)) { printf("(%s) EAs not supported, not treating as fatal " "in Samba3 test\n", __location__); io.t2open.in.num_eas = 0; @@ -1346,8 +1346,8 @@ static BOOL test_raw_open_multi(void) struct smbcli_state **clients; struct smbcli_request **requests; union smb_open *ios; - const char *host = lp_parm_string(-1, "torture", "host"); - const char *share = lp_parm_string(-1, "torture", "share"); + const char *host = lp_parm_string(NULL, "torture", "host"); + const char *share = lp_parm_string(NULL, "torture", "share"); int i, num_files = 3; struct event_context *ev; int num_ok = 0; diff --git a/source4/torture/raw/pingpong.c b/source4/torture/raw/pingpong.c index 6841253c91..6d84ff1ae9 100755 --- a/source4/torture/raw/pingpong.c +++ b/source4/torture/raw/pingpong.c @@ -52,10 +52,7 @@ #include "torture/util.h" #include "param/param.h" - - - -void lock_byte(struct smbcli_state *cli, int fd, int offset, int lock_timeout) +static void lock_byte(struct smbcli_state *cli, int fd, int offset, int lock_timeout) { union smb_lock io; struct smb_lock_entry lock; @@ -93,7 +90,7 @@ try_again: } } -void unlock_byte(struct smbcli_state *cli, int fd, int offset) +static void unlock_byte(struct smbcli_state *cli, int fd, int offset) { union smb_lock io; struct smb_lock_entry lock; @@ -120,7 +117,7 @@ void unlock_byte(struct smbcli_state *cli, int fd, int offset) } } -void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset) +static void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset) { union smb_write io; NTSTATUS status; @@ -140,7 +137,7 @@ void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset) } } -void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset) +static void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset) { union smb_read io; NTSTATUS status; @@ -179,7 +176,7 @@ static double end_timer(void) /* ping pong */ -BOOL torture_ping_pong(struct torture_context *torture) +bool torture_ping_pong(struct torture_context *torture) { const char *fn; int num_locks; @@ -194,21 +191,21 @@ BOOL torture_ping_pong(struct torture_context *torture) uint8_t *val; int count, loops; - fn = lp_parm_string(-1, "torture", "filename"); + fn = lp_parm_string(NULL, "torture", "filename"); if (fn == NULL) { DEBUG(0,("You must specify the filename using --option=torture:filename=...\n")); return false; } - num_locks = lp_parm_int(-1, "torture", "num_locks", -1); + num_locks = lp_parm_int(NULL, "torture", "num_locks", -1); if (num_locks == -1) { DEBUG(0,("You must specify num_locks using --option=torture:num_locks=...\n")); return false; } - do_reads = lp_parm_bool(-1, "torture", "read", False); - do_writes = lp_parm_bool(-1, "torture", "write", False); - lock_timeout = lp_parm_int(-1, "torture", "lock_timeout", 100000); + do_reads = lp_parm_bool(NULL, "torture", "read", false); + do_writes = lp_parm_bool(NULL, "torture", "write", false); + lock_timeout = lp_parm_int(NULL, "torture", "lock_timeout", 100000); if (!torture_open_connection(&cli, 0)) { DEBUG(0,("Could not open connection\n")); diff --git a/source4/torture/raw/qfsinfo.c b/source4/torture/raw/qfsinfo.c index dc09e55b63..05e6f78324 100644 --- a/source4/torture/raw/qfsinfo.c +++ b/source4/torture/raw/qfsinfo.c @@ -121,7 +121,7 @@ static union smb_fsinfo *find(const char *name) quiescent, which is sometimes hard to achieve */ bool torture_raw_qfsinfo(struct torture_context *torture, - struct smbcli_state *cli) + struct smbcli_state *cli) { int i; BOOL ret = True; diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index b00b377c7f..61bf027ae8 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -482,7 +482,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.readx.out.remaining, 0xFFFF); CHECK_VALUE(io.readx.out.compaction_mode, 0); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { printf("SAMBA3: large read extension\n"); CHECK_VALUE(io.readx.out.nread, 80000); } else { @@ -526,7 +526,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) io.readx.in.maxcnt = 0x10000; status = smb_raw_read(cli->tree, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { printf("SAMBA3: large read extension\n"); CHECK_VALUE(io.readx.out.nread, 0x10000); } else { @@ -536,7 +536,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) io.readx.in.maxcnt = 0x10001; status = smb_raw_read(cli->tree, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { printf("SAMBA3: large read extension\n"); CHECK_VALUE(io.readx.out.nread, 0x10001); } else { diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index c51c6ea2df..81181e49ab 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -214,9 +214,9 @@ done: basic testing of streams calls */ bool torture_raw_streams(struct torture_context *torture, - struct smbcli_state *cli) + struct smbcli_state *cli) { - BOOL ret = True; + bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { return False; diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c index 59e1aeb27c..88f9a71aaf 100644 --- a/source4/torture/raw/unlink.c +++ b/source4/torture/raw/unlink.c @@ -129,7 +129,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { /* * In Samba3 we gave up upon getting the error codes in * wildcard unlink correct. Trying gentest showed that this is @@ -157,7 +157,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.pattern = BASEDIR "\\t*"; io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); } else { @@ -169,7 +169,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.pattern = BASEDIR "\\*.dat"; io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); } else { @@ -179,7 +179,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) io.unlink.in.pattern = BASEDIR "\\*.tx?"; io.unlink.in.attrib = 0; status = smb_raw_unlink(cli->tree, &io); - if (lp_parm_bool(-1, "torture", "samba3", False)) { + if (lp_parm_bool(NULL, "torture", "samba3", false)) { CHECK_STATUS(status, NT_STATUS_NO_SUCH_FILE); } else { @@ -282,7 +282,7 @@ static bool test_delete_on_close(struct torture_context *tctx, CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); - if (!lp_parm_bool(-1, "torture", "samba3", False)) { + if (!lp_parm_bool(NULL, "torture", "samba3", false)) { /* * Known deficiency, also skipped in base-delete. diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c index 76d838517c..451b8ab120 100644 --- a/source4/torture/rpc/autoidl.c +++ b/source4/torture/rpc/autoidl.c @@ -95,8 +95,7 @@ static void reopen(TALLOC_CTX *mem_ctx, talloc_free(*p); - status = torture_rpc_connection(mem_ctx, - p, iface); + status = torture_rpc_connection(mem_ctx, p, iface); if (!NT_STATUS_IS_OK(status)) { printf("Failed to reopen '%s' - %s\n", iface->name, nt_errstr(status)); exit(1); diff --git a/source4/torture/rpc/bench.c b/source4/torture/rpc/bench.c index be00e0b7a6..7f71723e6d 100644 --- a/source4/torture/rpc/bench.c +++ b/source4/torture/rpc/bench.c @@ -72,7 +72,7 @@ static BOOL bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct timeval tv = timeval_current(); BOOL ret = True; - int timelimit = lp_parm_int(-1, "torture", "timelimit", 10); + int timelimit = lp_parm_int(NULL, "torture", "timelimit", 10); int count=0; printf("Running for %d seconds\n", timelimit); @@ -82,7 +82,7 @@ static BOOL bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) talloc_free(tmp_ctx); count++; if (count % 50 == 0) { - if (lp_parm_bool(-1, "torture", "progress", true)) { + if (lp_parm_bool(NULL, "torture", "progress", true)) { printf("%.1f queries per second \r", count / timeval_elapsed(&tv)); } diff --git a/source4/torture/rpc/countcalls.c b/source4/torture/rpc/countcalls.c index c1fdc069cb..0d3df0ffb3 100644 --- a/source4/torture/rpc/countcalls.c +++ b/source4/torture/rpc/countcalls.c @@ -111,7 +111,7 @@ BOOL torture_rpc_countcalls(struct torture_context *torture) if (!mem_ctx) { return False; } - iface_name = lp_parm_string(-1, "countcalls", "interface"); + iface_name = lp_parm_string(NULL, "countcalls", "interface"); if (iface_name != NULL) { iface = ndr_table_by_name(iface_name); if (!iface) { diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c index c3ec54cbcd..3f59f1d56d 100644 --- a/source4/torture/rpc/drsuapi.c +++ b/source4/torture/rpc/drsuapi.c @@ -538,7 +538,7 @@ static bool test_DsGetNCChanges(struct torture_context *tctx, r.in.req.req5.highwatermark.highest_usn = 0; r.in.req.req5.uptodateness_vector = NULL; r.in.req.req5.replica_flags = 0; - if (lp_parm_bool(-1, "drsuapi", "compression", false)) { + if (lp_parm_bool(NULL, "drsuapi", "compression", false)) { r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } r.in.req.req5.max_object_count = 0; @@ -560,10 +560,10 @@ static bool test_DsGetNCChanges(struct torture_context *tctx, r.in.req.req8.highwatermark.highest_usn = 0; r.in.req.req8.uptodateness_vector = NULL; r.in.req.req8.replica_flags = 0; - if (lp_parm_bool(-1, "drsuapi", "compression", false)) { + if (lp_parm_bool(NULL, "drsuapi", "compression", false)) { r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } - if (lp_parm_bool(-1, "drsuapi", "neighbour_writeable",true)) { + if (lp_parm_bool(NULL, "drsuapi", "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 diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index bf3e59c380..5ea578e041 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -84,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(NULL, "torture", "binding"); ctx = talloc_zero(mem_ctx, struct DsSyncTest); if (!ctx) return NULL; @@ -149,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(NULL, "dssync", "xpress", false)) { our_bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS; } our_bind_info28->site_guid = GUID_zero(); @@ -420,11 +420,11 @@ 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(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(NULL, "dssync", "save_pwd_blobs_dir"); for (; cur; cur = cur->next_object) { const char *dn; @@ -560,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(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(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(NULL, "dssync", "get_nc_changes_level", array[0].level); - if (lp_parm_bool(-1,"dssync","print_pwd_blobs",False)) { + if (lp_parm_bool(NULL, "dssync", "print_pwd_blobs", false)) { const struct samr_Password *nthash; nthash = cli_credentials_get_nt_hash(ctx->new_dc.credentials, ctx); if (nthash) { @@ -606,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(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(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 @@ -637,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(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(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 @@ -760,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(NULL, "dssync", "nt4-1", 3); + r.in.req.req1.unknown2 = lp_parm_int(NULL, "dssync", "nt4-2", 0x00004000); while (1) { r.in.req.req1.length = cookie.length; @@ -800,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; diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index 52f6d76d0e..c873cdf0ae 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -78,8 +78,8 @@ static bool test_echodata(struct torture_context *tctx, len = 1 + (random() % 5000); } - data_in = talloc_size(tctx, len); - data_out = talloc_size(tctx, len); + data_in = talloc_array(tctx, uint8_t, len); + data_out = talloc_array(tctx, uint8_t, len); for (i=0;i<len;i++) { data_in[i] = i; } @@ -159,7 +159,7 @@ static bool test_sinkdata(struct torture_context *tctx, len = 200000 + (random() % 5000); } - data_in = talloc_size(tctx, len); + data_in = talloc_array(tctx, uint8_t, len); for (i=0;i<len;i++) { data_in[i] = i+1; } diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 539923a2e0..c1d863454c 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -125,7 +125,7 @@ static bool test_ReadEventLog(struct torture_context *tctx, /* Now read the actual record */ r.in.number_of_bytes = *r.out.real_size; - r.out.data = talloc_size(tctx, r.in.number_of_bytes); + r.out.data = talloc_array(tctx, uint8_t, r.in.number_of_bytes); status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r); diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 46660231f8..2cc2b78a78 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -1224,7 +1224,7 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, NTSTATUS status; struct lsa_QuerySecurity r; - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping QuerySecurity test against Samba4\n"); return True; } @@ -1463,7 +1463,7 @@ static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p, printf("\nTesting lsaRQueryForestTrustInformation\n"); - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping QueryForestTrustInformation against Samba4\n"); return True; } @@ -1830,7 +1830,7 @@ static BOOL test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, NTSTATUS status; int i; BOOL ret = True; - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping QueryDomainInformationPolicy test against Samba4\n"); return True; } @@ -1866,7 +1866,7 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, BOOL ret = True; printf("\nTesting QueryInfoPolicy\n"); - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping QueryInfoPolicy against Samba4\n"); return True; } @@ -1904,7 +1904,7 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, int i; BOOL ret = True; printf("\nTesting QueryInfoPolicy2\n"); - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping QueryInfoPolicy2 against Samba4\n"); return True; } diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 907772ac8a..6352865d98 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -1226,7 +1226,7 @@ static bool test_GetDomainInfo(struct torture_context *tctx, static void async_callback(struct rpc_request *req) { - int *counter = req->async.private_data; + int *counter = (int *)req->async.private_data; if (NT_STATUS_IS_OK(req->status)) { (*counter)++; } @@ -1278,7 +1278,7 @@ static bool test_GetDomainInfo_async(struct torture_context *tctx, for (i=0;i<ASYNC_COUNT;i++) { creds_client_authenticator(creds, &a); - creds_async[i] = talloc_memdup(creds, creds, sizeof(*creds)); + creds_async[i] = (struct creds_CredentialState *)talloc_memdup(creds, creds, sizeof(*creds)); req[i] = dcerpc_netr_LogonGetDomainInfo_send(p, tctx, &r); req[i]->async.callback = async_callback; diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 73bb12de87..e6f54037bc 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -1230,7 +1230,7 @@ static BOOL test_join3(TALLOC_CTX *mem_ctx, struct cli_credentials *wks_creds; status = smbcli_full_connection(mem_ctx, &cli, - lp_parm_string(-1, "torture", "host"), + lp_parm_string(NULL, "torture", "host"), "IPC$", NULL, smb_creds, NULL); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_full_connection failed: %s\n", diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index b149af1859..92c4da6321 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -1573,7 +1573,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) u.info21.fields_present = SAMR_FIELD_WORKSTATIONS | SAMR_FIELD_LOGON_HOURS; u.info21.workstations.string = TEST_MACHINE_NAME; u.info21.logon_hours.units_per_week = 168; - u.info21.logon_hours.bits = talloc_zero_size(mem_ctx, 168); + u.info21.logon_hours.bits = talloc_zero_array(mem_ctx, uint8_t, 168); status = dcerpc_samr_SetUserInfo(torture_join_samr_pipe(user_ctx_wrong_time), mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index 757142003a..2a70a5b71f 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -84,7 +84,7 @@ static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct samr_Shutdown r; - if (!lp_parm_bool(-1, "torture", "dangerous", False)) { + if (!lp_parm_bool(NULL, "torture", "dangerous", false)) { printf("samr_Shutdown disabled - enable dangerous tests to use\n"); return True; } @@ -110,7 +110,7 @@ static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct lsa_String string; struct samr_Password hash; - if (!lp_parm_bool(-1, "torture", "dangerous", False)) { + if (!lp_parm_bool(NULL, "torture", "dangerous", false)) { printf("samr_SetDsrmPassword disabled - enable dangerous tests to use\n"); return True; } @@ -159,7 +159,7 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, s.in.sec_info = 7; s.in.sdbuf = r.out.sdbuf; - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping SetSecurity test against Samba4\n"); return True; } @@ -415,7 +415,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, TEST_USERINFO_INT(21, logon_hours.bits[3], 21, logon_hours.bits[3], 4, SAMR_FIELD_LOGON_HOURS); - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping Set Account Flag tests against Samba4\n"); return ret; } @@ -2121,7 +2121,7 @@ static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping MultipleMembers Alias tests against Samba4\n"); return ret; } @@ -3180,7 +3180,7 @@ static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct #define ASYNC_COUNT 100 struct rpc_request *req[ASYNC_COUNT]; - if (!lp_parm_bool(-1, "torture", "dangerous", False)) { + if (!lp_parm_bool(NULL, "torture", "dangerous", false)) { printf("samr async test disabled - enable dangerous tests to use\n"); return True; } @@ -4067,7 +4067,7 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return False; } - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping SetMemberAttributesOfGroup test against Samba4\n"); } else { /* this one is quite strange. I am using random inputs in the @@ -4256,7 +4256,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret &= test_QueryDisplayInfo3(p, mem_ctx, &domain_handle); ret &= test_QueryDisplayInfo_continue(p, mem_ctx, &domain_handle); - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { printf("skipping GetDisplayEnumerationIndex test against Samba4\n"); } else { ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle); diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index baf4edca98..013a6db0bb 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -68,7 +68,7 @@ static NTSTATUS test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, sizeof(ninfo.challenge)); if (nt_hash) { ninfo.nt.length = 24; - ninfo.nt.data = talloc_size(mem_ctx, 24); + ninfo.nt.data = talloc_array(mem_ctx, uint8_t, 24); SMBOWFencrypt(nt_hash->hash, ninfo.challenge, ninfo.nt.data); } else { ninfo.nt.length = 0; @@ -77,7 +77,7 @@ static NTSTATUS test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (lm_hash) { ninfo.lm.length = 24; - ninfo.lm.data = talloc_size(mem_ctx, 24); + ninfo.lm.data = talloc_array(mem_ctx, uint8_t, 24); SMBOWFencrypt(lm_hash->hash, ninfo.challenge, ninfo.lm.data); } else { ninfo.lm.length = 0; diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 2494fbefff..7d963be1bb 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -233,7 +233,7 @@ static bool test_schannel(struct torture_context *tctx, { struct test_join *join_ctx; NTSTATUS status; - const char *binding = lp_parm_string(-1, "torture", "binding"); + const char *binding = lp_parm_string(NULL, "torture", "binding"); struct dcerpc_binding *b; struct dcerpc_pipe *p = NULL; struct dcerpc_pipe *p_netlogon = NULL; @@ -435,7 +435,7 @@ bool torture_rpc_schannel2(struct torture_context *torture) torture_assert(torture, join_ctx != NULL, "Failed to join domain with acct_flags=ACB_WSTRUST"); - credentials2 = talloc_memdup(torture, credentials1, sizeof(*credentials1)); + credentials2 = (struct cli_credentials *)talloc_memdup(torture, credentials1, sizeof(*credentials1)); credentials1->netlogon_creds = NULL; credentials2->netlogon_creds = NULL; diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c index 0e1c2666f8..a976d2fec2 100644 --- a/source4/torture/rpc/session_key.c +++ b/source4/torture/rpc/session_key.c @@ -145,7 +145,8 @@ static bool test_secrets(struct torture_context *torture, const void *_data) struct dcerpc_pipe *p; struct policy_handle *handle; struct dcerpc_binding *binding; - const struct secret_settings *settings = _data; + const struct secret_settings *settings = + (const struct secret_settings *)_data; lp_set_cmdline("ntlmssp client:keyexchange", settings->keyexchange?"True":"False"); lp_set_cmdline("ntlmssp_client:ntlm2", settings->ntlm2?"True":"False"); diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c index 2f2b4ec485..c9006baaf5 100644 --- a/source4/torture/rpc/svcctl.c +++ b/source4/torture/rpc/svcctl.c @@ -80,7 +80,7 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_ if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) { r.in.buf_size = *r.out.bytes_needed; - r.out.service = talloc_size(tctx, *r.out.bytes_needed); + r.out.service = talloc_array(tctx, uint8_t, *r.out.bytes_needed); status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r); diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index e20699cc04..f32d6832a3 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -126,7 +126,7 @@ struct test_join *torture_create_testuser(struct torture_context *torture, int policy_min_pw_len = 0; struct test_join *join; char *random_pw; - const char *dc_binding = lp_parm_string(-1, "torture", "dc_binding"); + const char *dc_binding = lp_parm_string(NULL, "torture", "dc_binding"); join = talloc(NULL, struct test_join); if (join == NULL) { @@ -327,9 +327,9 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name, tj->libnet_r = libnet_r; libnet_ctx->cred = cmdline_credentials; - libnet_r->in.binding = lp_parm_string(-1, "torture", "binding"); + libnet_r->in.binding = lp_parm_string(NULL, "torture", "binding"); if (!libnet_r->in.binding) { - libnet_r->in.binding = talloc_asprintf(libnet_r, "ncacn_np:%s", lp_parm_string(-1, "torture", "host")); + libnet_r->in.binding = talloc_asprintf(libnet_r, "ncacn_np:%s", lp_parm_string(NULL, "torture", "host")); } libnet_r->in.level = LIBNET_JOINDOMAIN_SPECIFIED; libnet_r->in.netbios_name = machine_name; diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index fdfc4378ab..c9a5732d2a 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -74,9 +74,9 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha DATA_BLOB data; int i; - if (lp_parm_bool(-1, "torture", "dangerous", False)) { + if (lp_parm_bool(NULL, "torture", "dangerous", false)) { data = data_blob_talloc(tree, NULL, 160000); - } else if (lp_parm_bool(-1, "torture", "samba4", False)) { + } else if (lp_parm_bool(NULL, "torture", "samba4", false)) { data = data_blob_talloc(tree, NULL, UINT16_MAX); } else { data = data_blob_talloc(tree, NULL, 120000); diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c index c5182fb553..86ca56ba55 100644 --- a/source4/torture/smb2/getinfo.c +++ b/source4/torture/smb2/getinfo.c @@ -105,7 +105,7 @@ static BOOL torture_smb2_fileinfo(struct smb2_tree *tree) file_levels[i].dinfo.query_secdesc.in.secinfo_flags = 0x7; } if (file_levels[i].level == RAW_FILEINFO_SMB2_ALL_EAS) { - if (lp_parm_bool(-1, "torture", "samba4", False)) { + if (lp_parm_bool(NULL, "torture", "samba4", false)) { continue; } file_levels[i].finfo.all_eas.in.continue_flags = diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c index caa3a5fd52..8c55813c8c 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -27,6 +27,7 @@ #include "system/time.h" #include "librpc/gen_ndr/ndr_security.h" #include "param/param.h" +#include "torture/smb2/proto.h" /* @@ -302,8 +303,8 @@ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle) BOOL torture_smb2_connection(TALLOC_CTX *mem_ctx, struct smb2_tree **tree) { NTSTATUS status; - const char *host = lp_parm_string(-1, "torture", "host"); - const char *share = lp_parm_string(-1, "torture", "share"); + const char *host = lp_parm_string(NULL, "torture", "host"); + const char *share = lp_parm_string(NULL, "torture", "share"); struct cli_credentials *credentials = cmdline_credentials; status = smb2_connect(mem_ctx, host, share, credentials, tree, diff --git a/source4/torture/ui.c b/source4/torture/ui.c index 6a1c2a31f3..bb28803216 100644 --- a/source4/torture/ui.c +++ b/source4/torture/ui.c @@ -343,25 +343,25 @@ BOOL torture_run_test(struct torture_context *context, int torture_setting_int(struct torture_context *test, const char *name, int default_value) { - return lp_parm_int(-1, "torture", name, default_value); + return lp_parm_int(NULL, "torture", name, default_value); } double torture_setting_double(struct torture_context *test, const char *name, double default_value) { - return lp_parm_double(-1, "torture", name, default_value); + return lp_parm_double(NULL, "torture", name, default_value); } bool torture_setting_bool(struct torture_context *test, const char *name, bool default_value) { - return lp_parm_bool(-1, "torture", name, default_value); + return lp_parm_bool(NULL, "torture", name, default_value); } const char *torture_setting_string(struct torture_context *test, const char *name, const char *default_value) { - const char *ret = lp_parm_string(-1, "torture", name); + const char *ret = lp_parm_string(NULL, "torture", name); if (ret == NULL) return default_value; diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c index 80431f5ac5..aea1ee19e0 100644 --- a/source4/torture/unix/whoami.c +++ b/source4/torture/unix/whoami.c @@ -72,8 +72,8 @@ static struct smbcli_state *connect_to_server(void *mem_ctx, NTSTATUS status; struct smbcli_state *cli; - const char *host = lp_parm_string(-1, "torture", "host"); - const char *share = lp_parm_string(-1, "torture", "share"); + const char *host = lp_parm_string(NULL, "torture", "host"); + const char *share = lp_parm_string(NULL, "torture", "share"); status = smbcli_full_connection(mem_ctx, &cli, host, share, NULL, diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index 01826dccfc..8b944e33a0 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -479,10 +479,10 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx, return False; } - (*c)->transport->options.use_oplocks = lp_parm_bool(-1, "torture", - "use_oplocks", False); - (*c)->transport->options.use_level2_oplocks = lp_parm_bool(-1, "torture", - "use_level2_oplocks", False); + (*c)->transport->options.use_oplocks = lp_parm_bool(NULL, "torture", + "use_oplocks", false); + (*c)->transport->options.use_level2_oplocks = lp_parm_bool(NULL, "torture", + "use_level2_oplocks", false); return True; } @@ -495,10 +495,10 @@ _PUBLIC_ bool torture_get_conn_index(int conn_index, int num_unc_names = 0; const char *p; - (*host) = talloc_strdup(mem_ctx, lp_parm_string(-1, "torture", "host")); - (*share) = talloc_strdup(mem_ctx, lp_parm_string(-1, "torture", "share")); + (*host) = talloc_strdup(mem_ctx, lp_parm_string(NULL, "torture", "host")); + (*share) = talloc_strdup(mem_ctx, lp_parm_string(NULL, "torture", "share")); - p = lp_parm_string(-1, "torture", "unclist"); + p = lp_parm_string(NULL, "torture", "unclist"); if (!p) { return True; } |