diff options
Diffstat (limited to 'source4/torture/rpc')
26 files changed, 1509 insertions, 1509 deletions
diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 155f3f8244..70743bd433 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -35,7 +35,7 @@ */ -BOOL torture_async_bind(struct torture_context *torture) +bool torture_async_bind(struct torture_context *torture) { NTSTATUS status; TALLOC_CTX *mem_ctx; @@ -49,30 +49,30 @@ BOOL torture_async_bind(struct torture_context *torture) struct dcerpc_pipe **pipe; const struct ndr_interface_table **table; - if (!torture_setting_bool(torture, "async", False)) { + if (!torture_setting_bool(torture, "async", false)) { printf("async bind test disabled - enable async tests to use\n"); - return True; + return true; } binding_string = torture_setting_string(torture, "binding", NULL); /* talloc context */ mem_ctx = talloc_init("torture_async_bind"); - if (mem_ctx == NULL) return False; + if (mem_ctx == NULL) return false; bind_req = talloc_array(torture, struct composite_context*, torture_numasync); - if (bind_req == NULL) return False; + if (bind_req == NULL) return false; pipe = talloc_array(torture, struct dcerpc_pipe*, torture_numasync); - if (pipe == NULL) return False; + if (pipe == NULL) return false; table = talloc_array(torture, const struct ndr_interface_table*, torture_numasync); - if (table == NULL) return False; + if (table == NULL) return false; /* credentials */ creds = cmdline_credentials; /* event context */ evt_ctx = cli_credentials_get_event_context(creds); - if (evt_ctx == NULL) return False; + if (evt_ctx == NULL) return false; /* send bind requests */ for (i = 0; i < torture_numasync; i++) { @@ -86,10 +86,10 @@ BOOL torture_async_bind(struct torture_context *torture) status = dcerpc_pipe_connect_recv(bind_req[i], mem_ctx, &pipe[i]); if (!NT_STATUS_IS_OK(status)) { printf("async rpc connection failed: %s\n", nt_errstr(status)); - return False; + return false; } } talloc_free(mem_ctx); - return True; + return true; } diff --git a/source4/torture/rpc/atsvc.c b/source4/torture/rpc/atsvc.c index da23097924..b0d1d1519d 100644 --- a/source4/torture/rpc/atsvc.c +++ b/source4/torture/rpc/atsvc.c @@ -76,7 +76,7 @@ static bool test_JobEnum(struct torture_context *tctx, struct dcerpc_pipe *p) for (i = 0; i < r.out.ctr->entries_read; i++) { if (!test_JobGetInfo(p, tctx, r.out.ctr->first_entry[i].job_id)) { - ret = False; + ret = false; } } diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c index 451b8ab120..9343734413 100644 --- a/source4/torture/rpc/autoidl.c +++ b/source4/torture/rpc/autoidl.c @@ -31,7 +31,7 @@ /* get a DRSUAPI policy handle */ -static BOOL get_policy_handle(struct dcerpc_pipe *p, +static bool get_policy_handle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -44,16 +44,16 @@ static BOOL get_policy_handle(struct dcerpc_pipe *p, status = dcerpc_drsuapi_DsBind(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("drsuapi_DsBind failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } #else /* get a SAMR handle */ -static BOOL get_policy_handle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool get_policy_handle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -66,10 +66,10 @@ static BOOL get_policy_handle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("samr_Connect failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } #endif @@ -130,7 +130,7 @@ static void try_expand(TALLOC_CTX *mem_ctx, const struct ndr_interface_table *if memcpy(stub_in.data, base_in->data, insert_ofs); memcpy(stub_in.data+insert_ofs+n, base_in->data+insert_ofs, base_in->length-insert_ofs); - status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, opnum, false, mem_ctx, &stub_in, &stub_out); if (!NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { print_depth(depth); @@ -171,7 +171,7 @@ static void test_ptr_scan(TALLOC_CTX *mem_ctx, const struct ndr_interface_table /* work out which elements are pointers */ for (ofs=min_ofs;ofs<=max_ofs-4;ofs+=4) { SIVAL(stub_in.data, ofs, 1); - status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, opnum, false, mem_ctx, &stub_in, &stub_out); if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { print_depth(depth); @@ -213,7 +213,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct ndr_interface_table data_blob_clear(&stub_in); - status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, opnum, false, mem_ctx, &stub_in, &stub_out); if (NT_STATUS_IS_OK(status)) { printf("opnum %d min_input %d - output %d\n", @@ -226,7 +226,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct ndr_interface_table fill_blob_handle(&stub_in, mem_ctx, &handle); - status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, opnum, false, mem_ctx, &stub_in, &stub_out); if (NT_STATUS_IS_OK(status)) { printf("opnum %d min_input %d - output %d (with handle)\n", @@ -258,7 +258,7 @@ static void test_auto_scan(TALLOC_CTX *mem_ctx, const struct ndr_interface_table test_scan_call(mem_ctx, iface, 2); } -BOOL torture_rpc_autoidl(struct torture_context *torture) +bool torture_rpc_autoidl(struct torture_context *torture) { TALLOC_CTX *mem_ctx; const struct ndr_interface_table *iface; @@ -266,7 +266,7 @@ BOOL torture_rpc_autoidl(struct torture_context *torture) iface = ndr_table_by_name("drsuapi"); if (!iface) { printf("Unknown interface!\n"); - return False; + return false; } mem_ctx = talloc_init("torture_rpc_autoidl"); @@ -276,5 +276,5 @@ BOOL torture_rpc_autoidl(struct torture_context *torture) test_auto_scan(mem_ctx, iface); talloc_free(mem_ctx); - return True; + return true; } diff --git a/source4/torture/rpc/bench.c b/source4/torture/rpc/bench.c index 9880393cdd..2619ac2d25 100644 --- a/source4/torture/rpc/bench.c +++ b/source4/torture/rpc/bench.c @@ -28,14 +28,14 @@ /**************************/ /* srvsvc_NetShare */ /**************************/ -static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; struct srvsvc_NetShareEnumAll r; struct srvsvc_NetShareCtr0 c0; uint32_t levels[] = {0, 1, 2, 501, 502}; int i; - BOOL ret = True; + bool ret = true; uint32_t resume_handle; ZERO_STRUCT(c0); @@ -53,7 +53,7 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) status = dcerpc_srvsvc_NetShareEnumAll(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("NetShareEnumAll level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } if (!W_ERROR_IS_OK(r.out.result)) { @@ -68,10 +68,10 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) /* benchmark srvsvc netshareenumall queries */ -static BOOL bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct timeval tv = timeval_current(); - BOOL ret = True; + bool ret = true; int timelimit = lp_parm_int(global_loadparm, NULL, "torture", "timelimit", 10); int count=0; @@ -95,12 +95,12 @@ static BOOL bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) } -BOOL torture_bench_rpc(struct torture_context *torture) +bool torture_bench_rpc(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("torture_rpc_srvsvc"); @@ -109,11 +109,11 @@ BOOL torture_bench_rpc(struct torture_context *torture) &ndr_table_srvsvc); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } if (!bench_NetShareEnumAll(p, mem_ctx)) { - ret = False; + ret = false; } talloc_free(mem_ctx); diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c index c7848f4a89..1800901873 100644 --- a/source4/torture/rpc/bind.c +++ b/source4/torture/rpc/bind.c @@ -41,27 +41,27 @@ */ -BOOL torture_multi_bind(struct torture_context *torture) +bool torture_multi_bind(struct torture_context *torture) { struct dcerpc_pipe *p; struct dcerpc_binding *binding; TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret; + bool ret; mem_ctx = talloc_init("torture_multi_bind"); status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } status = dcerpc_pipe_auth(mem_ctx, &p, binding, &ndr_table_lsarpc, cmdline_credentials); @@ -69,10 +69,10 @@ BOOL torture_multi_bind(struct torture_context *torture) if (NT_STATUS_IS_OK(status)) { printf("(incorrectly) allowed re-bind to uuid %s - %s\n", GUID_string(mem_ctx, &ndr_table_lsarpc.syntax_id.uuid), nt_errstr(status)); - ret = False; + ret = false; } else { printf("\n"); - ret = True; + ret = true; } talloc_free(mem_ctx); diff --git a/source4/torture/rpc/countcalls.c b/source4/torture/rpc/countcalls.c index eba20e6361..f9a31feaaf 100644 --- a/source4/torture/rpc/countcalls.c +++ b/source4/torture/rpc/countcalls.c @@ -29,9 +29,9 @@ -BOOL count_calls(TALLOC_CTX *mem_ctx, +bool count_calls(TALLOC_CTX *mem_ctx, const struct ndr_interface_table *iface, - BOOL all) + bool all) { struct dcerpc_pipe *p; DATA_BLOB stub_in, stub_out; @@ -43,14 +43,14 @@ BOOL count_calls(TALLOC_CTX *mem_ctx, || NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { if (all) { /* Not fatal if looking for all pipes */ - return True; + return true; } else { printf("Failed to open '%s' to count calls - %s\n", iface->name, nt_errstr(status)); - return False; + return false; } } else if (!NT_STATUS_IS_OK(status)) { printf("Failed to open '%s' to count calls - %s\n", iface->name, nt_errstr(status)); - return False; + return false; } stub_in = data_blob_talloc(p, mem_ctx, 0); @@ -58,7 +58,7 @@ BOOL count_calls(TALLOC_CTX *mem_ctx, printf("\nScanning pipe '%s'\n", iface->name); for (i=0;i<500;i++) { - status = dcerpc_request(p, NULL, i, False, p, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, i, false, p, &stub_in, &stub_out); if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT) && p->last_fault_code == DCERPC_FAULT_OP_RNG_ERROR) { i--; @@ -90,41 +90,41 @@ BOOL count_calls(TALLOC_CTX *mem_ctx, if (i==500) { talloc_free(p); printf("no limit on calls: %s!?\n", nt_errstr(status)); - return False; + return false; } printf("Found %d calls\n", i); talloc_free(p); - return True; + return true; } -BOOL torture_rpc_countcalls(struct torture_context *torture) +bool torture_rpc_countcalls(struct torture_context *torture) { const struct ndr_interface_table *iface; const char *iface_name; - BOOL ret = True; + bool ret = true; const struct ndr_interface_list *l; TALLOC_CTX *mem_ctx = talloc_named(torture, 0, "torture_rpc_countcalls context"); if (!mem_ctx) { - return False; + return false; } iface_name = lp_parm_string(global_loadparm, NULL, "countcalls", "interface"); if (iface_name != NULL) { iface = ndr_table_by_name(iface_name); if (!iface) { printf("Unknown interface '%s'\n", iface_name); - return False; + return false; } - return count_calls(mem_ctx, iface, False); + return count_calls(mem_ctx, iface, false); } for (l=ndr_table_list();l;l=l->next) { TALLOC_CTX *loop_ctx; loop_ctx = talloc_named(mem_ctx, 0, "torture_rpc_councalls loop context"); - ret &= count_calls(loop_ctx, l->table, True); + ret &= count_calls(loop_ctx, l->table, true); talloc_free(loop_ctx); } return ret; diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c index 19df14c772..afa647e71c 100644 --- a/source4/torture/rpc/dfs.c +++ b/source4/torture/rpc/dfs.c @@ -38,12 +38,12 @@ if (x == DFS_MANAGER_VERSION_W2K3) {\ if (!W_ERROR_EQUAL(y,WERR_NOT_SUPPORTED)) {\ printf("expected WERR_NOT_SUPPORTED\n");\ - return False;\ + return false;\ }\ - return True;\ + return true;\ }\ -static BOOL test_NetShareAdd(TALLOC_CTX *mem_ctx, const char *host, const char *sharename, const char *dir) +static bool test_NetShareAdd(TALLOC_CTX *mem_ctx, const char *host, const char *sharename, const char *dir) { NTSTATUS status; struct srvsvc_NetShareInfo2 i; @@ -53,7 +53,7 @@ static BOOL test_NetShareAdd(TALLOC_CTX *mem_ctx, const char *host, const char * printf("Creating share %s\n", sharename); if (!(libnetctx = libnet_context_init(NULL))) { - return False; + return false; } libnetctx->cred = cmdline_credentials; @@ -75,13 +75,13 @@ static BOOL test_NetShareAdd(TALLOC_CTX *mem_ctx, const char *host, const char * if (!NT_STATUS_IS_OK(status)) { d_printf("Failed to add new share: %s (%s)\n", nt_errstr(status), r.out.error_string); - return False; + return false; } - return True; + return true; } -static BOOL test_NetShareDel(TALLOC_CTX *mem_ctx, const char *host, const char *sharename) +static bool test_NetShareDel(TALLOC_CTX *mem_ctx, const char *host, const char *sharename) { NTSTATUS status; struct libnet_context* libnetctx; @@ -90,7 +90,7 @@ static BOOL test_NetShareDel(TALLOC_CTX *mem_ctx, const char *host, const char * printf("Deleting share %s\n", sharename); if (!(libnetctx = libnet_context_init(NULL))) { - return False; + return false; } libnetctx->cred = cmdline_credentials; @@ -102,13 +102,13 @@ static BOOL test_NetShareDel(TALLOC_CTX *mem_ctx, const char *host, const char * if (!NT_STATUS_IS_OK(status)) { d_printf("Failed to delete share: %s (%s)\n", nt_errstr(status), r.out.error_string); - return False; + return false; } - return True; + return true; } -static BOOL test_CreateDir(TALLOC_CTX *mem_ctx, +static bool test_CreateDir(TALLOC_CTX *mem_ctx, struct smbcli_state **cli, const char *host, const char *share, @@ -117,29 +117,29 @@ static BOOL test_CreateDir(TALLOC_CTX *mem_ctx, printf("Creating directory %s\n", dir); if (!torture_open_connection_share(mem_ctx, cli, host, share, NULL)) { - return False; + return false; } if (!torture_setup_dir(*cli, dir)) { - return False; + return false; } - return True; + return true; } -static BOOL test_DeleteDir(struct smbcli_state *cli, const char *dir) +static bool test_DeleteDir(struct smbcli_state *cli, const char *dir) { printf("Deleting directory %s\n", dir); if (smbcli_deltree(cli->tree, dir) == -1) { printf("Unable to delete dir %s - %s\n", dir, smbcli_errstr(cli->tree)); - return False; + return false; } - return True; + return true; } -static BOOL test_GetManagerVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, enum dfs_ManagerVersion *version) +static bool test_GetManagerVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, enum dfs_ManagerVersion *version) { NTSTATUS status; struct dfs_GetManagerVersion r; @@ -149,13 +149,13 @@ static BOOL test_GetManagerVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, e status = dcerpc_dfs_GetManagerVersion(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetManagerVersion failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_ManagerInitialize(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host) +static bool test_ManagerInitialize(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host) { NTSTATUS status; enum dfs_ManagerVersion version; @@ -164,7 +164,7 @@ static BOOL test_ManagerInitialize(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, c printf("Testing ManagerInitialize\n"); if (!test_GetManagerVersion(p, mem_ctx, &version)) { - return False; + return false; } r.in.servername = host; @@ -173,17 +173,17 @@ static BOOL test_ManagerInitialize(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, c status = dcerpc_dfs_ManagerInitialize(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("ManagerInitialize failed - %s\n", nt_errstr(status)); - return False; + return false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("dfs_ManagerInitialize failed - %s\n", win_errstr(r.out.result)); IS_DFS_VERSION_UNSUPPORTED_CALL_W2K3(version, r.out.result); - return False; + return false; } - return True; + return true; } -static BOOL test_GetInfoLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level, +static bool test_GetInfoLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level, const char *root) { NTSTATUS status; @@ -199,32 +199,32 @@ static BOOL test_GetInfoLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16 status = dcerpc_dfs_GetInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetInfo failed - %s\n", nt_errstr(status)); - return False; + return false; } else if (!W_ERROR_IS_OK(r.out.result) && !W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, r.out.result)) { printf("dfs_GetInfo failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } - return True; + return true; } -static BOOL test_GetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *root) +static bool test_GetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *root) { - BOOL ret = True; + bool ret = true; /* 103, 104, 105, 106 is only available on Set */ uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 100, 101, 102, 103, 104, 105, 106}; int i; for (i=0;i<ARRAY_SIZE(levels);i++) { if (!test_GetInfoLevel(p, mem_ctx, levels[i], root)) { - ret = False; + ret = false; } } return ret; } -static BOOL test_EnumLevelEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level, const char *dfs_name) +static bool test_EnumLevelEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level, const char *dfs_name) { NTSTATUS status; struct dfs_EnumEx rex; @@ -232,7 +232,7 @@ static BOOL test_EnumLevelEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_ struct dfs_EnumStruct e; struct dfs_Info1 s; struct dfs_EnumArray1 e1; - BOOL ret = True; + bool ret = true; rex.in.level = level; rex.in.bufsize = (uint32_t)-1; @@ -251,7 +251,7 @@ static BOOL test_EnumLevelEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_ status = dcerpc_dfs_EnumEx(p, mem_ctx, &rex); if (!NT_STATUS_IS_OK(status)) { printf("EnumEx failed - %s\n", nt_errstr(status)); - return False; + return false; } if (level == 1 && rex.out.total) { @@ -259,7 +259,7 @@ static BOOL test_EnumLevelEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_ for (i=0;i<*rex.out.total;i++) { const char *root = talloc_strdup(mem_ctx, rex.out.info->e.info1->s[i].path); if (!test_GetInfo(p, mem_ctx, root)) { - ret = False; + ret = false; } } } @@ -271,11 +271,11 @@ static BOOL test_EnumLevelEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_ const char *root = talloc_strdup(mem_ctx, rex.out.info->e.info300->s[i].dom_root); for (k=0;k<ARRAY_SIZE(levels);k++) { if (!test_EnumLevelEx(p, mem_ctx, levels[k], root)) { - ret = False; + ret = false; } } if (!test_GetInfo(p, mem_ctx, root)) { - ret = False; + ret = false; } } } @@ -284,7 +284,7 @@ static BOOL test_EnumLevelEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_ } -static BOOL test_EnumLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level) +static bool test_EnumLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level) { NTSTATUS status; struct dfs_Enum r; @@ -292,7 +292,7 @@ static BOOL test_EnumLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t struct dfs_EnumStruct e; struct dfs_Info1 s; struct dfs_EnumArray1 e1; - BOOL ret = True; + bool ret = true; r.in.level = level; r.in.bufsize = (uint32_t)-1; @@ -310,11 +310,11 @@ static BOOL test_EnumLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t status = dcerpc_dfs_Enum(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Enum failed - %s\n", nt_errstr(status)); - return False; + return false; } else if (!W_ERROR_IS_OK(r.out.result) && !W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, r.out.result)) { printf("dfs_Enum failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } if (level == 1 && r.out.total) { @@ -322,7 +322,7 @@ static BOOL test_EnumLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t for (i=0;i<*r.out.total;i++) { const char *root = r.out.info->e.info1->s[i].path; if (!test_GetInfo(p, mem_ctx, root)) { - ret = False; + ret = false; } } @@ -332,37 +332,37 @@ static BOOL test_EnumLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t } -static BOOL test_Enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_Enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 200, 300}; int i; for (i=0;i<ARRAY_SIZE(levels);i++) { if (!test_EnumLevel(p, mem_ctx, levels[i])) { - ret = False; + ret = false; } } return ret; } -static BOOL test_EnumEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host) +static bool test_EnumEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host) { - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 200, 300}; int i; for (i=0;i<ARRAY_SIZE(levels);i++) { if (!test_EnumLevelEx(p, mem_ctx, levels[i], host)) { - ret = False; + ret = false; } } return ret; } -static BOOL test_RemoveStdRoot(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host, const char *sharename) +static bool test_RemoveStdRoot(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host, const char *sharename) { struct dfs_RemoveStdRoot r; NTSTATUS status; @@ -376,16 +376,16 @@ static BOOL test_RemoveStdRoot(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const status = dcerpc_dfs_RemoveStdRoot(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RemoveStdRoot failed - %s\n", nt_errstr(status)); - return False; + return false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("dfs_RemoveStdRoot failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } - return True; + return true; } -static BOOL test_AddStdRoot(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host, const char *sharename) +static bool test_AddStdRoot(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host, const char *sharename) { NTSTATUS status; struct dfs_AddStdRoot r; @@ -400,16 +400,16 @@ static BOOL test_AddStdRoot(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const ch status = dcerpc_dfs_AddStdRoot(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("AddStdRoot failed - %s\n", nt_errstr(status)); - return False; + return false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("dfs_AddStdRoot failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } - return True; + return true; } -static BOOL test_AddStdRootForced(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host, const char *sharename) +static bool test_AddStdRootForced(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host, const char *sharename) { NTSTATUS status; struct dfs_AddStdRootForced r; @@ -418,7 +418,7 @@ static BOOL test_AddStdRootForced(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, co printf("Testing AddStdRootForced\n"); if (!test_GetManagerVersion(p, mem_ctx, &version)) { - return False; + return false; } r.in.servername = host; @@ -429,11 +429,11 @@ static BOOL test_AddStdRootForced(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, co status = dcerpc_dfs_AddStdRootForced(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("AddStdRootForced failed - %s\n", nt_errstr(status)); - return False; + return false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("dfs_AddStdRootForced failed - %s\n", win_errstr(r.out.result)); IS_DFS_VERSION_UNSUPPORTED_CALL_W2K3(version, r.out.result); - return False; + return false; } return test_RemoveStdRoot(p, mem_ctx, host, sharename); @@ -456,13 +456,13 @@ static void test_cleanup_stdroot(struct dcerpc_pipe *p, torture_close_connection(cli); } -static BOOL test_StdRoot(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host) +static bool test_StdRoot(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host) { const char *sharename = SMBTORTURE_DFS_SHARENAME; const char *dir = SMBTORTURE_DFS_DIRNAME; const char *path = SMBTORTURE_DFS_PATHNAME; struct smbcli_state *cli; - BOOL ret; + bool ret; printf("Testing StdRoot\n"); @@ -485,7 +485,7 @@ bool torture_rpc_dfs(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; enum dfs_ManagerVersion version; const char *host = torture_setting_string(torture, "host", NULL); diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c index 770f73871a..3407e49565 100644 --- a/source4/torture/rpc/drsuapi.c +++ b/source4/torture/rpc/drsuapi.c @@ -62,7 +62,7 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture { NTSTATUS status; struct drsuapi_DsGetDomainControllerInfo r; - BOOL found = False; + bool found = false; int i, j, k; struct { @@ -123,7 +123,7 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture for (k=0; k < r.out.ctr.ctr1.count; k++) { if (strcasecmp_m(r.out.ctr.ctr1.array[k].netbios_name, torture_join_netbios_name(priv->join)) == 0) { - found = True; + found = true; break; } } @@ -132,7 +132,7 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture for (k=0; k < r.out.ctr.ctr2.count; k++) { if (strcasecmp_m(r.out.ctr.ctr2.array[k].netbios_name, torture_join_netbios_name(priv->join)) == 0) { - found = True; + found = true; priv->dcinfo = r.out.ctr.ctr2.array[k]; break; } @@ -167,7 +167,7 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture for (k=0; k < r.out.ctr.ctr01.count; k++) { if (strcasecmp_m(r.out.ctr.ctr01.array[k].client_account, dc_account)) { - found = True; + found = true; break; } } @@ -179,13 +179,13 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture return true; } -static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsWriteAccountSpn r; struct drsuapi_DsNameString names[2]; - BOOL ret = True; + bool ret = true; r.in.bind_handle = &priv->bind_handle; r.in.level = 1; @@ -207,10 +207,10 @@ static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE; @@ -223,21 +223,21 @@ static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } return ret; } -static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsReplicaGetInfo r; - BOOL ret = True; + bool ret = true; int i; struct { int32_t level; @@ -307,9 +307,9 @@ static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } }; - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False)) { + if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping DsReplicaGetInfo test against Samba4\n"); - return True; + return true; } r.in.bind_handle = &priv->bind_handle; @@ -348,25 +348,25 @@ static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } if (p->last_fault_code != DCERPC_FAULT_INVALID_TAG) { printf("dcerpc_drsuapi_DsReplicaGetInfo failed - %s\n", errstr); - ret = False; + ret = false; } else { printf("DsReplicaGetInfo level %d and/or infotype %d not supported by server\n", array[i].level, array[i].infotype); } } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsReplicaGetInfo failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } } return ret; } -static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; - BOOL ret = True; + bool ret = true; int i; struct drsuapi_DsReplicaSync r; struct drsuapi_DsReplicaObjectIdentifier nc; @@ -380,14 +380,14 @@ static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } }; - if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", False)) { + if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { printf("DsReplicaSync disabled - enable dangerous tests to use\n"); - return True; + return true; } - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False)) { + if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping DsReplicaSync test against Samba4\n"); - return True; + return true; } ZERO_STRUCT(null_guid); @@ -420,21 +420,21 @@ static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsReplicaSync failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsReplicaSync failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } } return ret; } -static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; - BOOL ret = True; + bool ret = true; int i; struct drsuapi_DsReplicaUpdateRefs r; struct drsuapi_DsReplicaObjectIdentifier nc; @@ -448,9 +448,9 @@ static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } }; - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False)) { + if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping DsReplicaUpdateRefs test against Samba4\n"); - return True; + return true; } ZERO_STRUCT(null_guid); @@ -484,21 +484,21 @@ static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsReplicaUpdateRefs failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsReplicaUpdateRefs failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } } return ret; } -static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; - BOOL ret = True; + bool ret = true; int i; struct drsuapi_DsGetNCChanges r; struct drsuapi_DsReplicaObjectIdentifier nc; @@ -515,9 +515,9 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } }; - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False)) { + if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping DsGetNCChanges test against Samba4\n"); - return True; + return true; } ZERO_STRUCT(null_guid); @@ -544,7 +544,7 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 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(global_loadparm, NULL, "drsuapi","compression", False)) { + if (lp_parm_bool(global_loadparm, NULL, "drsuapi","compression", false)) { r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } r.in.req.req5.max_object_count = 0; @@ -566,10 +566,10 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 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(global_loadparm, NULL,"drsuapi","compression",False)) { + if (lp_parm_bool(global_loadparm, NULL, "drsuapi", "compression", false)) { r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } - if (lp_parm_bool(global_loadparm, NULL,"drsuapi","neighbour_writeable",True)) { + if (lp_parm_bool(global_loadparm, 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 @@ -596,22 +596,22 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->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; } } return ret; } -BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_QuerySitesByCost r; - BOOL ret = True; + bool ret = true; const char *my_site = "Default-First-Site-Name"; const char *remote_site1 = "smbtorture-nonexisting-site1"; @@ -633,10 +633,10 @@ BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("drsuapi_QuerySitesByCost - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("QuerySitesByCost failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } if (W_ERROR_IS_OK(r.out.result)) { @@ -645,14 +645,14 @@ BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, !W_ERROR_EQUAL(r.out.ctr.ctr1.info[1].error_code, WERR_DS_OBJ_NOT_FOUND)) { printf("expected error_code WERR_DS_OBJ_NOT_FOUND, got %s\n", win_errstr(r.out.ctr.ctr1.info[0].error_code)); - ret = False; + ret = false; } if ((r.out.ctr.ctr1.info[0].site_cost != (uint32_t) -1) || (r.out.ctr.ctr1.info[1].site_cost != (uint32_t) -1)) { printf("expected site_cost %d, got %d\n", (uint32_t) -1, r.out.ctr.ctr1.info[0].site_cost); - ret = False; + ret = false; } } @@ -661,12 +661,12 @@ BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsUnbind r; - BOOL ret = True; + bool ret = true; r.in.bind_handle = &priv->bind_handle; r.out.bind_handle = &priv->bind_handle; @@ -680,10 +680,10 @@ BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsUnbind failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsBind failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } return ret; diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c index d3530dae19..ac3eebfa68 100644 --- a/source4/torture/rpc/drsuapi_cracknames.c +++ b/source4/torture/rpc/drsuapi_cracknames.c @@ -29,14 +29,14 @@ #include "libcli/security/security.h" #include "param/param.h" -static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv, const char *dn, const char *user_principal_name, const char *service_principal_name) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct drsuapi_DsCrackNames r; enum drsuapi_DsNameFormat formats[] = { DRSUAPI_DS_NAME_FORMAT_FQDN_1779, @@ -81,13 +81,13 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired); printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("testing DsCrackNames (matrix prep) with name '%s' from format: %d desired format:%d ", names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired); printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } if (!ret) { @@ -98,7 +98,7 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE) { printf(__location__ ": Unexpected error (%d): This name lookup should fail\n", r.out.ctr.ctr1->array[0].status); - return False; + return false; } printf ("(expected) error\n"); break; @@ -106,7 +106,7 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NO_MAPPING) { printf(__location__ ": Unexpected error (%d): This name lookup should fail\n", r.out.ctr.ctr1->array[0].status); - return False; + return false; } printf ("(expected) error\n"); break; @@ -115,14 +115,14 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR) { printf(__location__ ": Unexpected error (%d): This name lookup should fail\n", r.out.ctr.ctr1->array[0].status); - return False; + return false; } printf ("(expected) error\n"); break; default: if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("Error: %d\n", r.out.ctr.ctr1->array[0].status); - return False; + return false; } } @@ -160,12 +160,12 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } printf("testing DsCrackNames (matrix) with name '%s' from format: %d desired format:%d failed - %s", names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired, errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("testing DsCrackNames (matrix) with name '%s' from format: %d desired format:%d failed - %s", names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired, win_errstr(r.out.result)); - ret = False; + ret = false; } if (!ret) { @@ -191,26 +191,26 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } else if (n_matrix[i][j] == NULL && formats[j] == DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL) { } else if (n_matrix[i][j] == NULL && n_from[j] != NULL) { printf("dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s\n", formats[i], formats[j], n_matrix[i][j], n_from[j]); - ret = False; + ret = false; } else if (n_matrix[i][j] != NULL && n_from[j] == NULL) { printf("dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s\n", formats[i], formats[j], n_matrix[i][j], n_from[j]); - ret = False; + ret = false; } else if (strcmp(n_matrix[i][j], n_from[j]) != 0) { printf("dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s\n", formats[i], formats[j], n_matrix[i][j], n_from[j]); - ret = False; + ret = false; } } } return ret; } -BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsCrackNames r; struct drsuapi_DsNameString names[1]; - BOOL ret = True; + bool ret = true; const char *dns_domain; const char *nt4_domain; const char *FQDN_1779_name; @@ -254,13 +254,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -282,13 +282,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -311,13 +311,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -335,7 +335,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("local Round trip on canonical name failed: %s != %s!\n", realm_canonical, talloc_asprintf(mem_ctx, "%s/", dns_domain)); - return False; + return false; }; realm_canonical_ex = ldb_dn_canonical_ex_string(mem_ctx, realm_dn); @@ -345,7 +345,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("local Round trip on canonical ex name failed: %s != %s!\n", realm_canonical, talloc_asprintf(mem_ctx, "%s\n", dns_domain)); - return False; + return false; }; r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; @@ -362,13 +362,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -391,13 +391,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -420,13 +420,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -435,7 +435,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (strcmp(priv->domain_dns_name, r.out.ctr.ctr1->array[0].dns_domain_name) != 0) { printf("DsCrackNames failed to return same DNS name - expected %s got %s\n", priv->domain_dns_name, r.out.ctr.ctr1->array[0].dns_domain_name); - return False; + return false; } FQDN_1779_dn = ldb_dn_new(mem_ctx, ldb, FQDN_1779_name); @@ -463,7 +463,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, enum drsuapi_DsNameStatus status; enum drsuapi_DsNameStatus alternate_status; enum drsuapi_DsNameFlags flags; - BOOL skip; + bool skip; } crack[] = { { .format_offered = DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, @@ -589,7 +589,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, .comment = "display name for Microsoft Support Account", .status = DRSUAPI_DS_NAME_STATUS_OK, .alternate_status = DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE, - .skip = lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False) + .skip = lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false) }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, @@ -941,10 +941,10 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed on %s - %s\n", comment, errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != crack[i].status) { if (crack[i].alternate_status) { if (r.out.ctr.ctr1->array[0].status != crack[i].alternate_status) { @@ -953,14 +953,14 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, crack[i].status, crack[i].alternate_status, comment); - ret = False; + ret = false; } } else { printf("DsCrackNames unexpected status %d, wanted %d on: %s\n", r.out.ctr.ctr1->array[0].status, crack[i].status, comment); - ret = False; + ret = false; } } else if (crack[i].expected_str && (strcmp(r.out.ctr.ctr1->array[0].result_name, @@ -970,7 +970,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("DsCrackNames failed - got %s, expected %s on %s\n", r.out.ctr.ctr1->array[0].result_name, crack[i].expected_str, comment); - ret = False; + ret = false; } else { printf("(warning) DsCrackNames returned different case - got %s, expected %s on %s\n", r.out.ctr.ctr1->array[0].result_name, @@ -982,14 +982,14 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("DsCrackNames failed - got DNS name %s, expected %s on %s\n", r.out.ctr.ctr1->array[0].result_name, crack[i].expected_str, comment); - ret = False; + ret = false; } } } if (!test_DsCrackNamesMatrix(p, mem_ctx, priv, FQDN_1779_name, user_principal_name, service_principal_name)) { - ret = False; + ret = false; } return ret; diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index 347b1a5bc7..15125ac365 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -173,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, @@ -186,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); @@ -196,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); @@ -223,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); @@ -239,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; @@ -274,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; @@ -430,7 +430,7 @@ static void test_analyse_objects(struct DsSyncTest *ctx, 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; @@ -504,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)); @@ -531,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; @@ -582,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++) { @@ -686,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; } @@ -713,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; @@ -743,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; @@ -774,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; @@ -791,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; diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index c873cdf0ae..5c027d3299 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -230,7 +230,7 @@ static bool test_sleep(struct torture_context *tctx, #define ASYNC_COUNT 3 struct rpc_request *req[ASYNC_COUNT]; struct echo_TestSleep r[ASYNC_COUNT]; - BOOL done[ASYNC_COUNT]; + bool done[ASYNC_COUNT]; struct timeval snd[ASYNC_COUNT]; struct timeval rcv[ASYNC_COUNT]; struct timeval diff[ASYNC_COUNT]; @@ -243,7 +243,7 @@ static bool test_sleep(struct torture_context *tctx, torture_comment(tctx, "Testing TestSleep - use \"torture:quick=yes\" to disable\n"); for (i=0;i<ASYNC_COUNT;i++) { - done[i] = False; + done[i] = false; snd[i] = timeval_current(); rcv[i] = timeval_zero(); r[i].in.seconds = ASYNC_COUNT-i; @@ -256,10 +256,10 @@ static bool test_sleep(struct torture_context *tctx, torture_assert(tctx, event_loop_once(ctx) == 0, "Event context loop failed"); for (i=0;i<ASYNC_COUNT;i++) { - if (done[i] == False && req[i]->state == RPC_REQUEST_DONE) { + if (done[i] == false && req[i]->state == RPC_REQUEST_DONE) { int rounded_tdiff; total_done++; - done[i] = True; + done[i] = true; rcv[i] = timeval_current(); diff[i] = timeval_until(&snd[i], &rcv[i]); rounded_tdiff = (int)(0.5 + diff[i].tv_sec + (1.0e-6*diff[i].tv_usec)); @@ -393,7 +393,7 @@ static bool test_timeout(struct torture_context *tctx, torture_comment(tctx, "Failed to send async sleep request\n"); goto failed; } - req->ignore_timeout = True; + req->ignore_timeout = true; status = dcerpc_ndr_request_recv(req); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT, @@ -412,7 +412,7 @@ static bool test_timeout(struct torture_context *tctx, torture_comment(tctx, "Failed to send async sleep request\n"); goto failed; } - req->ignore_timeout = True; + req->ignore_timeout = true; status = dcerpc_ndr_request_recv(req); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT, "request should have timed out"); diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c index f6f8e66369..830b77aed9 100644 --- a/source4/torture/rpc/epmapper.c +++ b/source4/torture/rpc/epmapper.c @@ -39,7 +39,7 @@ static void display_tower(TALLOC_CTX *mem_ctx, struct epm_tower *twr) } -static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct epm_twr_t *twr) { NTSTATUS status; @@ -131,7 +131,7 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* FIXME: Extend to do other protocols as well (ncacn_unix_stream, ncalrpc) */ - return True; + return true; } static bool test_Lookup(struct torture_context *tctx, @@ -186,7 +186,7 @@ static bool test_Lookup(struct torture_context *tctx, return true; } -static BOOL test_Delete(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct epm_entry_t *entries) +static bool test_Delete(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct epm_entry_t *entries) { NTSTATUS status; struct epm_Delete r; @@ -197,15 +197,15 @@ static BOOL test_Delete(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct epm_e status = dcerpc_epm_Delete(p, mem_ctx, &r); if (NT_STATUS_IS_ERR(status)) { printf("Delete failed - %s\n", nt_errstr(status)); - return False; + return false; } if (r.out.result != 0) { printf("Delete failed - %d\n", r.out.result); - return False; + return false; } - return True; + return true; } static bool test_Insert(struct torture_context *tctx, diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c index 23c43c525e..d0ad97110a 100644 --- a/source4/torture/rpc/join.c +++ b/source4/torture/rpc/join.c @@ -8,7 +8,7 @@ #define TORTURE_NETBIOS_NAME "smbtorturejoin" -BOOL torture_rpc_join(struct torture_context *torture) +bool torture_rpc_join(struct torture_context *torture) { NTSTATUS status; struct test_join *tj; @@ -24,7 +24,7 @@ BOOL torture_rpc_join(struct torture_context *torture) if (!tj) { DEBUG(0, ("%s failed to join domain as workstation\n", TORTURE_NETBIOS_NAME)); - return False; + return false; } status = smbcli_full_connection(tj, &cli, host, @@ -34,7 +34,7 @@ BOOL torture_rpc_join(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n", TORTURE_NETBIOS_NAME)); - return False; + return false; } smbcli_tdis(cli); @@ -48,7 +48,7 @@ BOOL torture_rpc_join(struct torture_context *torture) if (!tj) { DEBUG(0, ("%s failed to join domain as domain controller\n", TORTURE_NETBIOS_NAME)); - return False; + return false; } status = smbcli_full_connection(tj, &cli, host, @@ -58,7 +58,7 @@ BOOL torture_rpc_join(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n", TORTURE_NETBIOS_NAME)); - return False; + return false; } smbcli_tdis(cli); @@ -66,6 +66,6 @@ BOOL torture_rpc_join(struct torture_context *torture) /* Leave domain. */ torture_leave_domain(tj); - return True; + return true; } diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 0a78e9d76d..1250743955 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -34,7 +34,7 @@ static void init_lsa_String(struct lsa_String *name, const char *s) name->string = s; } -static BOOL test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct lsa_ObjectAttribute attr; struct policy_handle handle; @@ -67,17 +67,17 @@ static BOOL test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) { printf("not considering %s to be an error\n", nt_errstr(status)); - return True; + return true; } printf("OpenPolicy failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle **handle) { struct lsa_ObjectAttribute attr; @@ -89,7 +89,7 @@ BOOL test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, *handle = talloc(mem_ctx, struct policy_handle); if (!*handle) { - return False; + return false; } qos.len = 0; @@ -116,16 +116,16 @@ BOOL test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("not considering %s to be an error\n", nt_errstr(status)); talloc_free(*handle); *handle = NULL; - return True; + return true; } printf("OpenPolicy2 failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_LookupNames(struct dcerpc_pipe *p, +static bool test_LookupNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_TransNameArray *tnames) @@ -159,15 +159,15 @@ static BOOL test_LookupNames(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupNames_bogus(struct dcerpc_pipe *p, +static bool test_LookupNames_bogus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -207,15 +207,15 @@ static BOOL test_LookupNames_bogus(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupNames_wellknown(struct dcerpc_pipe *p, +static bool test_LookupNames_wellknown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -256,7 +256,7 @@ static BOOL test_LookupNames_wellknown(struct dcerpc_pipe *p, return ret; } -static BOOL test_LookupNames2(struct dcerpc_pipe *p, +static bool test_LookupNames2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_TransNameArray2 *tnames) @@ -292,16 +292,16 @@ static BOOL test_LookupNames2(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames2(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames2 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupNames3(struct dcerpc_pipe *p, +static bool test_LookupNames3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_TransNameArray2 *tnames) @@ -337,15 +337,15 @@ static BOOL test_LookupNames3(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames3(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames3 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupNames4(struct dcerpc_pipe *p, +static bool test_LookupNames4(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct lsa_TransNameArray2 *tnames) { @@ -379,16 +379,16 @@ static BOOL test_LookupNames4(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames4(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames4 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupSids(struct dcerpc_pipe *p, +static bool test_LookupSids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids) @@ -414,20 +414,20 @@ static BOOL test_LookupSids(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupSids(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupSids failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); if (!test_LookupNames(p, mem_ctx, handle, &names)) { - return False; + return false; } - return True; + return true; } -static BOOL test_LookupSids2(struct dcerpc_pipe *p, +static bool test_LookupSids2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids) @@ -455,23 +455,23 @@ static BOOL test_LookupSids2(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupSids2(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupSids2 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); if (!test_LookupNames2(p, mem_ctx, handle, &names)) { - return False; + return false; } if (!test_LookupNames3(p, mem_ctx, handle, &names)) { - return False; + return false; } - return True; + return true; } -static BOOL test_LookupSids3(struct dcerpc_pipe *p, +static bool test_LookupSids3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct lsa_SidArray *sids) { @@ -499,23 +499,23 @@ static BOOL test_LookupSids3(struct dcerpc_pipe *p, if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) { printf("not considering %s to be an error\n", nt_errstr(status)); - return True; + return true; } printf("LookupSids3 failed - %s - not considered an error\n", nt_errstr(status)); - return False; + return false; } printf("\n"); if (!test_LookupNames4(p, mem_ctx, &names)) { - return False; + return false; } - return True; + return true; } -BOOL test_many_LookupSids(struct dcerpc_pipe *p, +bool test_many_LookupSids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -554,13 +554,13 @@ BOOL test_many_LookupSids(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupSids(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupSids failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); if (!test_LookupNames(p, mem_ctx, handle, &names)) { - return False; + return false; } } else { struct lsa_LookupSids3 r; @@ -585,14 +585,14 @@ BOOL test_many_LookupSids(struct dcerpc_pipe *p, if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) { printf("not considering %s to be an error\n", nt_errstr(status)); - return True; + return true; } printf("LookupSids3 failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_LookupNames4(p, mem_ctx, &names)) { - return False; + return false; } } @@ -600,7 +600,7 @@ BOOL test_many_LookupSids(struct dcerpc_pipe *p, - return True; + return true; } static void lookupsids_cb(struct rpc_request *req) @@ -619,7 +619,7 @@ static void lookupsids_cb(struct rpc_request *req) } } -static BOOL test_LookupSids_async(struct dcerpc_pipe *p, +static bool test_LookupSids_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -630,7 +630,7 @@ static BOOL test_LookupSids_async(struct dcerpc_pipe *p, struct lsa_LookupSids *r; struct rpc_request **req; int i, replies; - BOOL ret = True; + bool ret = true; const int num_async_requests = 50; count = talloc_array(mem_ctx, uint32_t, num_async_requests); @@ -662,7 +662,7 @@ static BOOL test_LookupSids_async(struct dcerpc_pipe *p, req[i] = dcerpc_lsa_LookupSids_send(p, req, &r[i]); if (req[i] == NULL) { - ret = False; + ret = false; break; } @@ -677,13 +677,13 @@ static BOOL test_LookupSids_async(struct dcerpc_pipe *p, talloc_free(req); if (replies < 0) { - ret = False; + ret = false; } return ret; } -static BOOL test_LookupPrivValue(struct dcerpc_pipe *p, +static bool test_LookupPrivValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name) @@ -699,13 +699,13 @@ static BOOL test_LookupPrivValue(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupPrivValue(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("\nLookupPrivValue failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_LookupPrivName(struct dcerpc_pipe *p, +static bool test_LookupPrivName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_LUID *luid) @@ -719,13 +719,13 @@ static BOOL test_LookupPrivName(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupPrivName(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("\nLookupPrivName failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p, +static bool test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *acct_handle, struct lsa_LUID *luid) @@ -733,7 +733,7 @@ static BOOL test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p, NTSTATUS status; struct lsa_RemovePrivilegesFromAccount r; struct lsa_PrivilegeSet privs; - BOOL ret = True; + bool ret = true; printf("Testing RemovePrivilegesFromAccount\n"); @@ -750,13 +750,13 @@ static BOOL test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_RemovePrivilegesFromAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RemovePrivilegesFromAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } return ret; } -static BOOL test_AddPrivilegesToAccount(struct dcerpc_pipe *p, +static bool test_AddPrivilegesToAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *acct_handle, struct lsa_LUID *luid) @@ -764,7 +764,7 @@ static BOOL test_AddPrivilegesToAccount(struct dcerpc_pipe *p, NTSTATUS status; struct lsa_AddPrivilegesToAccount r; struct lsa_PrivilegeSet privs; - BOOL ret = True; + bool ret = true; printf("Testing AddPrivilegesToAccount\n"); @@ -780,20 +780,20 @@ static BOOL test_AddPrivilegesToAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_AddPrivilegesToAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("AddPrivilegesToAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } return ret; } -static BOOL test_EnumPrivsAccount(struct dcerpc_pipe *p, +static bool test_EnumPrivsAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct policy_handle *acct_handle) { NTSTATUS status; struct lsa_EnumPrivsAccount r; - BOOL ret = True; + bool ret = true; printf("Testing EnumPrivsAccount\n"); @@ -802,7 +802,7 @@ static BOOL test_EnumPrivsAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_EnumPrivsAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumPrivsAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } if (r.out.privs && r.out.privs->count > 0) { @@ -821,7 +821,7 @@ static BOOL test_EnumPrivsAccount(struct dcerpc_pipe *p, return ret; } -static BOOL test_Delete(struct dcerpc_pipe *p, +static bool test_Delete(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -834,14 +834,14 @@ static BOOL test_Delete(struct dcerpc_pipe *p, status = dcerpc_lsa_Delete(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Delete failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_CreateAccount(struct dcerpc_pipe *p, +static bool test_CreateAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -862,17 +862,17 @@ static BOOL test_CreateAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_CreateAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("CreateAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_Delete(p, mem_ctx, &acct_handle)) { - return False; + return false; } - return True; + return true; } -static BOOL test_DeleteTrustedDomain(struct dcerpc_pipe *p, +static bool test_DeleteTrustedDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_StringLarge name) @@ -889,17 +889,17 @@ static BOOL test_DeleteTrustedDomain(struct dcerpc_pipe *p, status = dcerpc_lsa_OpenTrustedDomainByName(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("lsa_OpenTrustedDomainByName failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_Delete(p, mem_ctx, &trustdom_handle)) { - return False; + return false; } - return True; + return true; } -static BOOL test_DeleteTrustedDomainBySid(struct dcerpc_pipe *p, +static bool test_DeleteTrustedDomainBySid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid *sid) @@ -913,14 +913,14 @@ static BOOL test_DeleteTrustedDomainBySid(struct dcerpc_pipe *p, status = dcerpc_lsa_DeleteTrustedDomain(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("lsa_DeleteTrustedDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_CreateSecret(struct dcerpc_pipe *p, +static bool test_CreateSecret(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -939,7 +939,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, struct lsa_DATA_BUF_PTR bufp1; struct lsa_DATA_BUF_PTR bufp2; DATA_BLOB enc_key; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; NTTIME old_mtime, new_mtime; DATA_BLOB blob1, blob2; @@ -969,7 +969,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_CreateSecret(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("CreateSecret failed - %s\n", nt_errstr(status)); - return False; + return false; } r.in.handle = handle; @@ -979,7 +979,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_CreateSecret(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { printf("CreateSecret should have failed OBJECT_NAME_COLLISION - %s\n", nt_errstr(status)); - return False; + return false; } r2.in.handle = handle; @@ -992,13 +992,13 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_OpenSecret(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("OpenSecret failed - %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_fetch_session_key(p, &session_key); if (!NT_STATUS_IS_OK(status)) { printf("dcerpc_fetch_session_key failed - %s\n", nt_errstr(status)); - return False; + return false; } enc_key = sess_encrypt_string(secret1, &session_key); @@ -1015,7 +1015,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_SetSecret(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("SetSecret failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.sec_handle = &sec_handle; @@ -1033,7 +1033,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_SetSecret(p, mem_ctx, &r3); if (!NT_STATUS_EQUAL(status, NT_STATUS_UNKNOWN_REVISION)) { printf("SetSecret should have failed UNKNOWN_REVISION - %s\n", nt_errstr(status)); - ret = False; + ret = false; } data_blob_free(&enc_key); @@ -1054,11 +1054,11 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_QuerySecret(p, mem_ctx, &r4); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (r4.out.new_val == NULL || r4.out.new_val->buf == NULL) { printf("No secret buffer returned\n"); - ret = False; + ret = false; } else { blob1.data = r4.out.new_val->buf->data; blob1.length = r4.out.new_val->buf->size; @@ -1071,7 +1071,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret1, secret2) != 0) { printf("Returned secret '%s' doesn't match '%s'\n", secret2, secret1); - ret = False; + ret = false; } } } @@ -1090,7 +1090,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_SetSecret(p, mem_ctx, &r5); if (!NT_STATUS_IS_OK(status)) { printf("SetSecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } data_blob_free(&enc_key); @@ -1111,14 +1111,14 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_QuerySecret(p, mem_ctx, &r6); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; secret4 = NULL; } else { if (r6.out.new_val->buf == NULL || r6.out.old_val->buf == NULL || r6.out.new_mtime == NULL || r6.out.old_mtime == NULL) { printf("Both secret buffers and both times not returned\n"); - ret = False; + ret = false; secret4 = NULL; } else { blob1.data = r6.out.new_val->buf->data; @@ -1131,7 +1131,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret3, secret4) != 0) { printf("Returned NEW secret %s doesn't match %s\n", secret4, secret3); - ret = False; + ret = false; } blob1.data = r6.out.old_val->buf->data; @@ -1144,14 +1144,14 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret1, secret2) != 0) { printf("Returned OLD secret %s doesn't match %s\n", secret2, secret1); - ret = False; + ret = false; } if (*r6.out.new_mtime == *r6.out.old_mtime) { printf("Returned secret %s had same mtime for both secrets: %s\n", secname[i], nt_time_string(mem_ctx, *r6.out.new_mtime)); - ret = False; + ret = false; } } } @@ -1170,7 +1170,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_SetSecret(p, mem_ctx, &r7); if (!NT_STATUS_IS_OK(status)) { printf("SetSecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } data_blob_free(&enc_key); @@ -1188,26 +1188,26 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_QuerySecret(p, mem_ctx, &r8); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (!r8.out.new_val || !r8.out.old_val) { printf("in/out pointers not returned, despite being set on in for QuerySecret\n"); - ret = False; + ret = false; } else if (r8.out.new_val->buf == NULL) { if (i != LOCAL) { printf("NEW secret buffer not returned after GLOBAL OLD set\n"); - ret = False; + ret = false; } } else if (r8.out.old_val->buf == NULL) { printf("OLD secret buffer not returned after OLD set\n"); - ret = False; + ret = false; } else if (r8.out.new_mtime == NULL || r8.out.old_mtime == NULL) { printf("Both times not returned after OLD set\n"); - ret = False; + ret = false; } else { if (i == LOCAL) { printf("NEW secret buffer should not be returned after LOCAL OLD set\n"); - ret = False; + ret = false; } blob1.data = r8.out.new_val->buf->data; blob1.length = r8.out.new_val->buf->length; @@ -1219,7 +1219,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret3, secret4) != 0) { printf("Returned NEW secret '%s' doesn't match '%s'\n", secret4, secret3); - ret = False; + ret = false; } blob1.data = r8.out.old_val->buf->data; @@ -1232,7 +1232,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret5, secret6) != 0) { printf("Returned OLD secret %s doesn't match %s\n", secret5, secret6); - ret = False; + ret = false; } if (*r8.out.new_mtime == *r8.out.old_mtime) { @@ -1240,27 +1240,27 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, printf("Returned secret %s had same mtime for both secrets: %s\n", secname[i], nt_time_string(mem_ctx, *r8.out.new_mtime)); - ret = False; + ret = false; } } else { printf("Returned secret %s should have had same mtime for both secrets: %s != %s\n", secname[i], nt_time_string(mem_ctx, *r8.out.old_mtime), nt_time_string(mem_ctx, *r8.out.new_mtime)); - ret = False; + ret = false; } } } if (!test_Delete(p, mem_ctx, &sec_handle)) { - ret = False; + ret = false; } d.in.handle = &sec_handle2; status = dcerpc_lsa_Delete(p, mem_ctx, &d); if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) { printf("Second delete expected INVALID_HANDLE - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { printf("Testing OpenSecret of just-deleted secret\n"); @@ -1268,7 +1268,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_OpenSecret(p, mem_ctx, &r2); if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { printf("OpenSecret expected OBJECT_NAME_NOT_FOUND - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } @@ -1278,7 +1278,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, } -static BOOL test_EnumAccountRights(struct dcerpc_pipe *p, +static bool test_EnumAccountRights(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *acct_handle, struct dom_sid *sid) @@ -1297,14 +1297,14 @@ static BOOL test_EnumAccountRights(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("EnumAccountRights of %s failed - %s\n", dom_sid_string(mem_ctx, sid), nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_QuerySecurity(struct dcerpc_pipe *p, +static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct policy_handle *acct_handle) @@ -1314,7 +1314,7 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping QuerySecurity test against Samba4\n"); - return True; + return true; } printf("Testing QuerySecurity\n"); @@ -1325,13 +1325,13 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, status = dcerpc_lsa_QuerySecurity(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_OpenAccount(struct dcerpc_pipe *p, +static bool test_OpenAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid *sid) @@ -1350,21 +1350,21 @@ static BOOL test_OpenAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_OpenAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_EnumPrivsAccount(p, mem_ctx, handle, &acct_handle)) { - return False; + return false; } if (!test_QuerySecurity(p, mem_ctx, handle, &acct_handle)) { - return False; + return false; } - return True; + return true; } -static BOOL test_EnumAccounts(struct dcerpc_pipe *p, +static bool test_EnumAccounts(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -1373,7 +1373,7 @@ static BOOL test_EnumAccounts(struct dcerpc_pipe *p, struct lsa_SidArray sids1, sids2; uint32_t resume_handle = 0; int i; - BOOL ret = True; + bool ret = true; printf("\ntesting EnumAccounts\n"); @@ -1384,26 +1384,26 @@ static BOOL test_EnumAccounts(struct dcerpc_pipe *p, r.out.sids = &sids1; resume_handle = 0; - while (True) { + while (true) { status = dcerpc_lsa_EnumAccounts(p, mem_ctx, &r); if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES)) { break; } if (!NT_STATUS_IS_OK(status)) { printf("EnumAccounts failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_LookupSids(p, mem_ctx, handle, &sids1)) { - return False; + return false; } if (!test_LookupSids2(p, mem_ctx, handle, &sids1)) { - return False; + return false; } if (!test_LookupSids3(p, mem_ctx, &sids1)) { - return False; + return false; } printf("testing all accounts\n"); @@ -1426,18 +1426,18 @@ static BOOL test_EnumAccounts(struct dcerpc_pipe *p, status = dcerpc_lsa_EnumAccounts(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumAccounts failed - %s\n", nt_errstr(status)); - return False; + return false; } if (sids2.num_sids != 1) { printf("Returned wrong number of entries (%d)\n", sids2.num_sids); - return False; + return false; } - return True; + return true; } -static BOOL test_LookupPrivDisplayName(struct dcerpc_pipe *p, +static bool test_LookupPrivDisplayName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *priv_name) @@ -1459,16 +1459,16 @@ static BOOL test_LookupPrivDisplayName(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupPrivDisplayName(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupPrivDisplayName failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("%s -> \"%s\" (language 0x%x/0x%x)\n", priv_name->string, r.out.disp_name->string, *r.in.language_id, *r.out.language_id); - return True; + return true; } -static BOOL test_EnumAccountsWithUserRight(struct dcerpc_pipe *p, +static bool test_EnumAccountsWithUserRight(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *priv_name) @@ -1489,19 +1489,19 @@ static BOOL test_EnumAccountsWithUserRight(struct dcerpc_pipe *p, /* NT_STATUS_NO_MORE_ENTRIES means noone has this privilege */ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES)) { - return True; + return true; } if (!NT_STATUS_IS_OK(status)) { printf("EnumAccountsWithUserRight failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_EnumPrivs(struct dcerpc_pipe *p, +static bool test_EnumPrivs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -1510,7 +1510,7 @@ static BOOL test_EnumPrivs(struct dcerpc_pipe *p, struct lsa_PrivArray privs1; uint32_t resume_handle = 0; int i; - BOOL ret = True; + bool ret = true; printf("\ntesting EnumPrivs\n"); @@ -1524,26 +1524,26 @@ static BOOL test_EnumPrivs(struct dcerpc_pipe *p, status = dcerpc_lsa_EnumPrivs(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumPrivs failed - %s\n", nt_errstr(status)); - return False; + return false; } for (i = 0; i< privs1.count; i++) { test_LookupPrivDisplayName(p, mem_ctx, handle, (struct lsa_String *)&privs1.privs[i].name); test_LookupPrivValue(p, mem_ctx, handle, (struct lsa_String *)&privs1.privs[i].name); if (!test_EnumAccountsWithUserRight(p, mem_ctx, handle, (struct lsa_String *)&privs1.privs[i].name)) { - ret = False; + ret = false; } } return ret; } -static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p, +static bool test_QueryForestTrustInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *trusted_domain_name) { - BOOL ret = True; + bool ret = true; struct lsa_lsaRQueryForestTrustInformation r; NTSTATUS status; struct lsa_String string; @@ -1553,7 +1553,7 @@ static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p, if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping QueryForestTrustInformation against Samba4\n"); - return True; + return true; } ZERO_STRUCT(string); @@ -1573,19 +1573,19 @@ static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("lsaRQueryForestTrustInformation failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_query_each_TrustDomEx(struct dcerpc_pipe *p, +static bool test_query_each_TrustDomEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_DomainListEx *domains) { int i; - BOOL ret = True; + bool ret = true; for (i=0; i< domains->count; i++) { @@ -1598,14 +1598,14 @@ static BOOL test_query_each_TrustDomEx(struct dcerpc_pipe *p, return ret; } -static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, +static bool test_query_each_TrustDom(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_DomainList *domains) { NTSTATUS status; int i,j; - BOOL ret = True; + bool ret = true; printf("\nTesting OpenTrustedDomain, OpenTrustedDomainByName and QueryInfoTrustedDomain\n"); for (i=0; i< domains->count; i++) { @@ -1628,7 +1628,7 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("OpenTrustedDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } c.in.handle = &trustdom_handle; @@ -1647,18 +1647,18 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status) && ok[j]) { printf("QueryTrustedDomainInfo level %d failed - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } else if (NT_STATUS_IS_OK(status) && !ok[j]) { printf("QueryTrustedDomainInfo level %d unexpectedly succeeded - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } } status = dcerpc_lsa_CloseTrustedDomainEx(p, mem_ctx, &c_trust); if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) { printf("Expected CloseTrustedDomainEx to return NT_STATUS_NOT_IMPLEMENTED, instead - %s\n", nt_errstr(status)); - return False; + return false; } c.in.handle = &trustdom_handle; @@ -1667,7 +1667,7 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, status = dcerpc_lsa_Close(p, mem_ctx, &c); if (!NT_STATUS_IS_OK(status)) { printf("Close of trusted domain failed - %s\n", nt_errstr(status)); - return False; + return false; } for (j=0; j < ARRAY_SIZE(levels); j++) { @@ -1686,11 +1686,11 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status) && ok[j]) { printf("QueryTrustedDomainInfoBySid level %d failed - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } else if (NT_STATUS_IS_OK(status) && !ok[j]) { printf("QueryTrustedDomainInfoBySid level %d unexpectedly succeeded - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } } } @@ -1704,7 +1704,7 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("OpenTrustedDomainByName failed - %s\n", nt_errstr(status)); - return False; + return false; } for (j=0; j < ARRAY_SIZE(levels); j++) { @@ -1717,11 +1717,11 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status) && ok[j]) { printf("QueryTrustedDomainInfo level %d failed - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } else if (NT_STATUS_IS_OK(status) && !ok[j]) { printf("QueryTrustedDomainInfo level %d unexpectedly succeeded - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } } @@ -1731,7 +1731,7 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, status = dcerpc_lsa_Close(p, mem_ctx, &c); if (!NT_STATUS_IS_OK(status)) { printf("Close of trusted domain failed - %s\n", nt_errstr(status)); - return False; + return false; } for (j=0; j < ARRAY_SIZE(levels); j++) { @@ -1745,18 +1745,18 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status) && ok[j]) { printf("QueryTrustedDomainInfoByName level %d failed - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } else if (NT_STATUS_IS_OK(status) && !ok[j]) { printf("QueryTrustedDomainInfoByName level %d unexpectedly succeeded - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } } } return ret; } -static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, +static bool test_EnumTrustDom(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -1766,7 +1766,7 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, uint32_t resume_handle = 0; struct lsa_DomainList domains; struct lsa_DomainListEx domains_ex; - BOOL ret = True; + bool ret = true; printf("\nTesting EnumTrustDom\n"); @@ -1781,7 +1781,7 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, /* NO_MORE_ENTRIES is allowed */ if (NT_STATUS_EQUAL(enum_status, NT_STATUS_NO_MORE_ENTRIES)) { - return True; + return true; } else if (NT_STATUS_EQUAL(enum_status, STATUS_MORE_ENTRIES)) { /* Windows 2003 gets this off by one on the first run */ if (r.out.domains->count < 3 || r.out.domains->count > 4) { @@ -1789,11 +1789,11 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, "asked it to (got %d, expected %d / %d == %d entries)\n", r.out.domains->count, LSA_ENUM_TRUST_DOMAIN_MULTIPLIER * 3, LSA_ENUM_TRUST_DOMAIN_MULTIPLIER, r.in.max_size); - ret = False; + ret = false; } } else if (!NT_STATUS_IS_OK(enum_status)) { printf("EnumTrustDom failed - %s\n", nt_errstr(enum_status)); - return False; + return false; } ret &= test_query_each_TrustDom(p, mem_ctx, handle, &domains); @@ -1814,7 +1814,7 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, /* NO_MORE_ENTRIES is allowed */ if (NT_STATUS_EQUAL(enum_status, NT_STATUS_NO_MORE_ENTRIES)) { - return True; + return true; } else if (NT_STATUS_EQUAL(enum_status, STATUS_MORE_ENTRIES)) { /* Windows 2003 gets this off by one on the first run */ if (r_ex.out.domains->count < 3 || r_ex.out.domains->count > 4) { @@ -1824,12 +1824,12 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, r_ex.in.max_size, LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER, r_ex.in.max_size / LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER); - ret = False; + ret = false; exit(1); } } else if (!NT_STATUS_IS_OK(enum_status)) { printf("EnumTrustedDomainEx failed - %s\n", nt_errstr(enum_status)); - return False; + return false; } ret &= test_query_each_TrustDomEx(p, mem_ctx, handle, &domains_ex); @@ -1839,12 +1839,12 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, return ret; } -static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, +static bool test_CreateTrustedDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct lsa_CreateTrustedDomain r; struct lsa_DomainInfo trustinfo; struct dom_sid *domsid[12]; @@ -1875,7 +1875,7 @@ static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, } if (!NT_STATUS_IS_OK(status)) { printf("CreateTrustedDomain failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { q.in.trustdom_handle = &trustdom_handle[i]; @@ -1883,14 +1883,14 @@ static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, status = dcerpc_lsa_QueryTrustedDomainInfo(p, mem_ctx, &q); if (!NT_STATUS_IS_OK(status)) { printf("QueryTrustedDomainInfo level 1 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else if (!q.out.info) { - ret = False; + ret = false; } else { if (strcmp(q.out.info->name.netbios_name.string, trustinfo.name.string) != 0) { printf("QueryTrustedDomainInfo returned inconsistant short name: %s != %s\n", q.out.info->name.netbios_name.string, trustinfo.name.string); - ret = False; + ret = false; } } } @@ -1898,29 +1898,29 @@ static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, /* now that we have some domains to look over, we can test the enum calls */ if (!test_EnumTrustDom(p, mem_ctx, handle)) { - ret = False; + ret = false; } for (i=0; i<12; i++) { if (!test_DeleteTrustedDomainBySid(p, mem_ctx, handle, domsid[i])) { - ret = False; + ret = false; } } return ret; } -static BOOL test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, +static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { struct lsa_QueryDomainInformationPolicy r; NTSTATUS status; int i; - BOOL ret = True; + bool ret = true; if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping QueryDomainInformationPolicy test against Samba4\n"); - return True; + return true; } printf("\nTesting QueryDomainInformationPolicy\n"); @@ -1935,7 +1935,7 @@ static BOOL test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("QueryDomainInformationPolicy failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; continue; } } @@ -1944,19 +1944,19 @@ static BOOL test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, } -static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, +static bool test_QueryInfoPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { struct lsa_QueryInfoPolicy r; NTSTATUS status; int i; - BOOL ret = True; + bool ret = true; printf("\nTesting QueryInfoPolicy\n"); if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping QueryInfoPolicy against Samba4\n"); - return True; + return true; } for (i=1;i<13;i++) { @@ -1973,7 +1973,7 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, case LSA_POLICY_INFO_AUDIT_FULL_QUERY: if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("server should have failed level %u: %s\n", i, nt_errstr(status)); - ret = False; + ret = false; } break; case LSA_POLICY_INFO_DOMAIN: @@ -1981,7 +1981,7 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, case LSA_POLICY_INFO_DNS: if (!NT_STATUS_IS_OK(status)) { printf("QueryInfoPolicy failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } break; default: @@ -1989,11 +1989,11 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, /* Other levels not implemented yet */ if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) { printf("QueryInfoPolicy failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } else if (!NT_STATUS_IS_OK(status)) { printf("QueryInfoPolicy failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } break; } @@ -2021,14 +2021,14 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, return ret; } -static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, +static bool test_QueryInfoPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { struct lsa_QueryInfoPolicy2 r; NTSTATUS status; int i; - BOOL ret = True; + bool ret = true; printf("\nTesting QueryInfoPolicy2\n"); for (i=1;i<13;i++) { r.in.handle = handle; @@ -2044,7 +2044,7 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, case LSA_POLICY_INFO_AUDIT_FULL_QUERY: if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("server should have failed level %u: %s\n", i, nt_errstr(status)); - ret = False; + ret = false; } break; case LSA_POLICY_INFO_DOMAIN: @@ -2052,7 +2052,7 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, case LSA_POLICY_INFO_DNS: if (!NT_STATUS_IS_OK(status)) { printf("QueryInfoPolicy2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } break; default: @@ -2060,11 +2060,11 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, /* Other levels not implemented yet */ if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) { printf("QueryInfoPolicy2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } else if (!NT_STATUS_IS_OK(status)) { printf("QueryInfoPolicy2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } break; } @@ -2073,11 +2073,11 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, return ret; } -static BOOL test_GetUserName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_GetUserName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct lsa_GetUserName r; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct lsa_StringPointer authority_name_p; printf("\nTesting GetUserName\n"); @@ -2091,13 +2091,13 @@ static BOOL test_GetUserName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) if (!NT_STATUS_IS_OK(status)) { printf("GetUserName failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -BOOL test_lsa_Close(struct dcerpc_pipe *p, +bool test_lsa_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -2113,27 +2113,27 @@ BOOL test_lsa_Close(struct dcerpc_pipe *p, status = dcerpc_lsa_Close(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_lsa_Close(p, mem_ctx, &r); /* its really a fault - we need a status code for rpc fault */ if (!NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -BOOL torture_rpc_lsa(struct torture_context *torture) +bool torture_rpc_lsa(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct policy_handle *handle; mem_ctx = talloc_init("torture_rpc_lsa"); @@ -2141,83 +2141,83 @@ BOOL torture_rpc_lsa(struct torture_context *torture) status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } if (!test_OpenPolicy(p, mem_ctx)) { - ret = False; + ret = false; } if (!test_lsa_OpenPolicy2(p, mem_ctx, &handle)) { - ret = False; + ret = false; } if (handle) { if (!test_LookupNames_wellknown(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_LookupNames_bogus(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_LookupSids_async(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_QueryDomainInfoPolicy(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_CreateAccount(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_CreateSecret(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_CreateTrustedDomain(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_EnumAccounts(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_EnumPrivs(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_QueryInfoPolicy(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_QueryInfoPolicy2(p, mem_ctx, handle)) { - ret = False; + ret = false; } #if 0 if (!test_Delete(p, mem_ctx, handle)) { - ret = False; + ret = false; } #endif if (!test_many_LookupSids(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_lsa_Close(p, mem_ctx, handle)) { - ret = False; + ret = false; } } else { if (!test_many_LookupSids(p, mem_ctx, handle)) { - ret = False; + ret = false; } } if (!test_GetUserName(p, mem_ctx)) { - ret = False; + ret = false; } talloc_free(mem_ctx); @@ -2225,23 +2225,23 @@ BOOL torture_rpc_lsa(struct torture_context *torture) return ret; } -BOOL torture_rpc_lsa_get_user(struct torture_context *torture) +bool torture_rpc_lsa_get_user(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("torture_rpc_lsa_get_user"); status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } if (!test_GetUserName(p, mem_ctx)) { - ret = False; + ret = false; } talloc_free(mem_ctx); diff --git a/source4/torture/rpc/lsa_lookup.c b/source4/torture/rpc/lsa_lookup.c index 7cab05257d..9c817a7061 100644 --- a/source4/torture/rpc/lsa_lookup.c +++ b/source4/torture/rpc/lsa_lookup.c @@ -26,7 +26,7 @@ #include "librpc/gen_ndr/ndr_lsa_c.h" #include "libcli/security/security.h" -static BOOL open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, +static bool open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct policy_handle **handle) { struct lsa_ObjectAttribute attr; @@ -36,7 +36,7 @@ static BOOL open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, *handle = talloc(mem_ctx, struct policy_handle); if (!*handle) { - return False; + return false; } qos.len = 0; @@ -61,7 +61,7 @@ static BOOL open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, return NT_STATUS_IS_OK(status); } -static BOOL get_domainsid(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, +static bool get_domainsid(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct policy_handle *handle, struct dom_sid **sid) { @@ -72,10 +72,10 @@ static BOOL get_domainsid(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, r.in.handle = handle; status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) return False; + if (!NT_STATUS_IS_OK(status)) return false; *sid = r.out.info->domain.sid; - return True; + return true; } static NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, uint16_t level, @@ -127,7 +127,7 @@ static const char *sid_type_lookup(enum lsa_SidType r) return "Invalid sid type\n"; } -static BOOL test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, +static bool test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct policy_handle *handle, struct dom_sid **sids, uint32_t num_sids, int level, NTSTATUS expected_result, @@ -136,7 +136,7 @@ static BOOL test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct lsa_TransNameArray names; NTSTATUS status; uint32_t i; - BOOL ret = True; + bool ret = true; status = lookup_sids(mem_ctx, level, p, handle, sids, num_sids, &names); @@ -144,12 +144,12 @@ static BOOL test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, printf("For level %d expected %s, got %s\n", level, nt_errstr(expected_result), nt_errstr(status)); - return False; + return false; } if (!NT_STATUS_EQUAL(status, NT_STATUS_OK) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) { - return True; + return true; } for (i=0; i<num_sids; i++) { @@ -159,13 +159,13 @@ static BOOL test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, dom_sid_string(mem_ctx, sids[i]), sid_type_lookup(types[i]), sid_type_lookup(names.names[i].sid_type)); - ret = False; + ret = false; } } return ret; } -static BOOL get_downleveltrust(struct torture_context *tctx, struct dcerpc_pipe *p, +static bool get_downleveltrust(struct torture_context *tctx, struct dcerpc_pipe *p, struct policy_handle *handle, struct dom_sid **sid) { @@ -205,7 +205,7 @@ static BOOL get_downleveltrust(struct torture_context *tctx, struct dcerpc_pipe if ((q.out.info->info_ex.trust_direction & 2) && (q.out.info->info_ex.trust_type == 1)) { *sid = domains.domains[i].sid; - return True; + return true; } } @@ -218,7 +218,7 @@ bool torture_rpc_lsa_lookup(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct policy_handle *handle; struct dom_sid *dom_sid; struct dom_sid *trusted_sid; diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c index f27dcd7b05..258450ada1 100644 --- a/source4/torture/rpc/mgmt.c +++ b/source4/torture/rpc/mgmt.c @@ -30,9 +30,9 @@ /* ask the server what interface IDs are available on this endpoint */ -BOOL test_inq_if_ids(struct torture_context *tctx, +bool test_inq_if_ids(struct torture_context *tctx, struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - BOOL (*per_id_test)(struct torture_context *, + bool (*per_id_test)(struct torture_context *, const struct ndr_interface_table *iface, TALLOC_CTX *mem_ctx, struct ndr_syntax_id *id), @@ -49,17 +49,17 @@ BOOL test_inq_if_ids(struct torture_context *tctx, status = dcerpc_mgmt_inq_if_ids(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("inq_if_ids failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!W_ERROR_IS_OK(r.out.result)) { printf("inq_if_ids gave error code %s\n", win_errstr(r.out.result)); - return False; + return false; } if (!vector) { printf("inq_if_ids gave NULL if_id_vector\n"); - return False; + return false; } for (i=0;i<vector->count;i++) { @@ -76,10 +76,10 @@ BOOL test_inq_if_ids(struct torture_context *tctx, } } - return True; + return true; } -static BOOL test_inq_stats(struct dcerpc_pipe *p, +static bool test_inq_stats(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -93,12 +93,12 @@ static BOOL test_inq_stats(struct dcerpc_pipe *p, status = dcerpc_mgmt_inq_stats(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("inq_stats failed - %s\n", nt_errstr(status)); - return False; + return false; } if (statistics.count != MGMT_STATS_ARRAY_MAX_SIZE) { printf("Unexpected array size %d\n", statistics.count); - return False; + return false; } printf("\tcalls_in %6d calls_out %6d\n\tpkts_in %6d pkts_out %6d\n", @@ -107,16 +107,16 @@ static BOOL test_inq_stats(struct dcerpc_pipe *p, statistics.statistics[MGMT_STATS_PKTS_IN], statistics.statistics[MGMT_STATS_PKTS_OUT]); - return True; + return true; } -static BOOL test_inq_princ_name(struct dcerpc_pipe *p, +static bool test_inq_princ_name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; struct mgmt_inq_princ_name r; int i; - BOOL ret = False; + bool ret = false; for (i=0;i<100;i++) { r.in.authn_proto = i; /* DCERPC_AUTH_TYPE_* */ @@ -128,7 +128,7 @@ static BOOL test_inq_princ_name(struct dcerpc_pipe *p, } if (W_ERROR_IS_OK(r.out.result)) { const char *name = gensec_get_name_by_authtype(i); - ret = True; + ret = true; if (name) { printf("\tprinciple name for proto %u (%s) is '%s'\n", i, name, r.out.princ_name); @@ -143,10 +143,10 @@ static BOOL test_inq_princ_name(struct dcerpc_pipe *p, printf("\tno principle names?\n"); } - return True; + return true; } -static BOOL test_is_server_listening(struct dcerpc_pipe *p, +static bool test_is_server_listening(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -156,7 +156,7 @@ static BOOL test_is_server_listening(struct dcerpc_pipe *p, status = dcerpc_mgmt_is_server_listening(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("is_server_listening failed - %s\n", nt_errstr(status)); - return False; + return false; } if (*r.out.status != 0 || r.out.result == 0) { @@ -165,10 +165,10 @@ static BOOL test_is_server_listening(struct dcerpc_pipe *p, printf("\tserver is listening\n"); } - return True; + return true; } -static BOOL test_stop_server_listening(struct dcerpc_pipe *p, +static bool test_stop_server_listening(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -177,26 +177,26 @@ static BOOL test_stop_server_listening(struct dcerpc_pipe *p, status = dcerpc_mgmt_stop_server_listening(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("stop_server_listening failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!W_ERROR_IS_OK(r.out.result)) { printf("\tserver refused to stop listening - %s\n", win_errstr(r.out.result)); } else { printf("\tserver allowed a stop_server_listening request\n"); - return False; + return false; } - return True; + return true; } -BOOL torture_rpc_mgmt(struct torture_context *torture) +bool torture_rpc_mgmt(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx, *loop_ctx; - BOOL ret = True; + bool ret = true; const struct ndr_interface_list *l; struct dcerpc_binding *b; @@ -205,7 +205,7 @@ BOOL torture_rpc_mgmt(struct torture_context *torture) status = torture_rpc_binding(torture, &b); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } for (l=ndr_table_list();l;l=l->next) { @@ -239,28 +239,28 @@ BOOL torture_rpc_mgmt(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { talloc_free(loop_ctx); - ret = False; + ret = false; continue; } if (!test_is_server_listening(p, loop_ctx)) { - ret = False; + ret = false; } if (!test_stop_server_listening(p, loop_ctx)) { - ret = False; + ret = false; } if (!test_inq_stats(p, loop_ctx)) { - ret = False; + ret = false; } if (!test_inq_princ_name(p, loop_ctx)) { - ret = False; + ret = false; } if (!test_inq_if_ids(torture, p, loop_ctx, NULL, NULL)) { - ret = False; + ret = false; } } diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 92f8778df6..be0a80b8bd 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -68,11 +68,11 @@ static struct cli_credentials *create_anon_creds(TALLOC_CTX *mem_ctx) * This tests a RPC call using an invalid vuid */ -BOOL torture_bind_authcontext(struct torture_context *torture) +bool torture_bind_authcontext(struct torture_context *torture) { TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret = False; + bool ret = false; struct lsa_ObjectAttribute objectattr; struct lsa_OpenPolicy2 openpolicy; struct policy_handle handle; @@ -88,7 +88,7 @@ BOOL torture_bind_authcontext(struct torture_context *torture) if (mem_ctx == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } status = smbcli_full_connection(mem_ctx, &cli, @@ -146,7 +146,7 @@ BOOL torture_bind_authcontext(struct torture_context *torture) goto done; } - session2 = smbcli_session_init(cli->transport, mem_ctx, False); + session2 = smbcli_session_init(cli->transport, mem_ctx, false); if (session2 == NULL) { d_printf("smbcli_session_init failed\n"); goto done; @@ -186,7 +186,7 @@ BOOL torture_bind_authcontext(struct torture_context *torture) goto done; } - ret = True; + ret = true; done: talloc_free(mem_ctx); return ret; @@ -196,12 +196,12 @@ BOOL torture_bind_authcontext(struct torture_context *torture) * Bind to lsa using a specific auth method */ -static BOOL bindtest(struct smbcli_state *cli, +static bool bindtest(struct smbcli_state *cli, struct cli_credentials *credentials, uint8_t auth_type, uint8_t auth_level) { TALLOC_CTX *mem_ctx; - BOOL ret = False; + bool ret = false; NTSTATUS status; struct dcerpc_pipe *lsa_pipe; @@ -213,7 +213,7 @@ static BOOL bindtest(struct smbcli_state *cli, if ((mem_ctx = talloc_init("bindtest")) == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } lsa_pipe = dcerpc_pipe_init(mem_ctx, @@ -273,7 +273,7 @@ static BOOL bindtest(struct smbcli_state *cli, goto done; } - ret = True; + ret = true; done: talloc_free(mem_ctx); return ret; @@ -283,18 +283,18 @@ static BOOL bindtest(struct smbcli_state *cli, * test authenticated RPC binds with the variants Samba3 does support */ -BOOL torture_bind_samba3(struct torture_context *torture) +bool torture_bind_samba3(struct torture_context *torture) { TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret = False; + bool ret = false; struct smbcli_state *cli; mem_ctx = talloc_init("torture_bind_authcontext"); if (mem_ctx == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } status = smbcli_full_connection(mem_ctx, &cli, @@ -307,7 +307,7 @@ BOOL torture_bind_samba3(struct torture_context *torture) goto done; } - ret = True; + ret = true; ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP, DCERPC_AUTH_LEVEL_INTEGRITY); @@ -502,7 +502,7 @@ static NTSTATUS get_usr_handle(struct smbcli_state *cli, * Create a test user */ -static BOOL create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, +static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, struct cli_credentials *admin_creds, const char *username, const char *password, char **domain_name, @@ -512,11 +512,11 @@ static BOOL create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, NTSTATUS status; struct dcerpc_pipe *samr_pipe; struct policy_handle *wks_handle; - BOOL ret = False; + bool ret = false; if (!(tmp_ctx = talloc_new(mem_ctx))) { d_printf("talloc_init failed\n"); - return False; + return false; } status = get_usr_handle(cli, tmp_ctx, admin_creds, @@ -604,7 +604,7 @@ static BOOL create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, *domain_name= talloc_steal(mem_ctx, *domain_name); *user_sid = talloc_steal(mem_ctx, *user_sid); - ret = True; + ret = true; done: talloc_free(tmp_ctx); return ret; @@ -614,7 +614,7 @@ static BOOL create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, * Delete a test user */ -static BOOL delete_user(struct smbcli_state *cli, +static bool delete_user(struct smbcli_state *cli, struct cli_credentials *admin_creds, const char *username) { @@ -623,11 +623,11 @@ static BOOL delete_user(struct smbcli_state *cli, char *dom_name; struct dcerpc_pipe *samr_pipe; struct policy_handle *user_handle; - BOOL ret = False; + bool ret = false; if ((mem_ctx = talloc_init("leave")) == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } status = get_usr_handle(cli, mem_ctx, admin_creds, @@ -654,7 +654,7 @@ static BOOL delete_user(struct smbcli_state *cli, } } - ret = True; + ret = true; done: talloc_free(mem_ctx); @@ -665,8 +665,8 @@ static BOOL delete_user(struct smbcli_state *cli, * Do a Samba3-style join */ -static BOOL join3(struct smbcli_state *cli, - BOOL use_level25, +static bool join3(struct smbcli_state *cli, + bool use_level25, struct cli_credentials *admin_creds, struct cli_credentials *wks_creds) { @@ -675,11 +675,11 @@ static BOOL join3(struct smbcli_state *cli, char *dom_name; struct dcerpc_pipe *samr_pipe; struct policy_handle *wks_handle; - BOOL ret = False; + bool ret = false; if ((mem_ctx = talloc_init("join3")) == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } status = get_usr_handle( @@ -788,7 +788,7 @@ static BOOL join3(struct smbcli_state *cli, } } - ret = True; + ret = true; done: talloc_free(mem_ctx); @@ -799,12 +799,12 @@ static BOOL join3(struct smbcli_state *cli, * Do a ReqChallenge/Auth2 and get the wks creds */ -static BOOL auth2(struct smbcli_state *cli, +static bool auth2(struct smbcli_state *cli, struct cli_credentials *wks_cred) { TALLOC_CTX *mem_ctx; struct dcerpc_pipe *net_pipe; - BOOL result = False; + bool result = false; NTSTATUS status; struct netr_ServerReqChallenge r; struct netr_Credential netr_cli_creds; @@ -818,7 +818,7 @@ static BOOL auth2(struct smbcli_state *cli, mem_ctx = talloc_new(NULL); if (mem_ctx == NULL) { d_printf("talloc_new failed\n"); - return False; + return false; } net_pipe = dcerpc_pipe_init(mem_ctx, @@ -894,7 +894,7 @@ static BOOL auth2(struct smbcli_state *cli, cli_credentials_set_netlogon_creds(wks_cred, creds_state); - result = True; + result = true; done: talloc_free(mem_ctx); @@ -906,20 +906,20 @@ static BOOL auth2(struct smbcli_state *cli, * login, and change the wks password */ -static BOOL schan(struct smbcli_state *cli, +static bool schan(struct smbcli_state *cli, struct cli_credentials *wks_creds, struct cli_credentials *user_creds) { TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret = False; + bool ret = false; struct dcerpc_pipe *net_pipe; int i; mem_ctx = talloc_new(NULL); if (mem_ctx == NULL) { d_printf("talloc_new failed\n"); - return False; + return false; } net_pipe = dcerpc_pipe_init(mem_ctx, @@ -1093,7 +1093,7 @@ static BOOL schan(struct smbcli_state *cli, CRED_SPECIFIED); } - ret = True; + ret = true; done: talloc_free(mem_ctx); return ret; @@ -1103,13 +1103,13 @@ static BOOL schan(struct smbcli_state *cli, * Delete the wks account again */ -static BOOL leave(struct smbcli_state *cli, +static bool leave(struct smbcli_state *cli, struct cli_credentials *admin_creds, struct cli_credentials *wks_creds) { char *wks_name = talloc_asprintf( NULL, "%s$", cli_credentials_get_workstation(wks_creds)); - BOOL ret; + bool ret; ret = delete_user(cli, admin_creds, wks_name); talloc_free(wks_name); @@ -1120,11 +1120,11 @@ static BOOL leave(struct smbcli_state *cli, * Test the Samba3 DC code a bit. Join, do some schan netlogon ops, leave */ -BOOL torture_netlogon_samba3(struct torture_context *torture) +bool torture_netlogon_samba3(struct torture_context *torture) { TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret = False; + bool ret = false; struct smbcli_state *cli; struct cli_credentials *anon_creds; struct cli_credentials *wks_creds; @@ -1140,7 +1140,7 @@ BOOL torture_netlogon_samba3(struct torture_context *torture) if (mem_ctx == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } if (!(anon_creds = create_anon_creds(mem_ctx))) { @@ -1171,7 +1171,7 @@ BOOL torture_netlogon_samba3(struct torture_context *torture) generate_random_str(wks_creds, 8), CRED_SPECIFIED); - if (!join3(cli, False, cmdline_credentials, wks_creds)) { + if (!join3(cli, false, cmdline_credentials, wks_creds)) { d_printf("join failed\n"); goto done; } @@ -1206,7 +1206,7 @@ BOOL torture_netlogon_samba3(struct torture_context *torture) goto done; } - ret = True; + ret = true; done: talloc_free(mem_ctx); @@ -1218,14 +1218,14 @@ BOOL torture_netlogon_samba3(struct torture_context *torture) * credentials */ -static BOOL test_join3(TALLOC_CTX *mem_ctx, - BOOL use_level25, +static bool test_join3(TALLOC_CTX *mem_ctx, + bool use_level25, struct cli_credentials *smb_creds, struct cli_credentials *samr_creds, const char *wks_name) { NTSTATUS status; - BOOL ret = False; + bool ret = false; struct smbcli_state *cli; struct cli_credentials *wks_creds; @@ -1273,7 +1273,7 @@ static BOOL test_join3(TALLOC_CTX *mem_ctx, talloc_free(cli); - ret = True; + ret = true; done: return ret; @@ -1284,10 +1284,10 @@ static BOOL test_join3(TALLOC_CTX *mem_ctx, * session key in the setpassword routine. Test the join by doing the auth2. */ -BOOL torture_samba3_sessionkey(struct torture_context *torture) +bool torture_samba3_sessionkey(struct torture_context *torture) { TALLOC_CTX *mem_ctx; - BOOL ret = False; + bool ret = false; struct cli_credentials *anon_creds; const char *wks_name; @@ -1297,7 +1297,7 @@ BOOL torture_samba3_sessionkey(struct torture_context *torture) if (mem_ctx == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } if (!(anon_creds = create_anon_creds(mem_ctx))) { @@ -1305,56 +1305,56 @@ BOOL torture_samba3_sessionkey(struct torture_context *torture) goto done; } - ret = True; + ret = true; - if (!torture_setting_bool(torture, "samba3", False)) { + if (!torture_setting_bool(torture, "samba3", false)) { /* Samba3 in the build farm right now does this happily. Need * to fix :-) */ - if (test_join3(mem_ctx, False, anon_creds, NULL, wks_name)) { + if (test_join3(mem_ctx, false, anon_creds, NULL, wks_name)) { d_printf("join using anonymous bind on an anonymous smb " "connection succeeded -- HUH??\n"); - ret = False; + ret = false; } } - if (!test_join3(mem_ctx, False, anon_creds, cmdline_credentials, + if (!test_join3(mem_ctx, false, anon_creds, cmdline_credentials, wks_name)) { d_printf("join using ntlmssp bind on an anonymous smb " "connection failed\n"); - ret = False; + ret = false; } - if (!test_join3(mem_ctx, False, cmdline_credentials, NULL, wks_name)) { + if (!test_join3(mem_ctx, false, cmdline_credentials, NULL, wks_name)) { d_printf("join using anonymous bind on an authenticated smb " "connection failed\n"); - ret = False; + ret = false; } - if (!test_join3(mem_ctx, False, cmdline_credentials, + if (!test_join3(mem_ctx, false, cmdline_credentials, cmdline_credentials, wks_name)) { d_printf("join using ntlmssp bind on an authenticated smb " "connection failed\n"); - ret = False; + ret = false; } /* * The following two are tests for setuserinfolevel 25 */ - if (!test_join3(mem_ctx, True, anon_creds, cmdline_credentials, + if (!test_join3(mem_ctx, true, anon_creds, cmdline_credentials, wks_name)) { d_printf("join using ntlmssp bind on an anonymous smb " "connection failed\n"); - ret = False; + ret = false; } - if (!test_join3(mem_ctx, True, cmdline_credentials, NULL, wks_name)) { + if (!test_join3(mem_ctx, true, cmdline_credentials, NULL, wks_name)) { d_printf("join using anonymous bind on an authenticated smb " "connection failed\n"); - ret = False; + ret = false; } done: @@ -1547,7 +1547,7 @@ NTSTATUS secondary_tcon(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - if (!(result = smbcli_tree_init(session, mem_ctx, False))) { + if (!(result = smbcli_tree_init(session, mem_ctx, false))) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; } @@ -1577,12 +1577,12 @@ NTSTATUS secondary_tcon(TALLOC_CTX *mem_ctx, * Test the getusername behaviour */ -BOOL torture_samba3_rpc_getusername(struct torture_context *torture) +bool torture_samba3_rpc_getusername(struct torture_context *torture) { NTSTATUS status; struct smbcli_state *cli; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct dom_sid *user_sid; struct dom_sid *created_sid; struct cli_credentials *anon_creds; @@ -1590,7 +1590,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) char *domain_name; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } status = smbcli_full_connection( @@ -1599,21 +1599,21 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) smbcli_full_connection failed: %s\n", __location__, nt_errstr(status)); - ret = False; + ret = false; goto done; } if (!(user_sid = whoami(mem_ctx, cli->tree))) { d_printf("(%s) whoami on auth'ed connection failed\n", __location__); - ret = False; + ret = false; } talloc_free(cli); if (!(anon_creds = create_anon_creds(mem_ctx))) { d_printf("(%s) create_anon_creds failed\n", __location__); - ret = False; + ret = false; goto done; } @@ -1623,14 +1623,14 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) anon smbcli_full_connection failed: %s\n", __location__, nt_errstr(status)); - ret = False; + ret = false; goto done; } if (!(user_sid = whoami(mem_ctx, cli->tree))) { d_printf("(%s) whoami on anon connection failed\n", __location__); - ret = False; + ret = false; goto done; } @@ -1639,12 +1639,12 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) d_printf("(%s) Anon lsa_GetUserName returned %s, expected " "S-1-5-7", __location__, dom_sid_string(mem_ctx, user_sid)); - ret = False; + ret = false; } if (!(user_creds = cli_credentials_init(mem_ctx))) { d_printf("(%s) cli_credentials_init failed\n", __location__); - ret = False; + ret = false; goto done; } @@ -1660,7 +1660,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) cli_credentials_get_password(user_creds), &domain_name, &created_sid)) { d_printf("(%s) create_user failed\n", __location__); - ret = False; + ret = false; goto done; } @@ -1672,7 +1672,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) struct smb_composite_sesssetup setup; struct smbcli_tree *tree; - session2 = smbcli_session_init(cli->transport, mem_ctx, False); + session2 = smbcli_session_init(cli->transport, mem_ctx, false); if (session2 == NULL) { d_printf("(%s) smbcli_session_init failed\n", __location__); @@ -1688,7 +1688,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) session setup with new user failed: " "%s\n", __location__, nt_errstr(status)); - ret = False; + ret = false; goto done; } session2->vuid = setup.out.vuid; @@ -1697,14 +1697,14 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) "IPC$", &tree))) { d_printf("(%s) secondary_tcon failed\n", __location__); - ret = False; + ret = false; goto done; } if (!(user_sid = whoami(mem_ctx, tree))) { d_printf("(%s) whoami on user connection failed\n", __location__); - ret = False; + ret = false; goto delete; } @@ -1716,14 +1716,14 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) dom_sid_string(mem_ctx, user_sid)); if (!dom_sid_equal(created_sid, user_sid)) { - ret = False; + ret = false; } delete: if (!delete_user(cli, cmdline_credentials, cli_credentials_get_username(user_creds))) { d_printf("(%s) delete_user failed\n", __location__); - ret = False; + ret = false; } done: @@ -1731,14 +1731,14 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) return ret; } -static BOOL test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *sharename) { NTSTATUS status; struct srvsvc_NetShareGetInfo r; uint32_t levels[] = { 0, 1, 2, 501, 502, 1004, 1005, 1006, 1007, 1501 }; int i; - BOOL ret = True; + bool ret = true; r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); @@ -1757,14 +1757,14 @@ static BOOL test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("NetShareGetInfo level %u on share '%s' failed" " - %s\n", r.in.level, r.in.share_name, nt_errstr(status)); - ret = False; + ret = false; continue; } if (!W_ERROR_IS_OK(r.out.result)) { printf("NetShareGetInfo level %u on share '%s' failed " "- %s\n", r.in.level, r.in.share_name, win_errstr(r.out.result)); - ret = False; + ret = false; continue; } } @@ -1772,7 +1772,7 @@ static BOOL test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char **one_sharename) { NTSTATUS status; @@ -1780,7 +1780,7 @@ static BOOL test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareCtr0 c0; uint32_t levels[] = { 0, 1, 2, 501, 502, 1004, 1005, 1006, 1007 }; int i; - BOOL ret = True; + bool ret = true; r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p)); r.in.ctr.ctr0 = &c0; @@ -1799,7 +1799,7 @@ static BOOL test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("NetShareEnum level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } if (!W_ERROR_IS_OK(r.out.result)) { @@ -1818,24 +1818,24 @@ static BOOL test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -BOOL torture_samba3_rpc_srvsvc(struct torture_context *torture) +bool torture_samba3_rpc_srvsvc(struct torture_context *torture) { struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; const char *sharename = NULL; struct smbcli_state *cli; NTSTATUS status; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( mem_ctx, &cli, torture_setting_string(torture, "host", NULL), "IPC$", NULL))) { talloc_free(mem_ctx); - return False; + return false; } status = pipe_bind_smb(mem_ctx, cli->tree, "\\pipe\\srvsvc", @@ -1843,7 +1843,7 @@ BOOL torture_samba3_rpc_srvsvc(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) could not bind to srvsvc pipe: %s\n", __location__, nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -1967,7 +1967,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx, return status; } -BOOL try_tcon(TALLOC_CTX *mem_ctx, +bool try_tcon(TALLOC_CTX *mem_ctx, struct security_descriptor *orig_sd, struct smbcli_session *session, const char *sharename, const struct dom_sid *user_sid, @@ -1980,18 +1980,18 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, uint32_t rid; struct security_descriptor *sd; NTSTATUS status; - BOOL ret = True; + bool ret = true; if (!(tmp_ctx = talloc_new(mem_ctx))) { d_printf("talloc_new failed\n"); - return False; + return false; } status = secondary_tcon(tmp_ctx, session, sharename, &rmdir_tree); if (!NT_STATUS_IS_OK(status)) { d_printf("first tcon to delete dir failed\n"); talloc_free(tmp_ctx); - return False; + return false; } smbcli_rmdir(rmdir_tree, "sharesec_testdir"); @@ -2000,7 +2000,7 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, &domain_sid, &rid))) { d_printf("dom_sid_split_rid failed\n"); talloc_free(tmp_ctx); - return False; + return false; } sd = security_descriptor_create( @@ -2012,7 +2012,7 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, if (sd == NULL) { d_printf("security_descriptor_create failed\n"); talloc_free(tmp_ctx); - return False; + return false; } status = set_sharesec(mem_ctx, session, sharename, sd); @@ -2020,14 +2020,14 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, d_printf("custom set_sharesec failed: %s\n", nt_errstr(status)); talloc_free(tmp_ctx); - return False; + return false; } status = secondary_tcon(tmp_ctx, session, sharename, &tree); if (!NT_STATUS_EQUAL(status, expected_tcon)) { d_printf("Expected %s, got %s\n", nt_errstr(expected_tcon), nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -2040,7 +2040,7 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, expected_mkdir)) { d_printf("(%s) Expected %s, got %s\n", __location__, nt_errstr(expected_mkdir), nt_errstr(status)); - ret = False; + ret = false; } done: @@ -2051,23 +2051,23 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, d_printf("custom set_sharesec failed: %s\n", nt_errstr(status)); talloc_free(tmp_ctx); - return False; + return false; } talloc_free(tmp_ctx); return ret; } -BOOL torture_samba3_rpc_sharesec(struct torture_context *torture) +bool torture_samba3_rpc_sharesec(struct torture_context *torture) { TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct smbcli_state *cli; struct security_descriptor *sd; struct dom_sid *user_sid; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( @@ -2075,13 +2075,13 @@ BOOL torture_samba3_rpc_sharesec(struct torture_context *torture) "IPC$", NULL))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); - return False; + return false; } if (!(user_sid = whoami(mem_ctx, cli->tree))) { d_printf("whoami failed\n"); talloc_free(mem_ctx); - return False; + return false; } sd = get_sharesec(mem_ctx, cli->session, torture_setting_string(torture, @@ -2104,10 +2104,10 @@ BOOL torture_samba3_rpc_sharesec(struct torture_context *torture) return ret; } -BOOL torture_samba3_rpc_lsa(struct torture_context *torture) +bool torture_samba3_rpc_lsa(struct torture_context *torture) { TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct smbcli_state *cli; struct dcerpc_pipe *p; struct policy_handle lsa_handle; @@ -2115,7 +2115,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) struct dom_sid *domain_sid; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( @@ -2123,7 +2123,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) "IPC$", NULL))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); - return False; + return false; } status = pipe_bind_smb(mem_ctx, cli->tree, "\\lsarpc", @@ -2132,7 +2132,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) d_printf("(%s) pipe_bind_smb failed: %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } { @@ -2149,7 +2149,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) d_printf("(%s) dcerpc_lsa_OpenPolicy2 failed: %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2171,7 +2171,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) "failed: %s\n", __location__, levels[i], nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } if (levels[i] == 5) { domain_sid = r.out.info->account_domain.sid; @@ -2266,7 +2266,7 @@ static NTSTATUS find_printers(TALLOC_CTX *ctx, struct smbcli_tree *tree, return NT_STATUS_OK; } -static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, +static bool enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, const char *servername, int level, int *num_printers) { struct spoolss_EnumPrinters r; @@ -2283,20 +2283,20 @@ static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) dcerpc_spoolss_EnumPrinters failed: %s\n", __location__, nt_errstr(status)); - return False; + return false; } if (!W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { d_printf("(%s) EnumPrinters unexpected return code %s, should " "be WERR_INSUFFICIENT_BUFFER\n", __location__, win_errstr(r.out.result)); - return False; + return false; } blob = data_blob_talloc_zero(mem_ctx, r.out.needed); if (blob.data == NULL) { d_printf("(%s) data_blob_talloc failed\n", __location__); - return False; + return false; } r.in.buffer = &blob; @@ -2307,12 +2307,12 @@ static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, d_printf("(%s) dcerpc_spoolss_EnumPrinters failed: %s, " "%s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); - return False; + return false; } *num_printers = r.out.count; - return True; + return true; } static NTSTATUS getprinterinfo(TALLOC_CTX *ctx, struct dcerpc_pipe *pipe, @@ -2379,10 +2379,10 @@ static NTSTATUS getprinterinfo(TALLOC_CTX *ctx, struct dcerpc_pipe *pipe, return NT_STATUS_OK; } -BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) +bool torture_samba3_rpc_spoolss(struct torture_context *torture) { TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct smbcli_state *cli; struct dcerpc_pipe *p; NTSTATUS status; @@ -2393,7 +2393,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) char *servername; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( @@ -2401,7 +2401,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) "IPC$", NULL))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); - return False; + return false; } status = get_servername(mem_ctx, cli->tree, &servername); @@ -2409,19 +2409,19 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) d_fprintf(stderr, "(%s) get_servername returned %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } if (!NT_STATUS_IS_OK(find_printers(mem_ctx, cli->tree, &printers, &num_printers))) { talloc_free(mem_ctx); - return False; + return false; } if (num_printers == 0) { d_printf("Did not find printers\n"); talloc_free(mem_ctx); - return True; + return true; } status = pipe_bind_smb(mem_ctx, cli->tree, "\\spoolss", @@ -2430,7 +2430,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) d_printf("(%s) pipe_bind_smb failed: %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } ZERO_STRUCT(userlevel1); @@ -2460,7 +2460,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) "%s, %s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2476,7 +2476,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) "%s, %s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2498,7 +2498,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) "%s, %s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2511,7 +2511,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) getprinterinfo %d failed: %s\n", __location__, i, nt_errstr(status)); - ret = False; + ret = false; } } } @@ -2527,7 +2527,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) d_printf("(%s) dcerpc_spoolss_ClosePrinter failed: " "%s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2537,14 +2537,14 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) &num_enumerated)) { d_printf("(%s) enumprinters failed\n", __location__); talloc_free(mem_ctx); - return False; + return false; } if (num_printers != num_enumerated) { d_printf("(%s) netshareenum gave %d printers, " "enumprinters lvl 1 gave %d\n", __location__, num_printers, num_enumerated); talloc_free(mem_ctx); - return False; + return false; } } @@ -2554,14 +2554,14 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) &num_enumerated)) { d_printf("(%s) enumprinters failed\n", __location__); talloc_free(mem_ctx); - return False; + return false; } if (num_printers != num_enumerated) { d_printf("(%s) netshareenum gave %d printers, " "enumprinters lvl 2 gave %d\n", __location__, num_printers, num_enumerated); talloc_free(mem_ctx); - return False; + return false; } } @@ -2570,7 +2570,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) return ret; } -BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) +bool torture_samba3_rpc_wkssvc(struct torture_context *torture) { TALLOC_CTX *mem_ctx; struct smbcli_state *cli; @@ -2579,7 +2579,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) char *servername; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( @@ -2587,7 +2587,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) "IPC$", NULL))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); - return False; + return false; } status = get_servername(mem_ctx, cli->tree, &servername); @@ -2595,7 +2595,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) d_fprintf(stderr, "(%s) get_servername returned %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } status = pipe_bind_smb(mem_ctx, cli->tree, "\\wkssvc", @@ -2604,7 +2604,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) d_printf("(%s) pipe_bind_smb failed: %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } { @@ -2623,7 +2623,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) "%s, %s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); talloc_free(mem_ctx); - return False; + return false; } if (strcmp(servername, @@ -2633,12 +2633,12 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) __location__, servername, r.out.info->info100->server_name); talloc_free(mem_ctx); - return False; + return false; } } talloc_free(mem_ctx); - return True; + return true; } static NTSTATUS winreg_close(struct dcerpc_pipe *p, @@ -2767,14 +2767,14 @@ static NTSTATUS enumkeys(struct dcerpc_pipe *p, struct policy_handle *handle, talloc_free(tmp_ctx); r.in.enum_index += 1; - } while(True); + } while(true); return NT_STATUS_OK; } typedef NTSTATUS (*winreg_open_fn)(struct dcerpc_pipe *, TALLOC_CTX *, void *); -static BOOL test_Open3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Open3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *name, winreg_open_fn open_fn) { struct policy_handle handle; @@ -2789,7 +2789,7 @@ static BOOL test_Open3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) { d_printf("(%s) %s failed: %s, %s\n", __location__, name, nt_errstr(status), win_errstr(r.out.result)); - return False; + return false; } enumkeys(p, &handle, mem_ctx, 4); @@ -2798,18 +2798,18 @@ static BOOL test_Open3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) dcerpc_CloseKey failed: %s\n", __location__, nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL torture_samba3_rpc_winreg(struct torture_context *torture) +bool torture_samba3_rpc_winreg(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct { const char *name; winreg_open_fn fn; @@ -2829,7 +2829,7 @@ BOOL torture_samba3_rpc_winreg(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } #if 1 @@ -2837,7 +2837,7 @@ BOOL torture_samba3_rpc_winreg(struct torture_context *torture) #else for (i = 0; i < ARRAY_SIZE(open_fns); i++) { if (!test_Open3(p, mem_ctx, open_fns[i].name, open_fns[i].fn)) - ret = False; + ret = false; } #endif diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 46ed363423..aa0f6de788 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -62,7 +62,7 @@ struct samlogon_state { struct netr_Authenticator auth, auth2; struct creds_CredentialState *creds; NTSTATUS expected_error; - BOOL old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */ + bool old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */ DATA_BLOB chall; }; @@ -263,10 +263,10 @@ static NTSTATUS check_samlogon(struct samlogon_state *samlogon_state, * Test the normal 'LM and NTLM' combination */ -static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm_break break_which, char **error_string) +static bool test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm_break break_which, char **error_string) { - BOOL pass = True; - BOOL lm_good; + bool pass = true; + bool lm_good; NTSTATUS nt_status; DATA_BLOB lm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); @@ -307,11 +307,11 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'long' passwords, the LM password is invalid */ if (break_which == NO_NT && !lm_good) { - return True; + return true; } /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } return ((break_which == BREAK_NT) || (break_which == BREAK_BOTH)); } else if (NT_STATUS_EQUAL(NT_STATUS_NOT_FOUND, nt_status) && strchr_m(samlogon_state->account_name, '@')) { @@ -319,16 +319,16 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (break_which == NO_NT && !lm_good) { *error_string = strdup("LM password is 'long' (> 14 chars and therefore invalid) but login did not fail!"); - return False; + return false; } if (memcmp(lm_hash, lm_key, @@ -338,7 +338,7 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } switch (break_which) { @@ -354,7 +354,7 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm dump_data(1, user_session_key, sizeof(user_session_key)); d_printf("expected:\n"); dump_data(1, lm_key_expected, sizeof(lm_key_expected)); - pass = False; + pass = false; } break; } @@ -366,7 +366,7 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, session_key.data, session_key.length); - pass = False; + pass = false; } } return pass; @@ -376,7 +376,7 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm * Test LM authentication, no NT response supplied */ -static BOOL test_lm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lm(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, NO_NT, error_string); @@ -386,7 +386,7 @@ static BOOL test_lm(struct samlogon_state *samlogon_state, char **error_string) * Test the NTLM response only, no LM. */ -static BOOL test_ntlm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, NO_LM, error_string); } @@ -395,10 +395,10 @@ static BOOL test_ntlm(struct samlogon_state *samlogon_state, char **error_string * Test the NTLM response only, but in the LM field. */ -static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_string) { - BOOL lm_good; - BOOL pass = True; + bool lm_good; + bool pass = true; NTSTATUS nt_status; DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16); @@ -434,17 +434,17 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } - return False; + return false; } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (lm_good) { @@ -455,7 +455,7 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } #if 0 } else { @@ -466,7 +466,7 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, session_key.data, 8); - pass = False; + pass = false; } #endif } @@ -481,7 +481,7 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ dump_data(1, user_session_key, sizeof(user_session_key)); d_printf("expected:\n"); dump_data(1, lm_key_expected, sizeof(lm_key_expected)); - pass = False; + pass = false; } } return pass; @@ -491,10 +491,10 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ * Test the NTLM response only, but in the both the NT and LM fields. */ -static BOOL test_ntlm_in_both(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm_in_both(struct samlogon_state *samlogon_state, char **error_string) { - BOOL pass = True; - BOOL lm_good; + bool pass = true; + bool lm_good; NTSTATUS nt_status; DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16); @@ -531,21 +531,21 @@ static BOOL test_ntlm_in_both(struct samlogon_state *samlogon_state, char **erro if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } - return False; + return false; } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (memcmp(lm_hash, lm_key, @@ -555,7 +555,7 @@ static BOOL test_ntlm_in_both(struct samlogon_state *samlogon_state, char **erro dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } if (memcmp(session_key.data, user_session_key, sizeof(user_session_key)) != 0) { @@ -564,7 +564,7 @@ static BOOL test_ntlm_in_both(struct samlogon_state *samlogon_state, char **erro dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, session_key.data, session_key.length); - pass = False; + pass = false; } @@ -580,12 +580,12 @@ enum ntlmv2_domain { NO_DOMAIN }; -static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, +static bool test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, enum ntlm_break break_which, enum ntlmv2_domain ntlmv2_domain, char **error_string) { - BOOL pass = True; + bool pass = true; NTSTATUS nt_status; DATA_BLOB ntlmv2_response = data_blob(NULL, 0); DATA_BLOB lmv2_response = data_blob(NULL, 0); @@ -608,7 +608,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, &lmv2_response, &ntlmv2_response, &lmv2_session_key, &ntlmv2_session_key)) { data_blob_free(&names_blob); - return False; + return false; } break; case NO_DOMAIN: @@ -619,7 +619,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, &lmv2_response, &ntlmv2_response, &lmv2_session_key, &ntlmv2_session_key)) { data_blob_free(&names_blob); - return False; + return false; } break; } @@ -642,7 +642,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } return break_which == BREAK_BOTH; } else if (NT_STATUS_EQUAL(NT_STATUS_NOT_FOUND, nt_status) && strchr_m(samlogon_state->account_name, '@')) { @@ -650,11 +650,11 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } @@ -667,7 +667,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, lmv2_session_key.data, ntlmv2_session_key.length); - pass = False; + pass = false; } if (memcmp(lmv2_session_key.data, lm_session_key, sizeof(lm_session_key)) != 0) { @@ -676,7 +676,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, lmv2_session_key.data, 8); - pass = False; + pass = false; } break; default: @@ -689,7 +689,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, ntlmv2_session_key.data, ntlmv2_session_key.length); - pass = False; + pass = false; } else { d_printf("USER (NTLMv2) Session Key does not match expectations!\n"); @@ -697,7 +697,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, ntlmv2_session_key.data, ntlmv2_session_key.length); - pass = False; + pass = false; } } if (memcmp(ntlmv2_session_key.data, lm_session_key, @@ -709,14 +709,14 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, ntlmv2_session_key.data, 8); - pass = False; + pass = false; } else { d_printf("LM (NTLMv2) Session Key does not match expectations!\n"); d_printf("lm_session_key:\n"); dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, ntlmv2_session_key.data, 8); - pass = False; + pass = false; } } } @@ -728,12 +728,12 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, * Test the NTLM and LMv2 responses */ -static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, +static bool test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm_break break_which, enum ntlmv2_domain ntlmv2_domain, char **error_string) { - BOOL pass = True; + bool pass = true; NTSTATUS nt_status; DATA_BLOB ntlmv2_response = data_blob(NULL, 0); DATA_BLOB lmv2_response = data_blob(NULL, 0); @@ -744,7 +744,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, DATA_BLOB ntlm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB ntlm_session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16); - BOOL lm_good; + bool lm_good; uint8_t lm_hash[16]; uint8_t lm_session_key[8]; uint8_t user_session_key[16]; @@ -774,7 +774,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, &lmv2_response, &ntlmv2_response, &lmv2_session_key, &ntlmv2_session_key)) { data_blob_free(&names_blob); - return False; + return false; } break; case NO_DOMAIN: @@ -786,7 +786,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, &lmv2_response, &ntlmv2_response, &lmv2_session_key, &ntlmv2_session_key)) { data_blob_free(&names_blob); - return False; + return false; } break; } @@ -810,7 +810,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } return ((break_which == BREAK_NT) || (break_which == BREAK_BOTH)); } else if (NT_STATUS_EQUAL(NT_STATUS_NOT_FOUND, nt_status) && strchr_m(samlogon_state->account_name, '@')) { @@ -818,11 +818,11 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } switch (break_which) { @@ -834,7 +834,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, lmv2_session_key.data, ntlmv2_session_key.length); - pass = False; + pass = false; } if (memcmp(lmv2_session_key.data, lm_session_key, sizeof(lm_session_key)) != 0) { @@ -843,7 +843,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, lmv2_session_key.data, 8); - pass = False; + pass = false; } break; case BREAK_LM: @@ -854,7 +854,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, ntlm_session_key.data, ntlm_session_key.length); - pass = False; + pass = false; } if (lm_good) { if (memcmp(lm_hash, lm_session_key, @@ -864,7 +864,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } } else { static const uint8_t zeros[8]; @@ -875,7 +875,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, zeros, 8); - pass = False; + pass = false; } } break; @@ -887,7 +887,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, ntlm_session_key.data, ntlm_session_key.length); - pass = False; + pass = false; } if (memcmp(ntlm_session_key.data, lm_session_key, sizeof(lm_session_key)) != 0) { @@ -896,7 +896,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, ntlm_session_key.data, 8); - pass = False; + pass = false; } } @@ -907,13 +907,13 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, * Test the NTLMv2 and LMv2 responses */ -static BOOL test_lmv2_ntlmv2(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlmv2(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_NONE, UPPER_DOMAIN, error_string); } #if 0 -static BOOL test_lmv2_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_NONE, NO_DOMAIN, error_string); } @@ -923,12 +923,12 @@ static BOOL test_lmv2_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char * Test the LMv2 response only */ -static BOOL test_lmv2(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, NO_NT, UPPER_DOMAIN, error_string); } -static BOOL test_lmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, NO_NT, NO_DOMAIN, error_string); } @@ -937,93 +937,93 @@ static BOOL test_lmv2_no_dom(struct samlogon_state *samlogon_state, char **error * Test the NTLMv2 response only */ -static BOOL test_ntlmv2(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, NO_LM, UPPER_DOMAIN, error_string); } -static BOOL test_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, NO_LM, NO_DOMAIN, error_string); } -static BOOL test_lm_ntlm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lm_ntlm(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, BREAK_NONE, error_string); } -static BOOL test_ntlm_lm_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm_lm_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, BREAK_LM, error_string); } -static BOOL test_ntlm_ntlm_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm_ntlm_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, BREAK_NT, error_string); } -static BOOL test_lm_ntlm_both_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lm_ntlm_both_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, BREAK_BOTH, error_string); } -static BOOL test_ntlmv2_lmv2_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_lmv2_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_LM, UPPER_DOMAIN, error_string); } -static BOOL test_ntlmv2_lmv2_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_lmv2_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_LM, NO_DOMAIN, error_string); } -static BOOL test_ntlmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_NT, UPPER_DOMAIN, error_string); } #if 0 -static BOOL test_ntlmv2_ntlmv2_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_ntlmv2_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_NT, NO_DOMAIN, error_string); } #endif -static BOOL test_ntlmv2_both_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_both_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_BOTH, UPPER_DOMAIN, error_string); } -static BOOL test_ntlmv2_both_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_both_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_BOTH, NO_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_both_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_both_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_BOTH, UPPER_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_both_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_both_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_BOTH, NO_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_break_ntlm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_break_ntlm(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_NT, UPPER_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_break_ntlm_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_break_ntlm_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_NT, NO_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_break_lm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_break_lm(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_LM, UPPER_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_break_lm_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_break_lm_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_LM, NO_DOMAIN, error_string); } @@ -1036,14 +1036,14 @@ static BOOL test_lmv2_ntlm_break_lm_no_dom(struct samlogon_state *samlogon_state * (NETLOGON is the wrong place). */ -static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm2(struct samlogon_state *samlogon_state, char **error_string) { - BOOL pass = True; + bool pass = true; NTSTATUS nt_status; DATA_BLOB lm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); - BOOL lm_good; + bool lm_good; uint8_t lm_key[8]; uint8_t nt_hash[16]; uint8_t lm_hash[16]; @@ -1093,17 +1093,17 @@ static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_strin if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } - return False; + return false; } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (lm_good) { @@ -1114,7 +1114,7 @@ static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_strin dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } } else { static const uint8_t zeros[8]; @@ -1125,7 +1125,7 @@ static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_strin dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, zeros, 8); - pass = False; + pass = false; } } if (memcmp(nt_key, user_session_key, 16) != 0) { @@ -1134,12 +1134,12 @@ static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_strin dump_data(1, user_session_key, sizeof(user_session_key)); d_printf("expected:\n"); dump_data(1, nt_key, sizeof(nt_key)); - pass = False; + pass = false; } return pass; } -static BOOL test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_break break_which, char **error_string) +static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_break break_which, char **error_string) { NTSTATUS nt_status; DATA_BLOB nt_response = data_blob(NULL, 0); @@ -1153,7 +1153,7 @@ static BOOL test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea uint8_t lm_hash[16]; static const uint8_t zeros[8]; DATA_BLOB chall = data_blob_talloc(samlogon_state->mem_ctx, zeros, sizeof(zeros)); - BOOL lm_good = E_deshash(samlogon_state->password, lm_hash); + bool lm_good = E_deshash(samlogon_state->password, lm_hash); ZERO_STRUCT(user_session_key); @@ -1190,11 +1190,11 @@ static BOOL test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } /* for 'long' passwords, the LM password is invalid */ if (break_which == NO_NT && !lm_good) { - return True; + return true; } return ((break_which == BREAK_NT) || (break_which == BREAK_BOTH)); } else if (NT_STATUS_EQUAL(NT_STATUS_NOT_FOUND, nt_status) && strchr_m(samlogon_state->account_name, '@')) { @@ -1202,42 +1202,42 @@ static BOOL test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (break_which == NO_NT && !lm_good) { *error_string = strdup("LM password is 'long' (> 14 chars and therefore invalid) but login did not fail!"); - return False; + return false; } - return True; + return true; } -static BOOL test_plaintext_none_broken(struct samlogon_state *samlogon_state, +static bool test_plaintext_none_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, BREAK_NONE, error_string); } -static BOOL test_plaintext_lm_broken(struct samlogon_state *samlogon_state, +static bool test_plaintext_lm_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, BREAK_LM, error_string); } -static BOOL test_plaintext_nt_broken(struct samlogon_state *samlogon_state, +static bool test_plaintext_nt_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, BREAK_NT, error_string); } -static BOOL test_plaintext_nt_only(struct samlogon_state *samlogon_state, +static bool test_plaintext_nt_only(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, NO_LM, error_string); } -static BOOL test_plaintext_lm_only(struct samlogon_state *samlogon_state, +static bool test_plaintext_lm_only(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, NO_NT, error_string); } @@ -1261,63 +1261,63 @@ static BOOL test_plaintext_lm_only(struct samlogon_state *samlogon_state, */ static const struct ntlm_tests { - BOOL (*fn)(struct samlogon_state *, char **); + bool (*fn)(struct samlogon_state *, char **); const char *name; - BOOL expect_fail; + bool expect_fail; } test_table[] = { - {test_lmv2_ntlmv2, "NTLMv2 and LMv2", False}, + {test_lmv2_ntlmv2, "NTLMv2 and LMv2", false}, #if 0 - {test_lmv2_ntlmv2_no_dom, "NTLMv2 and LMv2 (no domain)", False}, + {test_lmv2_ntlmv2_no_dom, "NTLMv2 and LMv2 (no domain)", false}, #endif - {test_lm, "LM", False}, - {test_lm_ntlm, "LM and NTLM", False}, - {test_lm_ntlm_both_broken, "LM and NTLM, both broken", False}, - {test_ntlm, "NTLM", False}, - {test_ntlm_in_lm, "NTLM in LM", False}, - {test_ntlm_in_both, "NTLM in both", False}, - {test_ntlmv2, "NTLMv2", False}, - {test_ntlmv2_no_dom, "NTLMv2 (no domain)", False}, - {test_lmv2, "LMv2", False}, - {test_lmv2_no_dom, "LMv2 (no domain)", False}, - {test_ntlmv2_lmv2_broken, "NTLMv2 and LMv2, LMv2 broken", False}, - {test_ntlmv2_lmv2_broken_no_dom, "NTLMv2 and LMv2, LMv2 broken (no domain)", False}, - {test_ntlmv2_ntlmv2_broken, "NTLMv2 and LMv2, NTLMv2 broken", False}, + {test_lm, "LM", false}, + {test_lm_ntlm, "LM and NTLM", false}, + {test_lm_ntlm_both_broken, "LM and NTLM, both broken", false}, + {test_ntlm, "NTLM", false}, + {test_ntlm_in_lm, "NTLM in LM", false}, + {test_ntlm_in_both, "NTLM in both", false}, + {test_ntlmv2, "NTLMv2", false}, + {test_ntlmv2_no_dom, "NTLMv2 (no domain)", false}, + {test_lmv2, "LMv2", false}, + {test_lmv2_no_dom, "LMv2 (no domain)", false}, + {test_ntlmv2_lmv2_broken, "NTLMv2 and LMv2, LMv2 broken", false}, + {test_ntlmv2_lmv2_broken_no_dom, "NTLMv2 and LMv2, LMv2 broken (no domain)", false}, + {test_ntlmv2_ntlmv2_broken, "NTLMv2 and LMv2, NTLMv2 broken", false}, #if 0 - {test_ntlmv2_ntlmv2_broken_no_dom, "NTLMv2 and LMv2, NTLMv2 broken (no domain)", False}, + {test_ntlmv2_ntlmv2_broken_no_dom, "NTLMv2 and LMv2, NTLMv2 broken (no domain)", false}, #endif - {test_ntlmv2_both_broken, "NTLMv2 and LMv2, both broken", False}, - {test_ntlmv2_both_broken_no_dom, "NTLMv2 and LMv2, both broken (no domain)", False}, - {test_ntlm_lm_broken, "NTLM and LM, LM broken", False}, - {test_ntlm_ntlm_broken, "NTLM and LM, NTLM broken", False}, - {test_ntlm2, "NTLM2 (NTLMv2 session security)", False}, - {test_lmv2_ntlm_both_broken, "LMv2 and NTLM, both broken", False}, - {test_lmv2_ntlm_both_broken_no_dom, "LMv2 and NTLM, both broken (no domain)", False}, - {test_lmv2_ntlm_break_ntlm, "LMv2 and NTLM, NTLM broken", False}, - {test_lmv2_ntlm_break_ntlm_no_dom, "LMv2 and NTLM, NTLM broken (no domain)", False}, - {test_lmv2_ntlm_break_lm, "LMv2 and NTLM, LMv2 broken", False}, - {test_lmv2_ntlm_break_lm_no_dom, "LMv2 and NTLM, LMv2 broken (no domain)", False}, - {test_plaintext_none_broken, "Plaintext", False}, - {test_plaintext_lm_broken, "Plaintext LM broken", False}, - {test_plaintext_nt_broken, "Plaintext NT broken", False}, - {test_plaintext_nt_only, "Plaintext NT only", False}, - {test_plaintext_lm_only, "Plaintext LM only", False}, + {test_ntlmv2_both_broken, "NTLMv2 and LMv2, both broken", false}, + {test_ntlmv2_both_broken_no_dom, "NTLMv2 and LMv2, both broken (no domain)", false}, + {test_ntlm_lm_broken, "NTLM and LM, LM broken", false}, + {test_ntlm_ntlm_broken, "NTLM and LM, NTLM broken", false}, + {test_ntlm2, "NTLM2 (NTLMv2 session security)", false}, + {test_lmv2_ntlm_both_broken, "LMv2 and NTLM, both broken", false}, + {test_lmv2_ntlm_both_broken_no_dom, "LMv2 and NTLM, both broken (no domain)", false}, + {test_lmv2_ntlm_break_ntlm, "LMv2 and NTLM, NTLM broken", false}, + {test_lmv2_ntlm_break_ntlm_no_dom, "LMv2 and NTLM, NTLM broken (no domain)", false}, + {test_lmv2_ntlm_break_lm, "LMv2 and NTLM, LMv2 broken", false}, + {test_lmv2_ntlm_break_lm_no_dom, "LMv2 and NTLM, LMv2 broken (no domain)", false}, + {test_plaintext_none_broken, "Plaintext", false}, + {test_plaintext_lm_broken, "Plaintext LM broken", false}, + {test_plaintext_nt_broken, "Plaintext NT broken", false}, + {test_plaintext_nt_only, "Plaintext NT only", false}, + {test_plaintext_lm_only, "Plaintext LM only", false}, {NULL, NULL} }; /* try a netlogon SamLogon */ -static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct creds_CredentialState *creds, const char *comment, const char *account_domain, const char *account_name, const char *plain_pass, uint32_t parameter_control, - NTSTATUS expected_error, BOOL old_password, + NTSTATUS expected_error, bool old_password, int n_subtests) { TALLOC_CTX *fn_ctx = talloc_named(mem_ctx, 0, "test_SamLogon function-level context"); int i, v, l, f; - BOOL ret = True; + bool ret = true; int validation_levels[] = {2,3,6}; int logon_levels[] = { 2, 6 }; int function_levels[] = { @@ -1384,7 +1384,7 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, d_printf(" failed (expected, test incomplete): %s\n", error_string); } else { d_printf(" failed: %s\n", error_string); - ret = False; + ret = false; } SAFE_FREE(error_string); } @@ -1400,7 +1400,7 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* test an ADS style interactive domain logon */ -BOOL test_InteractiveLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_InteractiveLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct creds_CredentialState *creds, const char *comment, const char *workstation_name, @@ -1456,7 +1456,7 @@ BOOL test_InteractiveLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, || !creds_client_check(creds, &r.out.return_authenticator->cred)) { d_printf("Credential chaining failed\n"); talloc_free(fn_ctx); - return False; + return false; } talloc_free(fn_ctx); @@ -1464,22 +1464,22 @@ BOOL test_InteractiveLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(expected_error, status)) { d_printf("[%s]\\[%s] netr_LogonSamLogonWithFlags - expected %s got %s\n", account_domain, account_name, nt_errstr(expected_error), nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL torture_rpc_samlogon(struct torture_context *torture) +bool torture_rpc_samlogon(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; struct dcerpc_binding *b; struct cli_credentials *machine_credentials; TALLOC_CTX *mem_ctx = talloc_init("torture_rpc_netlogon"); - BOOL ret = True; + bool ret = true; struct test_join *join_ctx = NULL; struct test_join *user_ctx = NULL, *user_ctx_wrong_wks = NULL, *user_ctx_wrong_time = NULL; char *user_password, *user_password_wrong_wks, *user_password_wrong_time; @@ -1509,7 +1509,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) &machine_credentials); if (!join_ctx) { d_printf("Failed to join as Workstation\n"); - return False; + return false; } userdomain = torture_setting_string(torture, "userdomain", lp_workgroup(global_loadparm)); @@ -1521,14 +1521,14 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) (const char **)&user_password); if (!user_ctx) { d_printf("Failed to create a test user\n"); - return False; + return false; } old_user_password = user_password; test_ChangePasswordUser3(torture_join_samr_pipe(user_ctx), mem_ctx, TEST_USER_NAME, 16 /* > 14 */, &user_password, - NULL, 0, False); + NULL, 0, false); user_ctx_wrong_wks = torture_create_testuser(torture, TEST_USER_NAME_WRONG_WKS, @@ -1537,7 +1537,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) (const char **)&user_password_wrong_wks); if (!user_ctx_wrong_wks) { d_printf("Failed to create a test user (wrong workstation test)\n"); - return False; + return false; } ZERO_STRUCT(u); @@ -1551,7 +1551,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) status = dcerpc_samr_SetUserInfo(torture_join_samr_pipe(user_ctx_wrong_wks), mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo (list of workstations) failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } @@ -1562,7 +1562,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) (const char **)&user_password_wrong_time); if (!user_ctx_wrong_time) { d_printf("Failed to create a test user (wrong workstation test)\n"); - return False; + return false; } ZERO_STRUCT(u); @@ -1578,13 +1578,13 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) status = dcerpc_samr_SetUserInfo(torture_join_samr_pipe(user_ctx_wrong_time), mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo (logon times and list of workstations) failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } status = torture_rpc_binding(torture, &b); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1600,13 +1600,13 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("RPC pipe connect as domain member failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } status = dcerpc_schannel_creds(p->conn->security_state.generic_state, mem_ctx, &creds); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1617,18 +1617,18 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) const char *domain; const char *username; const char *password; - BOOL network_login; + bool network_login; NTSTATUS expected_interactive_error; NTSTATUS expected_network_error; uint32_t parameter_control; - BOOL old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */ + bool old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */ } usercreds[] = { { .comment = "domain\\user", .domain = cli_credentials_get_domain(cmdline_credentials), .username = cli_credentials_get_username(cmdline_credentials), .password = cli_credentials_get_password(cmdline_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1637,7 +1637,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = cli_credentials_get_realm(cmdline_credentials), .username = cli_credentials_get_username(cmdline_credentials), .password = cli_credentials_get_password(cmdline_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1650,7 +1650,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) cli_credentials_get_domain(cmdline_credentials) ), .password = cli_credentials_get_password(cmdline_credentials), - .network_login = False, /* works for some things, but not NTLMv2. Odd */ + .network_login = false, /* works for some things, but not NTLMv2. Odd */ .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1663,7 +1663,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) cli_credentials_get_realm(cmdline_credentials) ), .password = cli_credentials_get_password(cmdline_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1672,7 +1672,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = cli_credentials_get_domain(machine_credentials), .username = cli_credentials_get_username(machine_credentials), .password = cli_credentials_get_password(machine_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .parameter_control = MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT }, @@ -1681,7 +1681,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = cli_credentials_get_domain(machine_credentials), .username = cli_credentials_get_username(machine_credentials), .password = cli_credentials_get_password(machine_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .expected_network_error = NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT }, @@ -1690,7 +1690,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = cli_credentials_get_realm(machine_credentials), .username = cli_credentials_get_username(machine_credentials), .password = cli_credentials_get_password(machine_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .parameter_control = MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT }, @@ -1703,7 +1703,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) cli_credentials_get_domain(machine_credentials) ), .password = cli_credentials_get_password(machine_credentials), - .network_login = False, /* works for some things, but not NTLMv2. Odd */ + .network_login = false, /* works for some things, but not NTLMv2. Odd */ .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .parameter_control = MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT }, @@ -1716,7 +1716,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) cli_credentials_get_realm(machine_credentials) ), .password = cli_credentials_get_password(machine_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .parameter_control = MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT }, @@ -1725,7 +1725,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = userdomain, .username = TEST_USER_NAME, .password = user_password, - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1737,7 +1737,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) TEST_USER_NAME, lp_realm(global_loadparm)), .password = user_password, - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1749,7 +1749,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) TEST_USER_NAME, userdomain), .password = user_password, - .network_login = False, /* works for some things, but not NTLMv2. Odd */ + .network_login = false, /* works for some things, but not NTLMv2. Odd */ .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1759,17 +1759,17 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = userdomain, .username = TEST_USER_NAME, .password = old_user_password, - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_WRONG_PASSWORD, .expected_network_error = NT_STATUS_OK, - .old_password = True + .old_password = true }, { .comment = "test user (wong workstation): domain\\user", .domain = userdomain, .username = TEST_USER_NAME_WRONG_WKS, .password = user_password_wrong_wks, - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_INVALID_WORKSTATION, .expected_network_error = NT_STATUS_INVALID_WORKSTATION } @@ -1786,7 +1786,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) usercreds[ci].password, usercreds[ci].parameter_control, usercreds[ci].expected_interactive_error)) { - ret = False; + ret = false; } if (usercreds[ci].network_login) { @@ -1799,7 +1799,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) usercreds[ci].expected_network_error, usercreds[ci].old_password, 0)) { - ret = False; + ret = false; } } } @@ -1819,7 +1819,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) usercreds[0].password, usercreds[0].parameter_control, usercreds[0].expected_interactive_error)) { - ret = False; + ret = false; } if (usercreds[0].network_login) { @@ -1832,7 +1832,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) usercreds[0].expected_network_error, usercreds[0].old_password, 1)) { - ret = False; + ret = false; } } } diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index af1ff44a43..ec70c91570 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -42,16 +42,16 @@ enum torture_samr_choice { TORTURE_SAMR_OTHER }; -static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -static BOOL test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, struct policy_handle *domain_handle, char **password); @@ -60,7 +60,7 @@ static void init_lsa_String(struct lsa_String *string, const char *s) string->string = s; } -BOOL test_samr_handle_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_samr_handle_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -72,13 +72,13 @@ BOOL test_samr_handle_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Close(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close handle failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -86,7 +86,7 @@ static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { printf("samr_Shutdown disabled - enable dangerous tests to use\n"); - return True; + return true; } r.in.connect_handle = handle; @@ -96,13 +96,13 @@ static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Shutdown(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("samr_Shutdown failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -112,7 +112,7 @@ static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { printf("samr_SetDsrmPassword disabled - enable dangerous tests to use\n"); - return True; + return true; } E_md4hash("TeSTDSRM123", hash.hash); @@ -128,14 +128,14 @@ static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_SetDsrmPassword(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) { printf("samr_SetDsrmPassword failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -148,11 +148,11 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_QuerySecurity(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - return False; + return false; } if (r.out.sdbuf == NULL) { - return False; + return false; } s.in.handle = handle; @@ -161,26 +161,26 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping SetSecurity test against Samba4\n"); - return True; + return true; } status = dcerpc_samr_SetSecurity(p, mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { printf("SetSecurity failed - %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_QuerySecurity(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t base_acct_flags, const char *base_account_name) { @@ -190,7 +190,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_QueryUserInfo q; struct samr_QueryUserInfo q0; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; const char *test_account_name; uint32_t user_extra_flags = 0; @@ -214,7 +214,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { \ printf(#call " level %u failed - %s (%s)\n", \ r.in.level, nt_errstr(status), __location__); \ - ret = False; \ + ret = false; \ break; \ } @@ -222,7 +222,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if ((s1 && !s2) || (s2 && !s1) || strcmp(s1, s2)) { \ printf("Failed to set %s to '%s' (%s)\n", \ #field, s2, __location__); \ - ret = False; \ + ret = false; \ break; \ } @@ -230,7 +230,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (i1 != i2) { \ printf("Failed to set %s to 0x%llx - got 0x%llx (%s)\n", \ #field, (unsigned long long)i2, (unsigned long long)i1, __location__); \ - ret = False; \ + ret = false; \ break; \ } @@ -511,13 +511,13 @@ static char *samr_rand_pass_fixed_len(TALLOC_CTX *mem_ctx, int len) return s; } -static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, char **password) { NTSTATUS status; struct samr_SetUserInfo s; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; char *newpass; struct samr_GetUserPwInfo pwp; @@ -542,7 +542,7 @@ static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } arcfour_crypt_blob(u.info24.password.data, 516, &session_key); @@ -553,7 +553,7 @@ static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -562,14 +562,14 @@ static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t fields_present, char **password) { NTSTATUS status; struct samr_SetUserInfo s; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; char *newpass; struct samr_GetUserPwInfo pwp; @@ -596,7 +596,7 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } arcfour_crypt_blob(u.info23.password.data, 516, &session_key); @@ -607,7 +607,7 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -618,7 +618,7 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } /* This should break the key nicely */ @@ -631,21 +631,21 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("SetUserInfo level %u should have failed with WRONG_PASSWORD- %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, bool makeshort, char **password) { NTSTATUS status; struct samr_SetUserInfo s; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16); uint8_t confounder[16]; @@ -676,7 +676,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } generate_random_buffer((uint8_t *)confounder, 16); @@ -695,7 +695,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -712,7 +712,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("SetUserInfo level %u should have failed with WRONG_PASSWORD: %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -720,14 +720,14 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t fields_present, char **password) { NTSTATUS status; struct samr_SetUserInfo s; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16); struct MD5Context ctx; @@ -757,7 +757,7 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } generate_random_buffer((uint8_t *)confounder, 16); @@ -776,7 +776,7 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -793,13 +793,13 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("SetUserInfo level %u should have failed with WRONG_PASSWORD- %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -807,7 +807,7 @@ static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_QueryAliasInfo q; uint16_t levels[] = {2, 3}; int i; - BOOL ret = True; + bool ret = true; /* Ignoring switch level 1, as that includes the number of members for the alias * and setting this to a wrong value might have negative consequences @@ -829,7 +829,7 @@ static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetAliasInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } q.in.alias_handle = handle; @@ -839,19 +839,19 @@ static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryAliasInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_GetGroupsForUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetGroupsForUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *user_handle) { struct samr_GetGroupsForUser r; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("testing GetGroupsForUser\n"); @@ -860,19 +860,19 @@ static BOOL test_GetGroupsForUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetGroupsForUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetGroupsForUser failed - %s\n",nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct lsa_String *domain_name) { NTSTATUS status; struct samr_GetDomPwInfo r; - BOOL ret = True; + bool ret = true; r.in.domain_name = domain_name; printf("Testing GetDomPwInfo with name %s\n", r.in.domain_name->string); @@ -880,7 +880,7 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetDomPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } r.in.domain_name->string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); @@ -889,7 +889,7 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetDomPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } r.in.domain_name->string = "\\\\__NONAME__"; @@ -898,7 +898,7 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetDomPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } r.in.domain_name->string = "\\\\Builtin"; @@ -907,19 +907,19 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetDomPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_GetUserPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetUserPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_GetUserPwInfo r; - BOOL ret = True; + bool ret = true; printf("Testing GetUserPwInfo\n"); @@ -928,7 +928,7 @@ static BOOL test_GetUserPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetUserPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetUserPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; @@ -1024,12 +1024,12 @@ static NTSTATUS test_OpenUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } #if 0 -static BOOL test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_ChangePasswordUser r; - BOOL ret = True; + bool ret = true; struct samr_Password hash1, hash2, hash3, hash4, hash5, hash6; struct policy_handle user_handle; char *oldpass = "test"; @@ -1039,7 +1039,7 @@ static BOOL test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = test_OpenUser_byname(p, mem_ctx, handle, "testuser", &user_handle); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } printf("Testing ChangePasswordUser for user 'testuser'\n"); @@ -1074,30 +1074,30 @@ static BOOL test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("ChangePasswordUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } return ret; } #endif -static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, struct policy_handle *handle, char **password) { NTSTATUS status; struct samr_ChangePasswordUser r; - BOOL ret = True; + bool ret = true; struct samr_Password hash1, hash2, hash3, hash4, hash5, hash6; struct policy_handle user_handle; char *oldpass; uint8_t old_nt_hash[16], new_nt_hash[16]; uint8_t old_lm_hash[16], new_lm_hash[16]; - BOOL changed = True; + bool changed = true; char *newpass; struct samr_GetUserPwInfo pwp; @@ -1105,7 +1105,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = test_OpenUser_byname(p, mem_ctx, handle, acct_name, &user_handle); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } pwp.in.user_handle = &user_handle; @@ -1119,7 +1119,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!*password) { printf("Failing ChangePasswordUser as old password was NULL. Previous test failed?\n"); - return False; + return false; } oldpass = *password; @@ -1153,7 +1153,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we broke the LM hash, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* Unbreak the LM hash */ @@ -1176,7 +1176,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we broke the NT hash, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* Unbreak the NT hash */ @@ -1199,7 +1199,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we broke the LM cross-hash, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* Unbreak the LM cross */ @@ -1222,7 +1222,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we broke the NT cross-hash, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* Unbreak the NT cross */ @@ -1251,11 +1251,11 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (NT_STATUS_IS_OK(status)) { - changed = True; + changed = true; *password = newpass; } else if (!NT_STATUS_EQUAL(NT_STATUS_PASSWORD_RESTRICTION, status)) { printf("ChangePasswordUser failed: expected NT_STATUS_OK, or at least NT_STATUS_PASSWORD_RESTRICTION, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } oldpass = newpass; @@ -1289,11 +1289,11 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (NT_STATUS_IS_OK(status)) { - changed = True; + changed = true; *password = newpass; } else if (!NT_STATUS_EQUAL(NT_STATUS_PASSWORD_RESTRICTION, status)) { printf("ChangePasswordUser failed: expected NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } oldpass = newpass; @@ -1330,9 +1330,9 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("ChangePasswordUser returned: %s perhaps min password age? (not fatal)\n", nt_errstr(status)); } else if (!NT_STATUS_IS_OK(status)) { printf("ChangePasswordUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { - changed = True; + changed = true; *password = newpass; } @@ -1354,26 +1354,26 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("ChangePasswordUser returned: %s perhaps min password age? (not fatal)\n", nt_errstr(status)); } else if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we already changed the password, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } } if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } return ret; } -static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, struct policy_handle *handle, char **password) { NTSTATUS status; struct samr_OemChangePasswordUser2 r; - BOOL ret = True; + bool ret = true; struct samr_Password lm_verifier; struct samr_CryptPassword lm_pass; struct lsa_AsciiString server, account, account_bad; @@ -1393,7 +1393,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c if (!*password) { printf("Failing OemChangePasswordUser2 as old password was NULL. Previous test failed?\n"); - return False; + return false; } oldpass = *password; @@ -1429,7 +1429,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c && !NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD (or at least 'PASSWORD_RESTRICTON') for invalid password verifier - %s\n", nt_errstr(status)); - ret = False; + ret = false; } encode_pw_buffer(lm_pass.data, newpass, STR_ASCII); @@ -1451,7 +1451,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c && !NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD (or at least 'PASSWORD_RESTRICTON') for invalidly encrpted password - %s\n", nt_errstr(status)); - ret = False; + ret = false; } encode_pw_buffer(lm_pass.data, newpass, STR_ASCII); @@ -1468,7 +1468,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c && !NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("ChangePasswordUser3 failed, should have returned INVALID_PARAMETER (or at least 'PASSWORD_RESTRICTON') for no supplied validation hash - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* This shouldn't be a valid name */ @@ -1480,7 +1480,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("ChangePasswordUser3 failed, should have returned INVALID_PARAMETER for no supplied validation hash and invalid user - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* This shouldn't be a valid name */ @@ -1494,7 +1494,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD for invalid user - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* This shouldn't be a valid name */ @@ -1508,7 +1508,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("ChangePasswordUser3 failed, should have returned INVALID_PARAMETER for no supplied password and invalid user - %s\n", nt_errstr(status)); - ret = False; + ret = false; } E_deshash(oldpass, old_lm_hash); @@ -1528,7 +1528,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c printf("OemChangePasswordUser2 returned: %s perhaps min password age? (not fatal)\n", nt_errstr(status)); } else if (!NT_STATUS_IS_OK(status)) { printf("OemChangePasswordUser2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -1537,14 +1537,14 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c } -static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, char **password, char *newpass, bool allow_password_restriction) { NTSTATUS status; struct samr_ChangePasswordUser2 r; - BOOL ret = True; + bool ret = true; struct lsa_String server, account; struct samr_CryptPassword nt_pass, lm_pass; struct samr_Password nt_verifier, lm_verifier; @@ -1563,7 +1563,7 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!*password) { printf("Failing ChangePasswordUser3 as old password was NULL. Previous test failed?\n"); - return False; + return false; } oldpass = *password; @@ -1607,7 +1607,7 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("ChangePasswordUser2 returned: %s perhaps min password age? (not fatal)\n", nt_errstr(status)); } else if (!NT_STATUS_IS_OK(status)) { printf("ChangePasswordUser2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -1616,17 +1616,17 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *account_string, int policy_min_pw_len, char **password, const char *newpass, NTTIME last_password_change, - BOOL handle_reject_reason) + bool handle_reject_reason) { NTSTATUS status; struct samr_ChangePasswordUser3 r; - BOOL ret = True; + bool ret = true; struct lsa_String server, account, account_bad; struct samr_CryptPassword nt_pass, lm_pass; struct samr_Password nt_verifier, lm_verifier; @@ -1644,14 +1644,14 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } else { newpass = samr_rand_pass_fixed_len(mem_ctx, policy_min_pw_len); } - } while (check_password_quality(newpass) == False); + } while (check_password_quality(newpass) == false); } else { printf("Using password '%s'\n", newpass); } if (!*password) { printf("Failing ChangePasswordUser3 as old password was NULL. Previous test failed?\n"); - return False; + return false; } oldpass = *password; @@ -1689,7 +1689,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD))) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD (or at least 'PASSWORD_RESTRICTON') for invalid password verifier - %s\n", nt_errstr(status)); - ret = False; + ret = false; } encode_pw_buffer(lm_pass.data, newpass, STR_UNICODE); @@ -1718,7 +1718,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD))) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD (or at least 'PASSWORD_RESTRICTON') for invalidly encrpted password - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* This shouldn't be a valid name */ @@ -1729,7 +1729,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD for invalid username - %s\n", nt_errstr(status)); - ret = False; + ret = false; } E_md4hash(oldpass, old_nt_hash); @@ -1769,7 +1769,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject && (r.out.reject->reason != SAMR_REJECT_OTHER)) { printf("expected SAMR_REJECT_OTHER (%d), got %d\n", SAMR_REJECT_OTHER, r.out.reject->reason); - return False; + return false; } } @@ -1788,7 +1788,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject->reason != SAMR_REJECT_OTHER) { printf("expected SAMR_REJECT_OTHER (%d), got %d\n", SAMR_REJECT_OTHER, r.out.reject->reason); - return False; + return false; } } else if ((r.out.dominfo->min_password_length > 0) && @@ -1797,7 +1797,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject->reason != SAMR_REJECT_TOO_SHORT) { printf("expected SAMR_REJECT_TOO_SHORT (%d), got %d\n", SAMR_REJECT_TOO_SHORT, r.out.reject->reason); - return False; + return false; } } else if ((r.out.dominfo->password_history_length > 0) && @@ -1806,14 +1806,14 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject->reason != SAMR_REJECT_IN_HISTORY) { printf("expected SAMR_REJECT_IN_HISTORY (%d), got %d\n", SAMR_REJECT_IN_HISTORY, r.out.reject->reason); - return False; + return false; } } else if (r.out.dominfo->password_properties & DOMAIN_PASSWORD_COMPLEX) { if (r.out.reject->reason != SAMR_REJECT_COMPLEXITY) { printf("expected SAMR_REJECT_COMPLEXITY (%d), got %d\n", SAMR_REJECT_COMPLEXITY, r.out.reject->reason); - return False; + return false; } } @@ -1822,7 +1822,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* retry with adjusted size */ return test_ChangePasswordUser3(p, mem_ctx, account_string, r.out.dominfo->min_password_length, - password, NULL, 0, False); + password, NULL, 0, false); } @@ -1830,13 +1830,13 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject && r.out.reject->reason != SAMR_REJECT_OTHER) { printf("expected SAMR_REJECT_OTHER (%d), got %d\n", SAMR_REJECT_OTHER, r.out.reject->reason); - return False; + return false; } /* Perhaps the server has a 'min password age' set? */ } else if (!NT_STATUS_IS_OK(status)) { printf("ChangePasswordUser3 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { *password = talloc_strdup(mem_ctx, newpass); } @@ -1845,13 +1845,13 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_GetMembersInAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetMembersInAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle) { struct samr_GetMembersInAlias r; struct lsa_SidArray sids; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing GetMembersInAlias\n"); @@ -1862,20 +1862,20 @@ static BOOL test_GetMembersInAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("GetMembersInAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_AddMemberToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_AddMemberToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle, const struct dom_sid *domain_sid) { struct samr_AddAliasMember r; struct samr_DeleteAliasMember d; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct dom_sid *sid; sid = dom_sid_add_rid(mem_ctx, domain_sid, 512); @@ -1887,7 +1887,7 @@ static BOOL test_AddMemberToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_AddAliasMember(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("AddAliasMember failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } d.in.alias_handle = alias_handle; @@ -1896,19 +1896,19 @@ static BOOL test_AddMemberToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteAliasMember(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DelAliasMember failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle) { struct samr_AddMultipleMembersToAlias a; struct samr_RemoveMultipleMembersFromAlias r; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct lsa_SidArray sids; printf("testing AddMultipleMembersToAlias\n"); @@ -1925,7 +1925,7 @@ static BOOL test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *me status = dcerpc_samr_AddMultipleMembersToAlias(p, mem_ctx, &a); if (!NT_STATUS_IS_OK(status)) { printf("AddMultipleMembersToAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } @@ -1936,14 +1936,14 @@ static BOOL test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *me status = dcerpc_samr_RemoveMultipleMembersFromAlias(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RemoveMultipleMembersFromAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* strange! removing twice doesn't give any error */ status = dcerpc_samr_RemoveMultipleMembersFromAlias(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RemoveMultipleMembersFromAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* but removing an alias that isn't there does */ @@ -1952,18 +1952,18 @@ static BOOL test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *me status = dcerpc_samr_RemoveMultipleMembersFromAlias(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) { printf("RemoveMultipleMembersFromAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_TestPrivateFunctionsUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_TestPrivateFunctionsUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *user_handle) { struct samr_TestPrivateFunctionsUser r; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing TestPrivateFunctionsUser\n"); @@ -1972,14 +1972,14 @@ static BOOL test_TestPrivateFunctionsUser(struct dcerpc_pipe *p, TALLOC_CTX *mem status = dcerpc_samr_TestPrivateFunctionsUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_NOT_IMPLEMENTED, status)) { printf("TestPrivateFunctionsUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *user_handle, struct policy_handle *domain_handle, uint32_t base_acct_flags, @@ -1988,7 +1988,7 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, TALLOC_CTX *user_ctx; char *password = NULL; - BOOL ret = True; + bool ret = true; int i; const uint32_t password_fields[] = { SAMR_FIELD_PASSWORD, @@ -2001,32 +2001,32 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, switch (which_ops) { case TORTURE_SAMR_USER_ATTRIBUTES: if (!test_QuerySecurity(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_QueryUserInfo(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_QueryUserInfo2(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_SetUserInfo(p, user_ctx, user_handle, base_acct_flags, base_acct_name)) { - ret = False; + ret = false; } if (!test_GetUserPwInfo(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_TestPrivateFunctionsUser(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_SetUserPass(p, user_ctx, user_handle, &password)) { - ret = False; + ret = false; } break; case TORTURE_SAMR_PASSWORDS: @@ -2041,53 +2041,53 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* Workstation trust accounts don't seem to need to honour password quality policy */ if (!test_SetUserPassEx(p, user_ctx, user_handle, true, &password)) { - ret = False; + ret = false; } - if (!test_ChangePasswordUser2(p, user_ctx, base_acct_name, &password, simple_pass, False)) { - ret = False; + if (!test_ChangePasswordUser2(p, user_ctx, base_acct_name, &password, simple_pass, false)) { + ret = false; } /* reset again, to allow another 'user' password change */ if (!test_SetUserPassEx(p, user_ctx, user_handle, true, &password)) { - ret = False; + ret = false; } /* Try a 'short' password */ - if (!test_ChangePasswordUser2(p, user_ctx, base_acct_name, &password, samr_rand_pass(mem_ctx, 4), False)) { - ret = False; + if (!test_ChangePasswordUser2(p, user_ctx, base_acct_name, &password, samr_rand_pass(mem_ctx, 4), false)) { + ret = false; } } for (i = 0; password_fields[i]; i++) { if (!test_SetUserPass_23(p, user_ctx, user_handle, password_fields[i], &password)) { - ret = False; + ret = false; } /* check it was set right */ - if (!test_ChangePasswordUser3(p, user_ctx, base_acct_name, 0, &password, NULL, 0, False)) { - ret = False; + if (!test_ChangePasswordUser3(p, user_ctx, base_acct_name, 0, &password, NULL, 0, false)) { + ret = false; } } for (i = 0; password_fields[i]; i++) { if (!test_SetUserPass_25(p, user_ctx, user_handle, password_fields[i], &password)) { - ret = False; + ret = false; } /* check it was set right */ - if (!test_ChangePasswordUser3(p, user_ctx, base_acct_name, 0, &password, NULL, 0, False)) { - ret = False; + if (!test_ChangePasswordUser3(p, user_ctx, base_acct_name, 0, &password, NULL, 0, false)) { + ret = false; } } if (!test_SetUserPassEx(p, user_ctx, user_handle, false, &password)) { - ret = False; + ret = false; } if (!test_ChangePassword(p, user_ctx, base_acct_name, domain_handle, &password)) { - ret = False; + ret = false; } break; @@ -2099,26 +2099,26 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle, const struct dom_sid *domain_sid) { - BOOL ret = True; + bool ret = true; if (!test_QuerySecurity(p, mem_ctx, alias_handle)) { - ret = False; + ret = false; } if (!test_QueryAliasInfo(p, mem_ctx, alias_handle)) { - ret = False; + ret = false; } if (!test_SetAliasInfo(p, mem_ctx, alias_handle)) { - ret = False; + ret = false; } if (!test_AddMemberToAlias(p, mem_ctx, alias_handle, domain_sid)) { - ret = False; + ret = false; } if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { @@ -2127,19 +2127,19 @@ static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } if (!test_AddMultipleMembersToAlias(p, mem_ctx, alias_handle)) { - ret = False; + ret = false; } return ret; } -static BOOL test_DeleteUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DeleteUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *user_handle) { struct samr_DeleteUser d; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing DeleteUser\n"); d.in.user_handle = user_handle; @@ -2148,13 +2148,13 @@ static BOOL test_DeleteUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteUser(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -BOOL test_DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name) { NTSTATUS status; @@ -2179,15 +2179,15 @@ BOOL test_DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, goto failed; } - return True; + return true; failed: printf("DeleteUser_byname(%s) failed - %s\n", name, nt_errstr(status)); - return False; + return false; } -static BOOL test_DeleteGroup_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DeleteGroup_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name) { NTSTATUS status; @@ -2217,15 +2217,15 @@ static BOOL test_DeleteGroup_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, goto failed; } - return True; + return true; failed: printf("DeleteGroup_byname(%s) failed - %s\n", name, nt_errstr(status)); - return False; + return false; } -static BOOL test_DeleteAlias_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DeleteAlias_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name) { NTSTATUS status; @@ -2257,19 +2257,19 @@ static BOOL test_DeleteAlias_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, goto failed; } - return True; + return true; failed: printf("DeleteAlias_byname(%s) failed - %s\n", name, nt_errstr(status)); - return False; + return false; } -static BOOL test_DeleteAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DeleteAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle) { struct samr_DeleteDomAlias d; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing DeleteAlias\n"); d.in.alias_handle = alias_handle; @@ -2278,13 +2278,13 @@ static BOOL test_DeleteAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteDomAlias(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct policy_handle *alias_handle, const struct dom_sid *domain_sid) @@ -2293,7 +2293,7 @@ static BOOL test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_CreateDomAlias r; struct lsa_String name; uint32_t rid; - BOOL ret = True; + bool ret = true; init_lsa_String(&name, TEST_ALIASNAME); r.in.domain_handle = domain_handle; @@ -2308,53 +2308,53 @@ static BOOL test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { printf("Server refused create of '%s'\n", r.in.alias_name->string); - return True; + return true; } if (NT_STATUS_EQUAL(status, NT_STATUS_ALIAS_EXISTS)) { if (!test_DeleteAlias_byname(p, mem_ctx, domain_handle, r.in.alias_name->string)) { - return False; + return false; } status = dcerpc_samr_CreateDomAlias(p, mem_ctx, &r); } if (!NT_STATUS_IS_OK(status)) { printf("CreateAlias failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_alias_ops(p, mem_ctx, alias_handle, domain_sid)) { - ret = False; + ret = false; } return ret; } -static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, struct policy_handle *domain_handle, char **password) { - BOOL ret = True; + bool ret = true; if (!*password) { - return False; + return false; } if (!test_ChangePasswordUser(p, mem_ctx, acct_name, domain_handle, password)) { - ret = False; + ret = false; } - if (!test_ChangePasswordUser2(p, mem_ctx, acct_name, password, 0, True)) { - ret = False; + if (!test_ChangePasswordUser2(p, mem_ctx, acct_name, password, 0, true)) { + ret = false; } if (!test_OemChangePasswordUser2(p, mem_ctx, acct_name, domain_handle, password)) { - ret = False; + ret = false; } /* test what happens when setting the old password again */ - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, *password, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, *password, 0, true)) { + ret = false; } { @@ -2365,8 +2365,8 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, memset(simple_pass, *v, sizeof(simple_pass) - 1); /* test what happens when picking a simple password */ - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, simple_pass, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, simple_pass, 0, true)) { + ret = false; } } @@ -2387,7 +2387,7 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("testing samr_QueryDomainInfo level 1\n"); status = dcerpc_samr_QueryDomainInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } s.in.domain_handle = domain_handle; @@ -2407,13 +2407,13 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("testing samr_SetDomainInfo level 1\n"); status = dcerpc_samr_SetDomainInfo(p, mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } printf("calling test_ChangePasswordUser3 with too short password\n"); - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, len - 1, password, NULL, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, len - 1, password, NULL, 0, true)) { + ret = false; } s.in.info->info1.min_password_length = len_old; @@ -2423,7 +2423,7 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("testing samr_SetDomainInfo level 1\n"); status = dcerpc_samr_SetDomainInfo(p, mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } } @@ -2443,7 +2443,7 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupNames(p, mem_ctx, &n); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } r.in.domain_handle = domain_handle; @@ -2454,7 +2454,7 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenUser(%u) failed - %s\n", n.out.rids.ids[0], nt_errstr(status)); - return False; + return false; } q.in.user_handle = &user_handle; @@ -2463,31 +2463,31 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_QueryUserInfo(p, mem_ctx, &q); if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("calling test_ChangePasswordUser3 with too early password change\n"); if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, - q.out.info->info5.last_password_change, True)) { - ret = False; + q.out.info->info5.last_password_change, true)) { + ret = false; } } /* we change passwords twice - this has the effect of verifying they were changed correctly for the final call */ - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, 0, true)) { + ret = false; } - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, 0, true)) { + ret = false; } return ret; } -static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct policy_handle *user_handle_out, enum torture_samr_choice which_ops) @@ -2504,7 +2504,7 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* This call creates a 'normal' account - check that it really does */ const uint32_t acct_flags = ACB_NORMAL; struct lsa_String name; - BOOL ret = True; + bool ret = true; struct policy_handle user_handle; user_ctx = talloc_named(mem_ctx, 0, "test_CreateUser2 per-user context"); @@ -2523,20 +2523,20 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { printf("Server refused create of '%s': %s\n", r.in.account_name->string, nt_errstr(status)); talloc_free(user_ctx); - return True; + return true; } if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { if (!test_DeleteUser_byname(p, user_ctx, domain_handle, r.in.account_name->string)) { talloc_free(user_ctx); - return False; + return false; } status = dcerpc_samr_CreateUser(p, user_ctx, &r); } if (!NT_STATUS_IS_OK(status)) { talloc_free(user_ctx); printf("CreateUser failed - %s\n", nt_errstr(status)); - return False; + return false; } else { q.in.user_handle = &user_handle; q.in.level = 16; @@ -2545,19 +2545,19 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo level %u failed - %s\n", q.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { if ((q.out.info->info16.acct_flags & acct_flags) != acct_flags) { printf("QuerUserInfo level 16 failed, it returned 0x%08x when we expected flags of 0x%08x\n", q.out.info->info16.acct_flags, acct_flags); - ret = False; + ret = false; } } if (!test_user_ops(p, user_ctx, &user_handle, domain_handle, acct_flags, name.string, which_ops)) { - ret = False; + ret = false; } if (user_handle_out) { @@ -2571,7 +2571,7 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteUser(p, user_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } @@ -2583,7 +2583,7 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, enum torture_samr_choice which_ops) { NTSTATUS status; @@ -2593,7 +2593,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle user_handle; uint32_t rid; struct lsa_String name; - BOOL ret = True; + bool ret = true; int i; struct { @@ -2645,7 +2645,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } else if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { if (!test_DeleteUser_byname(p, user_ctx, domain_handle, r.in.account_name->string)) { talloc_free(user_ctx); - ret = False; + ret = false; continue; } status = dcerpc_samr_CreateUser2(p, user_ctx, &r); @@ -2654,7 +2654,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, account_types[i].nt_status)) { printf("CreateUser2 failed gave incorrect error return - %s (should be %s)\n", nt_errstr(status), nt_errstr(account_types[i].nt_status)); - ret = False; + ret = false; } if (NT_STATUS_IS_OK(status)) { @@ -2665,34 +2665,34 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo level %u failed - %s\n", q.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { if ((q.out.info->info5.acct_flags & acct_flags) != acct_flags) { printf("QuerUserInfo level 5 failed, it returned 0x%08x when we expected flags of 0x%08x\n", q.out.info->info5.acct_flags, acct_flags); - ret = False; + ret = false; } switch (acct_flags) { case ACB_SVRTRUST: if (q.out.info->info5.primary_gid != DOMAIN_RID_DCS) { printf("QuerUserInfo level 5: DC should have had Primary Group %d, got %d\n", DOMAIN_RID_DCS, q.out.info->info5.primary_gid); - ret = False; + ret = false; } break; case ACB_WSTRUST: if (q.out.info->info5.primary_gid != DOMAIN_RID_DOMAIN_MEMBERS) { printf("QuerUserInfo level 5: Domain Member should have had Primary Group %d, got %d\n", DOMAIN_RID_DOMAIN_MEMBERS, q.out.info->info5.primary_gid); - ret = False; + ret = false; } break; case ACB_NORMAL: if (q.out.info->info5.primary_gid != DOMAIN_RID_USERS) { printf("QuerUserInfo level 5: Users should have had Primary Group %d, got %d\n", DOMAIN_RID_USERS, q.out.info->info5.primary_gid); - ret = False; + ret = false; } break; } @@ -2700,7 +2700,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!test_user_ops(p, user_ctx, &user_handle, domain_handle, acct_flags, name.string, which_ops)) { - ret = False; + ret = false; } printf("Testing DeleteUser (createuser2 test)\n"); @@ -2711,7 +2711,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteUser(p, user_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } talloc_free(user_ctx); @@ -2720,14 +2720,14 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryAliasInfo r; uint16_t levels[] = {1, 2, 3}; int i; - BOOL ret = True; + bool ret = true; for (i=0;i<ARRAY_SIZE(levels);i++) { printf("Testing QueryAliasInfo level %u\n", levels[i]); @@ -2739,21 +2739,21 @@ static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryAliasInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_QueryGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryGroupInfo r; uint16_t levels[] = {1, 2, 3, 4, 5}; int i; - BOOL ret = True; + bool ret = true; for (i=0;i<ARRAY_SIZE(levels);i++) { printf("Testing QueryGroupInfo level %u\n", levels[i]); @@ -2765,19 +2765,19 @@ static BOOL test_QueryGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryGroupInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_QueryGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryGroupMember r; - BOOL ret = True; + bool ret = true; printf("Testing QueryGroupMember\n"); @@ -2786,14 +2786,14 @@ static BOOL test_QueryGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_QueryGroupMember(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("QueryGroupInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_SetGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -2802,7 +2802,7 @@ static BOOL test_SetGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t levels[] = {1, 2, 3, 4}; uint16_t set_ok[] = {0, 1, 1, 1}; int i; - BOOL ret = True; + bool ret = true; for (i=0;i<ARRAY_SIZE(levels);i++) { printf("Testing QueryGroupInfo level %u\n", levels[i]); @@ -2814,7 +2814,7 @@ static BOOL test_SetGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryGroupInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } printf("Testing SetGroupInfo level %u\n", levels[i]); @@ -2842,14 +2842,14 @@ static BOOL test_SetGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetGroupInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } } else { if (!NT_STATUS_EQUAL(NT_STATUS_INVALID_INFO_CLASS, status)) { printf("SetGroupInfo level %u gave %s - should have been NT_STATUS_INVALID_INFO_CLASS\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } } @@ -2858,7 +2858,7 @@ static BOOL test_SetGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -2866,7 +2866,7 @@ static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 20, 21}; int i; - BOOL ret = True; + bool ret = true; for (i=0;i<ARRAY_SIZE(levels);i++) { printf("Testing QueryUserInfo level %u\n", levels[i]); @@ -2878,14 +2878,14 @@ static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -2893,7 +2893,7 @@ static BOOL test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 20, 21}; int i; - BOOL ret = True; + bool ret = true; for (i=0;i<ARRAY_SIZE(levels);i++) { printf("Testing QueryUserInfo2 level %u\n", levels[i]); @@ -2905,20 +2905,20 @@ static BOOL test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo2 level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t rid) { NTSTATUS status; struct samr_OpenUser r; struct policy_handle user_handle; - BOOL ret = True; + bool ret = true; printf("Testing OpenUser(%u)\n", rid); @@ -2930,43 +2930,43 @@ static BOOL test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenUser(%u) failed - %s\n", rid, nt_errstr(status)); - return False; + return false; } if (!test_QuerySecurity(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } if (!test_QueryUserInfo(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } if (!test_QueryUserInfo2(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } if (!test_GetUserPwInfo(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } if (!test_GetGroupsForUser(p,mem_ctx, &user_handle)) { - ret = False; + ret = false; } if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } return ret; } -static BOOL test_OpenGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_OpenGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t rid) { NTSTATUS status; struct samr_OpenGroup r; struct policy_handle group_handle; - BOOL ret = True; + bool ret = true; printf("Testing OpenGroup(%u)\n", rid); @@ -2978,35 +2978,35 @@ static BOOL test_OpenGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenGroup(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenGroup(%u) failed - %s\n", rid, nt_errstr(status)); - return False; + return false; } if (!test_QuerySecurity(p, mem_ctx, &group_handle)) { - ret = False; + ret = false; } if (!test_QueryGroupInfo(p, mem_ctx, &group_handle)) { - ret = False; + ret = false; } if (!test_QueryGroupMember(p, mem_ctx, &group_handle)) { - ret = False; + ret = false; } if (!test_samr_handle_Close(p, mem_ctx, &group_handle)) { - ret = False; + ret = false; } return ret; } -static BOOL test_OpenAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_OpenAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t rid) { NTSTATUS status; struct samr_OpenAlias r; struct policy_handle alias_handle; - BOOL ret = True; + bool ret = true; printf("Testing OpenAlias(%u)\n", rid); @@ -3018,29 +3018,29 @@ static BOOL test_OpenAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenAlias(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenAlias(%u) failed - %s\n", rid, nt_errstr(status)); - return False; + return false; } if (!test_QuerySecurity(p, mem_ctx, &alias_handle)) { - ret = False; + ret = false; } if (!test_QueryAliasInfo(p, mem_ctx, &alias_handle)) { - ret = False; + ret = false; } if (!test_GetMembersInAlias(p, mem_ctx, &alias_handle)) { - ret = False; + ret = false; } if (!test_samr_handle_Close(p, mem_ctx, &alias_handle)) { - ret = False; + ret = false; } return ret; } -static BOOL check_mask(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool check_mask(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t rid, uint32_t acct_flag_mask) { @@ -3048,7 +3048,7 @@ static BOOL check_mask(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_OpenUser r; struct samr_QueryUserInfo q; struct policy_handle user_handle; - BOOL ret = True; + bool ret = true; printf("Testing OpenUser(%u)\n", rid); @@ -3060,7 +3060,7 @@ static BOOL check_mask(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenUser(%u) failed - %s\n", rid, nt_errstr(status)); - return False; + return false; } q.in.user_handle = &user_handle; @@ -3070,30 +3070,30 @@ static BOOL check_mask(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo level 16 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if ((acct_flag_mask & q.out.info->info16.acct_flags) == 0) { printf("Server failed to filter for 0x%x, allowed 0x%x (%d) on EnumDomainUsers\n", acct_flag_mask, q.out.info->info16.acct_flags, rid); - ret = False; + ret = false; } } if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } return ret; } -static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status = STATUS_MORE_ENTRIES; struct samr_EnumDomainUsers r; uint32_t mask, resume_handle=0; int i, mask_idx; - BOOL ret = True; + bool ret = true; struct samr_LookupNames n; struct samr_LookupRids lr ; uint32_t masks[] = {ACB_NORMAL, ACB_DOMTRUST, ACB_WSTRUST, @@ -3114,12 +3114,12 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) && !NT_STATUS_IS_OK(status)) { printf("EnumDomainUsers failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.sam) { printf("EnumDomainUsers failed: r.out.sam unexpectedly NULL\n"); - return False; + return false; } if (r.out.sam->count == 0) { @@ -3129,10 +3129,10 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, for (i=0;i<r.out.sam->count;i++) { if (mask) { if (!check_mask(p, mem_ctx, handle, r.out.sam->entries[i].idx, mask)) { - ret = False; + ret = false; } } else if (!test_OpenUser(p, mem_ctx, handle, r.out.sam->entries[i].idx)) { - ret = False; + ret = false; } } } @@ -3147,7 +3147,7 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupNames(p, mem_ctx, &n); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } @@ -3161,7 +3161,7 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupRids(p, mem_ctx, &lr); if (!NT_STATUS_IS_OK(status)) { printf("LookupRids failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; @@ -3170,7 +3170,7 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* try blasting the server with a bunch of sync requests */ -static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -3182,7 +3182,7 @@ static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { printf("samr async test disabled - enable dangerous tests to use\n"); - return True; + return true; } printf("Testing EnumDomainUsers_async\n"); @@ -3202,23 +3202,23 @@ static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct if (!NT_STATUS_IS_OK(status)) { printf("EnumDomainUsers[%d] failed - %s\n", i, nt_errstr(status)); - return False; + return false; } } printf("%d async requests OK\n", i); - return True; + return true; } -static BOOL test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_EnumDomainGroups r; uint32_t resume_handle=0; int i; - BOOL ret = True; + bool ret = true; printf("Testing EnumDomainGroups\n"); @@ -3230,30 +3230,30 @@ static BOOL test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_EnumDomainGroups(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomainGroups failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.sam) { - return False; + return false; } for (i=0;i<r.out.sam->count;i++) { if (!test_OpenGroup(p, mem_ctx, handle, r.out.sam->entries[i].idx)) { - ret = False; + ret = false; } } return ret; } -static BOOL test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_EnumDomainAliases r; uint32_t resume_handle=0; int i; - BOOL ret = True; + bool ret = true; printf("Testing EnumDomainAliases\n"); @@ -3265,28 +3265,28 @@ static BOOL test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_EnumDomainAliases(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomainAliases failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.sam) { - return False; + return false; } for (i=0;i<r.out.sam->count;i++) { if (!test_OpenAlias(p, mem_ctx, handle, r.out.sam->entries[i].idx)) { - ret = False; + ret = false; } } return ret; } -static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_GetDisplayEnumerationIndex r; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; uint16_t ok_lvl[] = {1, 1, 1, 0, 0}; int i; @@ -3305,7 +3305,7 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m !NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) { printf("GetDisplayEnumerationIndex level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } init_lsa_String(&r.in.name, "zzzzzzzz"); @@ -3315,19 +3315,19 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m if (ok_lvl[i] && !NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) { printf("GetDisplayEnumerationIndex level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_GetDisplayEnumerationIndex2 r; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; uint16_t ok_lvl[] = {1, 1, 1, 0, 0}; int i; @@ -3345,7 +3345,7 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX * !NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) { printf("GetDisplayEnumerationIndex2 level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } init_lsa_String(&r.in.name, "zzzzzzzz"); @@ -3354,7 +3354,7 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX * if (ok_lvl[i] && !NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) { printf("GetDisplayEnumerationIndex2 level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } @@ -3367,23 +3367,23 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX * } else if ((s1.string && !s2.string) || (s2.string && !s1.string) || strcmp(s1.string, s2.string)) { \ printf("%s mismatch for %s: %s != %s (%s)\n", \ #s1, user.string, s1.string, s2.string, __location__); \ - ret = False; \ + ret = false; \ } #define INT_EQUAL_QUERY(s1, s2, user) \ if (s1 != s2) { \ printf("%s mismatch for %s: 0x%llx != 0x%llx (%s)\n", \ #s1, user.string, (unsigned long long)s1, (unsigned long long)s2, __location__); \ - ret = False; \ + ret = false; \ } -static BOOL test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_QueryDisplayInfo *querydisplayinfo, bool *seen_testuser) { struct samr_OpenUser r; struct samr_QueryUserInfo q; struct policy_handle user_handle; - int i, ret = True; + int i, ret = true; NTSTATUS status; r.in.domain_handle = querydisplayinfo->in.domain_handle; r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -3417,7 +3417,7 @@ static BOOL test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct status = dcerpc_samr_OpenUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenUser(%u) failed - %s\n", r.in.rid, nt_errstr(status)); - return False; + return false; } } @@ -3426,7 +3426,7 @@ static BOOL test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct status = dcerpc_samr_QueryUserInfo(p, mem_ctx, &q); if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo(%u) failed - %s\n", r.in.rid, nt_errstr(status)); - return False; + return false; } switch (querydisplayinfo->in.level) { @@ -3466,26 +3466,26 @@ static BOOL test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct q.out.info->info21.account_name.string, querydisplayinfo->out.info.info2.entries[i].acct_flags, q.out.info->info21.acct_flags); - return False; + return false; } break; } if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { - return False; + return false; } } return ret; } -static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDisplayInfo r; struct samr_QueryDomainInfo dom_info; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; int i; bool seen_testuser = false; @@ -3505,18 +3505,18 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) && !NT_STATUS_IS_OK(status)) { printf("QueryDisplayInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } switch (r.in.level) { case 1: if (!test_each_DisplayInfo_user(p, mem_ctx, &r, &seen_testuser)) { - ret = False; + ret = false; } r.in.start_idx += r.out.info.info1.count; break; case 2: if (!test_each_DisplayInfo_user(p, mem_ctx, &r, NULL)) { - ret = False; + ret = false; } r.in.start_idx += r.out.info.info2.count; break; @@ -3538,7 +3538,7 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDomainInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; break; } switch (r.in.level) { @@ -3548,14 +3548,14 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("QueryDomainInfo indicates that QueryDisplayInfo returned more users (%d/%d) than the domain %s is said to contain!\n", r.in.start_idx, dom_info.out.info->info2.num_groups, dom_info.out.info->info2.domain_name.string); - ret = False; + ret = false; } if (!seen_testuser) { struct policy_handle user_handle; if (NT_STATUS_IS_OK(test_OpenUser_byname(p, mem_ctx, handle, TEST_ACCOUNT_NAME, &user_handle))) { printf("Didn't find test user " TEST_ACCOUNT_NAME " in enumeration of %s\n", dom_info.out.info->info2.domain_name.string); - ret = False; + ret = false; test_samr_handle_Close(p, mem_ctx, &user_handle); } } @@ -3566,7 +3566,7 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("QueryDomainInfo indicates that QueryDisplayInfo didn't return all (%d/%d) the groups in %s\n", r.in.start_idx, dom_info.out.info->info2.num_groups, dom_info.out.info->info2.domain_name.string); - ret = False; + ret = false; } break; @@ -3577,12 +3577,12 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_QueryDisplayInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDisplayInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDisplayInfo2 r; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; int i; @@ -3599,19 +3599,19 @@ static BOOL test_QueryDisplayInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDisplayInfo2 level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_QueryDisplayInfo3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDisplayInfo3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDisplayInfo3 r; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; int i; @@ -3628,7 +3628,7 @@ static BOOL test_QueryDisplayInfo3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDisplayInfo3 level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } @@ -3636,12 +3636,12 @@ static BOOL test_QueryDisplayInfo3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_QueryDisplayInfo_continue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDisplayInfo_continue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDisplayInfo r; - BOOL ret = True; + bool ret = true; printf("Testing QueryDisplayInfo continuation\n"); @@ -3665,7 +3665,7 @@ static BOOL test_QueryDisplayInfo_continue(struct dcerpc_pipe *p, TALLOC_CTX *me !NT_STATUS_IS_OK(status)) { printf("QueryDisplayInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; break; } r.in.start_idx++; @@ -3676,7 +3676,7 @@ static BOOL test_QueryDisplayInfo_continue(struct dcerpc_pipe *p, TALLOC_CTX *me return ret; } -static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -3685,7 +3685,7 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13}; uint16_t set_ok[] = {1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0}; int i; - BOOL ret = True; + bool ret = true; const char *domain_comment = talloc_asprintf(mem_ctx, "Tortured by Samba4 RPC-SAMR: %s", timestring(mem_ctx, time(NULL))); @@ -3699,7 +3699,7 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetDomainInfo level %u (set comment) failed - %s\n", r.in.level, nt_errstr(status)); - return False; + return false; } for (i=0;i<ARRAY_SIZE(levels);i++) { @@ -3712,7 +3712,7 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDomainInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } @@ -3721,12 +3721,12 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (strcmp(r.out.info->info2.comment.string, domain_comment) != 0) { printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n", levels[i], r.out.info->info2.comment.string, domain_comment); - ret = False; + ret = false; } if (!r.out.info->info2.primary.string) { printf("QueryDomainInfo level %u returned no PDC name\n", levels[i]); - ret = False; + ret = false; } else if (r.out.info->info2.role == SAMR_ROLE_DOMAIN_PDC) { if (dcerpc_server_name(p) && strcasecmp_m(dcerpc_server_name(p), r.out.info->info2.primary.string) != 0) { printf("QueryDomainInfo level %u returned different PDC name (%s) compared to server name (%s), despite claiming to be the PDC\n", @@ -3738,21 +3738,21 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (strcmp(r.out.info->info4.comment.string, domain_comment) != 0) { printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n", levels[i], r.out.info->info4.comment.string, domain_comment); - ret = False; + ret = false; } break; case 6: if (!r.out.info->info6.primary.string) { printf("QueryDomainInfo level %u returned no PDC name\n", levels[i]); - ret = False; + ret = false; } break; case 11: if (strcmp(r.out.info->info11.info2.comment.string, domain_comment) != 0) { printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n", levels[i], r.out.info->info11.info2.comment.string, domain_comment); - ret = False; + ret = false; } break; } @@ -3768,14 +3768,14 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetDomainInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } } else { if (!NT_STATUS_EQUAL(NT_STATUS_INVALID_INFO_CLASS, status)) { printf("SetDomainInfo level %u gave %s - should have been NT_STATUS_INVALID_INFO_CLASS\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } } @@ -3784,7 +3784,7 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDomainInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } } @@ -3793,14 +3793,14 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_QueryDomainInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDomainInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDomainInfo2 r; uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13}; int i; - BOOL ret = True; + bool ret = true; for (i=0;i<ARRAY_SIZE(levels);i++) { printf("Testing QueryDomainInfo2 level %u\n", levels[i]); @@ -3812,17 +3812,17 @@ static BOOL test_QueryDomainInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDomainInfo2 level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } } - return True; + return true; } /* Test whether querydispinfo level 5 and enumdomgroups return the same set of group names. */ -static BOOL test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { struct samr_EnumDomainGroups q1; @@ -3830,7 +3830,7 @@ static BOOL test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; uint32_t resume_handle=0; int i; - BOOL ret = True; + bool ret = true; int num_names = 0; const char **names = NULL; @@ -3859,11 +3859,11 @@ static BOOL test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("EnumDomainGroups failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!q1.out.sam) { - return False; + return false; } q2.in.domain_handle = handle; @@ -3883,14 +3883,14 @@ static BOOL test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, for (i=0; i<q2.out.info.info5.count; i++) { int j; const char *name = q2.out.info.info5.entries[i].account_name.string; - BOOL found = False; + bool found = false; for (j=0; j<num_names; j++) { if (names[j] == NULL) continue; /* Hmm. No strequal in samba4 */ if (strequal(names[j], name)) { names[j] = NULL; - found = True; + found = true; break; } } @@ -3898,7 +3898,7 @@ static BOOL test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!found) { printf("QueryDisplayInfo gave name [%s] that EnumDomainGroups did not\n", name); - ret = False; + ret = false; } } q2.in.start_idx += q2.out.info.info5.count; @@ -3907,26 +3907,26 @@ static BOOL test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDisplayInfo level 5 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } for (i=0; i<num_names; i++) { if (names[i] != NULL) { printf("EnumDomainGroups gave name [%s] that QueryDisplayInfo did not\n", names[i]); - ret = False; + ret = false; } } return ret; } -static BOOL test_DeleteDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DeleteDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *group_handle) { struct samr_DeleteDomainGroup d; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing DeleteDomainGroup\n"); @@ -3936,18 +3936,18 @@ static BOOL test_DeleteDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteDomainGroup(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteDomainGroup failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_TestPrivateFunctionsDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_TestPrivateFunctionsDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) { struct samr_TestPrivateFunctionsDomain r; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing TestPrivateFunctionsDomain\n"); @@ -3956,19 +3956,19 @@ static BOOL test_TestPrivateFunctionsDomain(struct dcerpc_pipe *p, TALLOC_CTX *m status = dcerpc_samr_TestPrivateFunctionsDomain(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_NOT_IMPLEMENTED, status)) { printf("TestPrivateFunctionsDomain failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_RidToSid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_RidToSid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct dom_sid *domain_sid, struct policy_handle *domain_handle) { struct samr_RidToSid r; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct dom_sid *calc_sid; int rids[] = { 0, 42, 512, 10200 }; int i; @@ -3984,7 +3984,7 @@ static BOOL test_RidToSid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_RidToSid(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RidToSid for %d failed - %s\n", rids[i], nt_errstr(status)); - ret = False; + ret = false; } else { calc_sid = dom_sid_add_rid(calc_sid, calc_sid, rids[i]); @@ -3992,7 +3992,7 @@ static BOOL test_RidToSid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("RidToSid for %d failed - got %s, expected %s\n", rids[i], dom_sid_string(mem_ctx, r.out.sid), dom_sid_string(mem_ctx, calc_sid)); - ret = False; + ret = false; } } } @@ -4000,12 +4000,12 @@ static BOOL test_RidToSid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_GetBootKeyInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetBootKeyInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) { struct samr_GetBootKeyInformation r; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing GetBootKeyInformation\n"); @@ -4020,7 +4020,7 @@ static BOOL test_GetBootKeyInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct return ret; } -static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct policy_handle *group_handle) { @@ -4029,13 +4029,13 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_DeleteGroupMember d; struct samr_QueryGroupMember q; struct samr_SetMemberAttributesOfGroup s; - BOOL ret = True; + bool ret = true; uint32_t rid; status = test_LookupName(p, mem_ctx, domain_handle, TEST_ACCOUNT_NAME, &rid); if (!NT_STATUS_IS_OK(status)) { printf("test_AddGroupMember looking up name " TEST_ACCOUNT_NAME " failed - %s\n", nt_errstr(status)); - return False; + return false; } r.in.group_handle = group_handle; @@ -4051,20 +4051,20 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(NT_STATUS_MEMBER_NOT_IN_GROUP, status)) { printf("DeleteGroupMember gave %s - should be NT_STATUS_MEMBER_NOT_IN_GROUP\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_AddGroupMember(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("AddGroupMember failed - %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_AddGroupMember(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_MEMBER_IN_GROUP, status)) { printf("AddGroupMember gave %s - should be NT_STATUS_MEMBER_IN_GROUP\n", nt_errstr(status)); - return False; + return false; } if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { @@ -4080,7 +4080,7 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_SetMemberAttributesOfGroup(p, mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { printf("SetMemberAttributesOfGroup failed - %s\n", nt_errstr(status)); - return False; + return false; } } @@ -4089,33 +4089,33 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_QueryGroupMember(p, mem_ctx, &q); if (!NT_STATUS_IS_OK(status)) { printf("QueryGroupMember failed - %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_DeleteGroupMember(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteGroupMember failed - %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_AddGroupMember(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("AddGroupMember failed - %s\n", nt_errstr(status)); - return False; + return false; } return ret; } -static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct policy_handle *group_handle) { NTSTATUS status; struct samr_CreateDomainGroup r; uint32_t rid; struct lsa_String name; - BOOL ret = True; + bool ret = true; init_lsa_String(&name, TEST_GROUPNAME); @@ -4132,7 +4132,7 @@ static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { printf("Server refused create of '%s'\n", r.in.name->string); ZERO_STRUCTP(group_handle); - return True; + return true; } if (NT_STATUS_EQUAL(status, NT_STATUS_GROUP_EXISTS)) { @@ -4140,7 +4140,7 @@ static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("CreateDomainGroup failed: Could not delete domain group %s - %s\n", r.in.name->string, nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r); } @@ -4149,22 +4149,22 @@ static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("CreateDomainGroup failed: Could not delete user %s - %s\n", r.in.name->string, nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r); } if (!NT_STATUS_IS_OK(status)) { printf("CreateDomainGroup failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_AddGroupMember(p, mem_ctx, domain_handle, group_handle)) { printf("CreateDomainGroup failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!test_SetGroupInfo(p, mem_ctx, group_handle)) { - ret = False; + ret = false; } return ret; @@ -4174,7 +4174,7 @@ static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* its not totally clear what this does. It seems to accept any sid you like. */ -static BOOL test_RemoveMemberFromForeignDomain(struct dcerpc_pipe *p, +static bool test_RemoveMemberFromForeignDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) { @@ -4187,18 +4187,18 @@ static BOOL test_RemoveMemberFromForeignDomain(struct dcerpc_pipe *p, status = dcerpc_samr_RemoveMemberFromForeignDomain(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RemoveMemberFromForeignDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid *sid, enum torture_samr_choice which_ops) { @@ -4208,7 +4208,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle alias_handle; struct policy_handle user_handle; struct policy_handle group_handle; - BOOL ret = True; + bool ret = true; ZERO_STRUCT(alias_handle); ZERO_STRUCT(user_handle); @@ -4225,7 +4225,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenDomain(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } /* run the domain tests with the main handle closed - this tests @@ -4271,17 +4271,17 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!policy_handle_empty(&user_handle) && !test_DeleteUser(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } if (!policy_handle_empty(&alias_handle) && !test_DeleteAlias(p, mem_ctx, &alias_handle)) { - ret = False; + ret = false; } if (!policy_handle_empty(&group_handle) && !test_DeleteDomainGroup(p, mem_ctx, &group_handle)) { - ret = False; + ret = false; } ret &= test_samr_handle_Close(p, mem_ctx, &domain_handle); @@ -4296,7 +4296,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *domain, enum torture_samr_choice which_ops) { @@ -4304,7 +4304,7 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_LookupDomain r; struct lsa_String n1; struct lsa_String n2; - BOOL ret = True; + bool ret = true; printf("Testing LookupDomain(%s)\n", domain); @@ -4316,7 +4316,7 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_INVALID_PARAMETER, status)) { printf("failed: LookupDomain expected NT_STATUS_INVALID_PARAMETER - %s\n", nt_errstr(status)); - ret = False; + ret = false; } init_lsa_String(&n2, "xxNODOMAINxx"); @@ -4324,7 +4324,7 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_NO_SUCH_DOMAIN, status)) { printf("failed: LookupDomain expected NT_STATUS_NO_SUCH_DOMAIN - %s\n", nt_errstr(status)); - ret = False; + ret = false; } r.in.connect_handle = handle; @@ -4335,29 +4335,29 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!test_GetDomPwInfo(p, mem_ctx, &n1)) { - ret = False; + ret = false; } if (!test_OpenDomain(p, mem_ctx, handle, r.out.sid, which_ops)) { - ret = False; + ret = false; } return ret; } -static BOOL test_EnumDomains(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomains(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, enum torture_samr_choice which_ops) { NTSTATUS status; struct samr_EnumDomains r; uint32_t resume_handle = 0; int i; - BOOL ret = True; + bool ret = true; r.in.connect_handle = handle; r.in.resume_handle = &resume_handle; @@ -4367,31 +4367,31 @@ static BOOL test_EnumDomains(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_EnumDomains(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomains failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.sam) { - return False; + return false; } for (i=0;i<r.out.sam->count;i++) { if (!test_LookupDomain(p, mem_ctx, handle, r.out.sam->entries[i].name.string, which_ops)) { - ret = False; + ret = false; } } status = dcerpc_samr_EnumDomains(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomains failed - %s\n", nt_errstr(status)); - return False; + return false; } return ret; } -static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -4402,7 +4402,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_Connect5 r5; union samr_ConnectInfo info; struct policy_handle h; - BOOL ret = True, got_handle = False; + bool ret = true, got_handle = false; printf("testing samr_Connect\n"); @@ -4413,9 +4413,9 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Connect failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { - got_handle = True; + got_handle = true; *handle = h; } @@ -4428,12 +4428,12 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect2(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("Connect2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (got_handle) { test_samr_handle_Close(p, mem_ctx, handle); } - got_handle = True; + got_handle = true; *handle = h; } @@ -4447,12 +4447,12 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect3(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("Connect3 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (got_handle) { test_samr_handle_Close(p, mem_ctx, handle); } - got_handle = True; + got_handle = true; *handle = h; } @@ -4466,12 +4466,12 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect4(p, mem_ctx, &r4); if (!NT_STATUS_IS_OK(status)) { printf("Connect4 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (got_handle) { test_samr_handle_Close(p, mem_ctx, handle); } - got_handle = True; + got_handle = true; *handle = h; } @@ -4490,12 +4490,12 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect5(p, mem_ctx, &r5); if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (got_handle) { test_samr_handle_Close(p, mem_ctx, handle); } - got_handle = True; + got_handle = true; *handle = h; } @@ -4503,16 +4503,16 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -BOOL torture_rpc_samr(struct torture_context *torture) +bool torture_rpc_samr(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct policy_handle handle; status = torture_rpc_connection(torture, &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } ret &= test_Connect(p, torture, &handle); @@ -4531,16 +4531,16 @@ BOOL torture_rpc_samr(struct torture_context *torture) } -BOOL torture_rpc_samr_users(struct torture_context *torture) +bool torture_rpc_samr_users(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct policy_handle handle; status = torture_rpc_connection(torture, &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } ret &= test_Connect(p, torture, &handle); @@ -4559,16 +4559,16 @@ BOOL torture_rpc_samr_users(struct torture_context *torture) } -BOOL torture_rpc_samr_passwords(struct torture_context *torture) +bool torture_rpc_samr_passwords(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct policy_handle handle; status = torture_rpc_connection(torture, &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } ret &= test_Connect(p, torture, &handle); diff --git a/source4/torture/rpc/samr_accessmask.c b/source4/torture/rpc/samr_accessmask.c index 7d3395c5d0..c444187cfc 100644 --- a/source4/torture/rpc/samr_accessmask.c +++ b/source4/torture/rpc/samr_accessmask.c @@ -106,27 +106,27 @@ static bool test_samr_accessmask_Connect5(struct torture_context *tctx, */ if(!NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } break; default: /* these bits set are expected to succeed by default */ if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &h); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; } printf(" OK\n"); } - return True; + return true; } /* check which bits in accessmask allows us to EnumDomains() @@ -163,7 +163,7 @@ static bool test_samr_accessmask_EnumDomains(struct torture_context *tctx, /* these bits set are expected to succeed by default */ if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } ed.in.connect_handle = &ch; @@ -174,13 +174,13 @@ static bool test_samr_accessmask_EnumDomains(struct torture_context *tctx, status = dcerpc_samr_EnumDomains(p, tctx, &ed); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomains failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; default: @@ -199,20 +199,20 @@ static bool test_samr_accessmask_EnumDomains(struct torture_context *tctx, status = dcerpc_samr_EnumDomains(p, tctx, &ed); if(!NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { printf("EnumDomains failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; } printf(" OK\n"); } - return True; + return true; } @@ -237,7 +237,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, struct security_ace ace; struct security_descriptor *sd; struct sec_desc_buf sdb; - bool ret = True; + bool ret = true; int sd_size; struct dcerpc_pipe *test_p; const char *binding = torture_setting_string(tctx, "binding", NULL); @@ -248,7 +248,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = torture_samr_Connect5(tctx, p, SEC_FLAG_MAXIMUM_ALLOWED, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } @@ -258,7 +258,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = dcerpc_samr_QuerySecurity(p, tctx, &qs); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* how big is the security descriptor? */ @@ -276,7 +276,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = security_descriptor_dacl_add(sd, &ace); if (!NT_STATUS_IS_OK(status)) { printf("Failed to add ACE to security descriptor\n"); - ret = False; + ret = false; } ss.in.handle = &ch; ss.in.sec_info = SECINFO_DACL; @@ -285,7 +285,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = dcerpc_samr_SetSecurity(p, tctx, &ss); if (!NT_STATUS_IS_OK(status)) { printf("SetSecurity failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } @@ -297,12 +297,12 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = torture_samr_Connect5(tctx, test_p, SEC_FLAG_MAXIMUM_ALLOWED, &uch); if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } /* disconnec the user */ talloc_free(test_p); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } @@ -312,21 +312,21 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = dcerpc_samr_QuerySecurity(p, tctx, &qs); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (sd_size != qs.out.sdbuf->sd_size) { printf("security descriptor changed\n"); - ret = False; + ret = false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } - if (ret == True) { + if (ret == true) { printf(" OK\n"); } return ret; @@ -348,7 +348,7 @@ static bool test_samr_connect_user_acl_enforced(struct torture_context *tctx, { NTSTATUS status; struct policy_handle uch; - bool ret = True; + bool ret = true; struct dcerpc_pipe *test_p; const char *binding = torture_setting_string(tctx, "binding", NULL); @@ -363,7 +363,7 @@ static bool test_samr_connect_user_acl_enforced(struct torture_context *tctx, status = torture_samr_Connect5(tctx, test_p, SAMR_ACCESS_SHUTDOWN_SERVER, &uch); if (NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf(" OK\n"); @@ -407,7 +407,7 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx, /* these bits set are expected to succeed by default */ if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } ld.in.connect_handle = &ch; @@ -417,13 +417,13 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx, status = dcerpc_samr_LookupDomain(p, tctx, &ld); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; default: @@ -441,20 +441,20 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx, status = dcerpc_samr_LookupDomain(p, tctx, &ld); if(!NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; } printf(" OK\n"); } - return True; + return true; } /* check which bits in accessmask allows us to OpenDomain() @@ -483,7 +483,7 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, status = torture_samr_Connect5(tctx, p, SEC_FLAG_MAXIMUM_ALLOWED, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } ld.in.connect_handle = &ch; @@ -492,7 +492,7 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, status = dcerpc_samr_LookupDomain(p, tctx, &ld); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } @@ -512,7 +512,7 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, /* these bits set are expected to succeed by default */ if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } od.in.connect_handle = &ch; @@ -523,19 +523,19 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, status = dcerpc_samr_OpenDomain(p, tctx, &od); if (!NT_STATUS_IS_OK(status)) { printf("OpenDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &dh); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; default: @@ -549,14 +549,14 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; } printf(" OK\n"); } - return True; + return true; } static bool test_samr_connect(struct torture_context *tctx, @@ -565,7 +565,7 @@ static bool test_samr_connect(struct torture_context *tctx, void *testuser; const char *testuser_passwd; struct cli_credentials *test_credentials; - bool ret = True; + bool ret = true; const struct dom_sid *test_sid; /* create a test user */ @@ -573,7 +573,7 @@ static bool test_samr_connect(struct torture_context *tctx, ACB_NORMAL, &testuser_passwd); if (!testuser) { printf("Failed to create test user\n"); - return False; + return false; } test_credentials = cli_credentials_init(tctx); cli_credentials_set_workstation(test_credentials, "localhost", CRED_SPECIFIED); @@ -588,7 +588,7 @@ static bool test_samr_connect(struct torture_context *tctx, will allow us to connect to the server */ if (!test_samr_accessmask_Connect5(tctx, p)) { - ret = False; + ret = false; } @@ -596,14 +596,14 @@ static bool test_samr_connect(struct torture_context *tctx, * us to call EnumDomains() */ if (!test_samr_accessmask_EnumDomains(tctx, p)) { - ret = False; + ret = false; } /* test which bits in the accessmask to Connect5 will allow * us to call LookupDomain() */ if (!test_samr_accessmask_LookupDomain(tctx, p)) { - ret = False; + ret = false; } @@ -611,7 +611,7 @@ static bool test_samr_connect(struct torture_context *tctx, * us to call OpenDomain() */ if (!test_samr_accessmask_OpenDomain(tctx, p)) { - ret = False; + ret = false; } @@ -619,7 +619,7 @@ static bool test_samr_connect(struct torture_context *tctx, * returned by Connect5 */ if (!test_samr_connect_user_acl(tctx, p, test_credentials, test_sid)) { - ret = False; + ret = false; } /* test if the ACLs that are reported from the Connect5 @@ -633,7 +633,7 @@ static bool test_samr_connect(struct torture_context *tctx, * requesting SAMR_ACCESS_SHUTDOWN_SERVER */ if (!test_samr_connect_user_acl_enforced(tctx, p, test_credentials, test_sid)) { - ret = False; + ret = false; } diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index 8494bdb543..6f76e3b58b 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -223,21 +223,21 @@ static struct sec_desc_buf *samsync_query_lsa_sec_desc(TALLOC_CTX *mem_ctx, __location__, \ (long long)i1, (long long)i1, \ (long long)i2, (long long)i2);\ - ret = False;\ + ret = false;\ } \ } while (0) #define TEST_INT_EQUAL(i1, i2) do {\ if (i1 != i2) {\ printf("%s: integer mismatch: " #i1 ": 0x%08x (%d) != " #i2 ": 0x%08x (%d)\n", \ __location__, i1, i1, i2, i2); \ - ret = False;\ + ret = false;\ } \ } while (0) #define TEST_TIME_EQUAL(t1, t2) do {\ if (t1 != t2) {\ printf("%s: NTTIME mismatch: " #t1 ":%s != " #t2 ": %s\n", \ __location__, nt_time_string(mem_ctx, t1), nt_time_string(mem_ctx, t2));\ - ret = False;\ + ret = false;\ } \ } while (0) @@ -246,7 +246,7 @@ static struct sec_desc_buf *samsync_query_lsa_sec_desc(TALLOC_CTX *mem_ctx, && strcmp_safe(s1.string, s2.string) != 0) {\ printf("%s: string mismatch: " #s1 ":%s != " #s2 ": %s\n", \ __location__, s1.string, s2.string);\ - ret = False;\ + ret = false;\ } \ } while (0) @@ -254,7 +254,7 @@ static struct sec_desc_buf *samsync_query_lsa_sec_desc(TALLOC_CTX *mem_ctx, if (!dom_sid_equal(s1, s2)) {\ printf("%s: dom_sid mismatch: " #s1 ":%s != " #s2 ": %s\n", \ __location__, dom_sid_string(mem_ctx, s1), dom_sid_string(mem_ctx, s2));\ - ret = False;\ + ret = false;\ } \ } while (0) @@ -266,19 +266,19 @@ static struct sec_desc_buf *samsync_query_lsa_sec_desc(TALLOC_CTX *mem_ctx, handle); \ if (!sdbuf || !sdbuf->sd) { \ printf("Could not obtain security descriptor to match " #sd1 "\n");\ - ret = False; \ + ret = false; \ } else {\ if (!security_descriptor_mask_equal(sd1.sd, sdbuf->sd, \ ~SEC_DESC_SACL_PRESENT)) {\ printf("Security Descriptor Mismatch for %s:\n", #sd1);\ ndr_print_debug((ndr_print_fn_t)ndr_print_security_descriptor, "SamSync", sd1.sd);\ ndr_print_debug((ndr_print_fn_t)ndr_print_security_descriptor, "SamR", sdbuf->sd);\ - ret = False;\ + ret = false;\ }\ }\ } while (0) -static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { struct netr_DELTA_DOMAIN *domain = delta->delta_union.domain; @@ -287,7 +287,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13}; NTSTATUS nt_status; int i; - BOOL ret = True; + bool ret = true; samsync_state->seq_num[database_id] = domain->sequence_num; @@ -301,7 +301,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam break; case SAM_DATABASE_PRIVS: printf("DOMAIN entry on privs DB!\n"); - return False; + return false; break; } @@ -312,7 +312,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam if (strcasecmp_m(samsync_state->domain_name[database_id], domain->domain_name.string) != 0) { printf("Domain has name varies!: %s != %s\n", samsync_state->domain_name[database_id], domain->domain_name.string); - return False; + return false; } } @@ -339,7 +339,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryDomainInfo level %u failed - %s\n", q[levels[i]].in.level, nt_errstr(nt_status)); - return False; + return false; } } @@ -367,7 +367,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam return ret; } -static BOOL samsync_handle_policy(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_policy(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { struct netr_DELTA_POLICY *policy = delta->delta_union.policy; @@ -382,23 +382,23 @@ static BOOL samsync_handle_policy(TALLOC_CTX *mem_ctx, struct samsync_state *sam if (strcasecmp_m(samsync_state->domain_name[SAM_DATABASE_DOMAIN], policy->primary_domain_name.string) != 0) { printf("PRIMARY domain has name varies between DOMAIN and POLICY!: %s != %s\n", samsync_state->domain_name[SAM_DATABASE_DOMAIN], policy->primary_domain_name.string); - return False; + return false; } } if (!dom_sid_equal(samsync_state->sid[SAM_DATABASE_DOMAIN], policy->sid)) { printf("Domain SID from POLICY (%s) does not match domain sid from SAMR (%s)\n", dom_sid_string(mem_ctx, policy->sid), dom_sid_string(mem_ctx, samsync_state->sid[SAM_DATABASE_DOMAIN])); - return False; + return false; } printf("\tsequence_nums[%d/PRIVS]=%llu\n", database_id, (long long)samsync_state->seq_num[database_id]); - return True; + return true; } -static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { uint32_t rid = delta->delta_id_union.rid; @@ -411,7 +411,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy const char *domain = samsync_state->domain_name[database_id]; const char *username = user->account_name.string; NTSTATUS nt_status; - BOOL ret = True; + bool ret = true; struct samr_OpenUser r; struct samr_QueryUserInfo q; @@ -420,7 +420,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy struct samr_GetGroupsForUser getgroups; if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) { printf("SamSync needs domain information before the users\n"); - return False; + return false; } r.in.domain_handle = samsync_state->domain_handle[database_id]; @@ -431,7 +431,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy nt_status = dcerpc_samr_OpenUser(samsync_state->p_samr, mem_ctx, &r); if (!NT_STATUS_IS_OK(nt_status)) { printf("OpenUser(%u) failed - %s\n", rid, nt_errstr(nt_status)); - return False; + return false; } q.in.user_handle = &user_handle; @@ -443,7 +443,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryUserInfo level %u failed - %s\n", q.in.level, nt_errstr(nt_status)); - ret = False; + ret = false; } getgroups.in.user_handle = &user_handle; @@ -452,22 +452,22 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (!NT_STATUS_IS_OK(nt_status)) { printf("GetGroupsForUser failed - %s\n", nt_errstr(nt_status)); - ret = False; + ret = false; } if (!test_samr_handle_Close(samsync_state->p_samr, mem_ctx, &user_handle)) { printf("samr_handle_Close failed - %s\n", nt_errstr(nt_status)); - ret = False; + ret = false; } if (!ret) { - return False; + return false; } if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryUserInfo level %u failed - %s\n", q.in.level, nt_errstr(nt_status)); - return False; + return false; } TEST_STRING_EQUAL(q.out.info->info21.account_name, user->account_name); @@ -490,7 +490,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (memcmp(q.out.info->info21.logon_hours.bits, user->logon_hours.bits, q.out.info->info21.logon_hours.units_per_week/8) != 0) { printf("Logon hours mismatch\n"); - ret = False; + ret = false; } } @@ -508,7 +508,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (user->acct_flags & ACB_PWNOEXP) { if (q.out.info->info21.acct_flags & ACB_PW_EXPIRED) { printf("ACB flags mismatch: both expired and no expiry!\n"); - ret = False; + ret = false; } if (q.out.info->info21.force_password_change != (NTTIME)0x7FFFFFFFFFFFFFFFULL) { printf("ACB flags mismatch: no password expiry, but force password change 0x%016llx (%lld) != 0x%016llx (%lld)\n", @@ -516,7 +516,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy (unsigned long long)q.out.info->info21.force_password_change, (unsigned long long)0x7FFFFFFFFFFFFFFFULL, (unsigned long long)0x7FFFFFFFFFFFFFFFULL ); - ret = False; + ret = false; } } @@ -562,7 +562,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy #if 0 dump_data(0, data.data, data.length); #endif - return False; + return false; } } @@ -585,39 +585,39 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCOUNT_DISABLED)) { if (user->acct_flags & ACB_DISABLED) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT)) { if (user->acct_flags & ACB_WSTRUST) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT)) { if (user->acct_flags & ACB_SVRTRUST) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT)) { if (user->acct_flags & ACB_DOMTRUST) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT)) { if (user->acct_flags & ACB_DOMTRUST) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCOUNT_LOCKED_OUT)) { if (user->acct_flags & ACB_AUTOLOCK) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_PASSWORD_EXPIRED)) { if (q.out.info->info21.acct_flags & ACB_PW_EXPIRED) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD)) { if (!lm_hash_p && !nt_hash_p) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_PASSWORD_MUST_CHANGE)) { /* We would need to know the server's current time to test this properly */ - return True; + return true; } else if (NT_STATUS_IS_OK(nt_status)) { TEST_INT_EQUAL(user->rid, info3->base.rid); TEST_INT_EQUAL(user->primary_gid, info3->base.primary_gid); @@ -660,7 +660,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (getgroups.out.rids->count == info3->base.groups.count) { int i, j; int count = getgroups.out.rids->count; - BOOL *matched = talloc_zero_array(mem_ctx, BOOL, getgroups.out.rids->count); + bool *matched = talloc_zero_array(mem_ctx, bool, getgroups.out.rids->count); for (i = 0; i < count; i++) { for (j = 0; j < count; j++) { @@ -668,14 +668,14 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy info3->base.groups.rids[j].rid) && (getgroups.out.rids->rids[i].attributes == info3->base.groups.rids[j].attributes)) { - matched[i] = True; + matched[i] = true; } } } for (i = 0; i < getgroups.out.rids->count; i++) { - if (matched[i] == False) { - ret = False; + if (matched[i] == false) { + ret = false; printf("Could not find group RID %u found in getgroups in NETLOGON reply\n", getgroups.out.rids->rids[i].rid); } @@ -685,18 +685,18 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy } else { printf("Could not validate password for user %s\\%s: %s\n", domain, username, nt_errstr(nt_status)); - return False; + return false; } - return False; + return false; } -static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { uint32_t rid = delta->delta_id_union.rid; struct netr_DELTA_ALIAS *alias = delta->delta_union.alias; NTSTATUS nt_status; - BOOL ret = True; + bool ret = true; struct samr_OpenAlias r; struct samr_QueryAliasInfo q; @@ -704,7 +704,7 @@ static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *sams if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) { printf("SamSync needs domain information before the users\n"); - return False; + return false; } r.in.domain_handle = samsync_state->domain_handle[database_id]; @@ -715,7 +715,7 @@ static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *sams nt_status = dcerpc_samr_OpenAlias(samsync_state->p_samr, mem_ctx, &r); if (!NT_STATUS_IS_OK(nt_status)) { printf("OpenUser(%u) failed - %s\n", rid, nt_errstr(nt_status)); - return False; + return false; } q.in.alias_handle = &alias_handle; @@ -725,13 +725,13 @@ static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *sams nt_status = dcerpc_samr_QueryAliasInfo(samsync_state->p_samr, mem_ctx, &q); if (!test_samr_handle_Close(samsync_state->p_samr, mem_ctx, &alias_handle)) { - return False; + return false; } if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryAliasInfo level %u failed - %s\n", q.in.level, nt_errstr(nt_status)); - return False; + return false; } TEST_STRING_EQUAL(q.out.info->all.name, alias->alias_name); @@ -739,13 +739,13 @@ static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *sams return ret; } -static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { uint32_t rid = delta->delta_id_union.rid; struct netr_DELTA_GROUP *group = delta->delta_union.group; NTSTATUS nt_status; - BOOL ret = True; + bool ret = true; struct samr_OpenGroup r; struct samr_QueryGroupInfo q; @@ -753,7 +753,7 @@ static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *sams if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) { printf("SamSync needs domain information before the users\n"); - return False; + return false; } r.in.domain_handle = samsync_state->domain_handle[database_id]; @@ -764,7 +764,7 @@ static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *sams nt_status = dcerpc_samr_OpenGroup(samsync_state->p_samr, mem_ctx, &r); if (!NT_STATUS_IS_OK(nt_status)) { printf("OpenUser(%u) failed - %s\n", rid, nt_errstr(nt_status)); - return False; + return false; } q.in.group_handle = &group_handle; @@ -774,13 +774,13 @@ static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *sams nt_status = dcerpc_samr_QueryGroupInfo(samsync_state->p_samr, mem_ctx, &q); if (!test_samr_handle_Close(samsync_state->p_samr, mem_ctx, &group_handle)) { - return False; + return false; } if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryGroupInfo level %u failed - %s\n", q.in.level, nt_errstr(nt_status)); - return False; + return false; } TEST_STRING_EQUAL(q.out.info->all.name, group->group_name); @@ -789,7 +789,7 @@ static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *sams return ret; } -static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { struct netr_DELTA_SECRET *secret = delta->delta_union.secret; @@ -803,7 +803,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam struct lsa_DATA_BUF_PTR bufp2; NTTIME new_mtime; NTTIME old_mtime; - BOOL ret = True; + bool ret = true; DATA_BLOB lsa_blob1, lsa_blob_out, session_key; NTSTATUS status; @@ -832,7 +832,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = dcerpc_lsa_OpenSecret(samsync_state->p_lsa, mem_ctx, &o); if (!NT_STATUS_IS_OK(status)) { printf("OpenSecret failed - %s\n", nt_errstr(status)); - return False; + return false; } /* @@ -842,7 +842,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = dcerpc_fetch_session_key(samsync_state->p_lsa, &session_key); if (!NT_STATUS_IS_OK(status)) { printf("dcerpc_fetch_session_key failed - %s\n", nt_errstr(status)); - return False; + return false; } @@ -862,10 +862,10 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = dcerpc_lsa_QuerySecret(samsync_state->p_lsa, mem_ctx, &q); if (NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { /* some things are just off limits */ - return True; + return true; } else if (!NT_STATUS_IS_OK(status)) { printf("QuerySecret failed - %s\n", nt_errstr(status)); - return False; + return false; } if (q.out.old_val->buf == NULL) { @@ -877,24 +877,24 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = sess_decrypt_blob(mem_ctx, &lsa_blob1, &session_key, &lsa_blob_out); if (!NT_STATUS_IS_OK(status)) { printf("Failed to decrypt secrets OLD blob: %s\n", nt_errstr(status)); - return False; + return false; } if (!q.out.old_mtime) { printf("OLD mtime not available on LSA for secret %s\n", old->name); - ret = False; + ret = false; } if (old->mtime != *q.out.old_mtime) { printf("OLD mtime on secret %s does not match between SAMSYNC (%s) and LSA (%s)\n", old->name, nt_time_string(mem_ctx, old->mtime), nt_time_string(mem_ctx, *q.out.old_mtime)); - ret = False; + ret = false; } if (old->secret.length != lsa_blob_out.length) { printf("Returned secret %s doesn't match: %d != %d\n", old->name, (int)old->secret.length, (int)lsa_blob_out.length); - ret = False; + ret = false; } else if (memcmp(lsa_blob_out.data, old->secret.data, old->secret.length) != 0) { printf("Returned secret %s doesn't match: \n", @@ -903,7 +903,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam dump_data(1, old->secret.data, old->secret.length); DEBUG(1, ("LSA Secret:\n")); dump_data(1, lsa_blob_out.data, lsa_blob_out.length); - ret = False; + ret = false; } } @@ -917,24 +917,24 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = sess_decrypt_blob(mem_ctx, &lsa_blob1, &session_key, &lsa_blob_out); if (!NT_STATUS_IS_OK(status)) { printf("Failed to decrypt secrets OLD blob\n"); - return False; + return false; } if (!q.out.new_mtime) { printf("NEW mtime not available on LSA for secret %s\n", new->name); - ret = False; + ret = false; } if (new->mtime != *q.out.new_mtime) { printf("NEW mtime on secret %s does not match between SAMSYNC (%s) and LSA (%s)\n", new->name, nt_time_string(mem_ctx, new->mtime), nt_time_string(mem_ctx, *q.out.new_mtime)); - ret = False; + ret = false; } if (new->secret.length != lsa_blob_out.length) { printf("Returned secret %s doesn't match: %d != %d\n", new->name, (int)new->secret.length, (int)lsa_blob_out.length); - ret = False; + ret = false; } else if (memcmp(lsa_blob_out.data, new->secret.data, new->secret.length) != 0) { printf("Returned secret %s doesn't match: \n", @@ -943,18 +943,18 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam dump_data(1, new->secret.data, new->secret.length); DEBUG(1, ("LSA Secret:\n")); dump_data(1, lsa_blob_out.data, lsa_blob_out.length); - ret = False; + ret = false; } } return ret; } -static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct netr_DELTA_TRUSTED_DOMAIN *trusted_domain = delta->delta_union.trusted_domain; struct dom_sid *dom_sid = delta->delta_id_union.sid; @@ -977,7 +977,7 @@ static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st status = dcerpc_lsa_OpenTrustedDomain(samsync_state->p_lsa, mem_ctx, &t); if (!NT_STATUS_IS_OK(status)) { printf("OpenTrustedDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } for (i=0; i< ARRAY_SIZE(levels); i++) { @@ -991,7 +991,7 @@ static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st } printf("QueryInfoTrustedDomain level %d failed - %s\n", levels[i], nt_errstr(status)); - return False; + return false; } info[levels[i]] = q.out.info; } @@ -1012,11 +1012,11 @@ static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st return ret; } -static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct netr_DELTA_ACCOUNT *account = delta->delta_union.account; struct dom_sid *dom_sid = delta->delta_id_union.sid; @@ -1027,7 +1027,7 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa int i, j; - BOOL *found_priv_in_lsa; + bool *found_priv_in_lsa; a.in.handle = samsync_state->lsa_handle; a.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -1037,31 +1037,31 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa status = dcerpc_lsa_OpenAccount(samsync_state->p_lsa, mem_ctx, &a); if (!NT_STATUS_IS_OK(status)) { printf("OpenTrustedDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } TEST_SEC_DESC_EQUAL(account->sdbuf, lsa, &acct_handle); - found_priv_in_lsa = talloc_zero_array(mem_ctx, BOOL, account->privilege_entries); + found_priv_in_lsa = talloc_zero_array(mem_ctx, bool, account->privilege_entries); e.in.handle = &acct_handle; status = dcerpc_lsa_EnumPrivsAccount(samsync_state->p_lsa, mem_ctx, &e); if (!NT_STATUS_IS_OK(status)) { printf("EnumPrivsAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } if ((account->privilege_entries && !e.out.privs)) { printf("Account %s has privileges in SamSync, but not LSA\n", dom_sid_string(mem_ctx, dom_sid)); - return False; + return false; } if (!account->privilege_entries && e.out.privs && e.out.privs->count) { printf("Account %s has privileges in LSA, but not SamSync\n", dom_sid_string(mem_ctx, dom_sid)); - return False; + return false; } TEST_INT_EQUAL(account->privilege_entries, e.out.privs->count); @@ -1073,16 +1073,16 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa status = dcerpc_lsa_LookupPrivName(samsync_state->p_lsa, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("\nLookupPrivName failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.name) { printf("\nLookupPrivName failed to return a name\n"); - return False; + return false; } for (j=0;j<account->privilege_entries; j++) { if (strcmp(r.out.name->string, account->privilege_name[j].string) == 0) { - found_priv_in_lsa[j] = True; + found_priv_in_lsa[j] = true; break; } } @@ -1091,7 +1091,7 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa if (!found_priv_in_lsa[j]) { printf("Privilage %s on account %s not found in LSA\n", account->privilege_name[j].string, dom_sid_string(mem_ctx, dom_sid)); - ret = False; + ret = false; } } return ret; @@ -1100,7 +1100,7 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa /* try a netlogon DatabaseSync */ -static BOOL test_DatabaseSync(struct samsync_state *samsync_state, +static bool test_DatabaseSync(struct samsync_state *samsync_state, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -1108,7 +1108,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, struct netr_DatabaseSync r; const enum netr_SamDatabaseID database_ids[] = {SAM_DATABASE_DOMAIN, SAM_DATABASE_BUILTIN, SAM_DATABASE_PRIVS}; int i, d; - BOOL ret = True; + bool ret = true; struct samsync_trusted_domain *t; struct samsync_secret *s; @@ -1133,7 +1133,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { printf("DatabaseSync - %s\n", nt_errstr(status)); - ret = False; + ret = false; break; } @@ -1150,56 +1150,56 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, if (!samsync_handle_domain(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_DOMAIN\n"); - ret = False; + ret = false; } break; case NETR_DELTA_GROUP: if (!samsync_handle_group(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_USER\n"); - ret = False; + ret = false; } break; case NETR_DELTA_USER: if (!samsync_handle_user(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_USER\n"); - ret = False; + ret = false; } break; case NETR_DELTA_ALIAS: if (!samsync_handle_alias(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_ALIAS\n"); - ret = False; + ret = false; } break; case NETR_DELTA_POLICY: if (!samsync_handle_policy(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_POLICY\n"); - ret = False; + ret = false; } break; case NETR_DELTA_TRUSTED_DOMAIN: if (!samsync_handle_trusted_domain(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_TRUSTED_DOMAIN\n"); - ret = False; + ret = false; } break; case NETR_DELTA_ACCOUNT: if (!samsync_handle_account(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_ACCOUNT\n"); - ret = False; + ret = false; } break; case NETR_DELTA_SECRET: if (!samsync_handle_secret(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_SECRET\n"); - ret = False; + ret = false; } break; case NETR_DELTA_GROUP_MEMBER: @@ -1220,7 +1220,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, case NETR_DELTA_MODIFY_COUNT: default: printf("Uxpected delta type %d\n", r.out.delta_enum_array->delta_enum[d].delta_type); - ret = False; + ret = false; break; } talloc_free(delta_ctx); @@ -1233,7 +1233,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, domain = samsync_state->domain_name[SAM_DATABASE_DOMAIN]; if (!domain) { printf("Never got a DOMAIN object in samsync!\n"); - return False; + return false; } trustdom_ctx = talloc_named(mem_ctx, 0, "test_DatabaseSync Trusted domains context"); @@ -1264,7 +1264,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT)) { printf("Verifiction of trust password to %s: should have failed (nologon interdomain trust account), instead: %s\n", t->name, nt_errstr(nt_status)); - ret = False; + ret = false; } /* break it */ @@ -1280,7 +1280,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD)) { printf("Verifiction of trust password to %s: should have failed (wrong password), instead: %s\n", t->name, nt_errstr(nt_status)); - ret = False; + ret = false; } break; @@ -1295,14 +1295,14 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, /* try a netlogon DatabaseDeltas */ -static BOOL test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX *mem_ctx) +static bool test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX *mem_ctx) { NTSTATUS status; TALLOC_CTX *loop_ctx; struct netr_DatabaseDeltas r; const uint32_t database_ids[] = {0, 1, 2}; int i; - BOOL ret = True; + bool ret = true; r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(samsync_state->p)); r.in.computername = TEST_MACHINE_NAME; @@ -1334,7 +1334,7 @@ static BOOL test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) && !NT_STATUS_EQUAL(status, NT_STATUS_SYNCHRONIZATION_REQUIRED)) { printf("DatabaseDeltas - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!creds_client_check(samsync_state->creds, &r.out.return_authenticator.cred)) { @@ -1353,7 +1353,7 @@ static BOOL test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX /* try a netlogon DatabaseSync2 */ -static BOOL test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct creds_CredentialState *creds) { NTSTATUS status; @@ -1361,7 +1361,7 @@ static BOOL test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct netr_DatabaseSync2 r; const uint32_t database_ids[] = {0, 1, 2}; int i; - BOOL ret = True; + bool ret = true; r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); r.in.computername = TEST_MACHINE_NAME; @@ -1383,7 +1383,7 @@ static BOOL test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { printf("DatabaseSync2 - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!creds_client_check(creds, &r.out.return_authenticator.cred)) { @@ -1400,11 +1400,11 @@ static BOOL test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, -BOOL torture_rpc_samsync(struct torture_context *torture) +bool torture_rpc_samsync(struct torture_context *torture) { NTSTATUS status; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct test_join *join_ctx; struct test_join *join_ctx2; struct test_join *user_ctx; @@ -1437,7 +1437,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!join_ctx) { talloc_free(mem_ctx); printf("Failed to join as BDC\n"); - return False; + return false; } test_wksta_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_WKSTA_MACHINE_NAME); @@ -1445,7 +1445,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!join_ctx2) { talloc_free(mem_ctx); printf("Failed to join as member\n"); - return False; + return false; } user_ctx = torture_create_testuser(torture, TEST_USER_NAME, @@ -1454,7 +1454,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!user_ctx) { talloc_free(mem_ctx); printf("Failed to create test account\n"); - return False; + return false; } samsync_state = talloc_zero(mem_ctx, struct samsync_state); @@ -1469,14 +1469,14 @@ BOOL torture_rpc_samsync(struct torture_context *torture) status = dcerpc_samr_Connect(samsync_state->p_samr, mem_ctx, &c); if (!NT_STATUS_IS_OK(status)) { printf("samr_Connect failed\n"); - ret = False; + ret = false; goto failed; } domain_policy = samsync_open_domain(mem_ctx, samsync_state, lp_workgroup(global_loadparm), NULL); if (!domain_policy) { printf("samrsync_open_domain failed\n"); - ret = False; + ret = false; goto failed; } @@ -1491,14 +1491,14 @@ BOOL torture_rpc_samsync(struct torture_context *torture) status = dcerpc_samr_SetDomainInfo(samsync_state->p_samr, mem_ctx, &s); if (!test_samr_handle_Close(samsync_state->p_samr, mem_ctx, domain_policy)) { - ret = False; + ret = false; goto failed; } if (!NT_STATUS_IS_OK(status)) { printf("SetDomainInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; goto failed; } @@ -1508,7 +1508,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) &ndr_table_lsarpc); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1532,13 +1532,13 @@ BOOL torture_rpc_samsync(struct torture_context *torture) status = dcerpc_lsa_OpenPolicy2(samsync_state->p_lsa, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenPolicy2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } status = torture_rpc_binding(torture, &b); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1561,21 +1561,21 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } status = dcerpc_schannel_creds(samsync_state->p->conn->security_state.generic_state, samsync_state, &samsync_state->creds); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; } status = torture_rpc_binding(torture, &b_netlogon_wksta); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1599,7 +1599,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } @@ -1607,22 +1607,22 @@ BOOL torture_rpc_samsync(struct torture_context *torture) samsync_state, &samsync_state->creds_netlogon_wksta); if (!NT_STATUS_IS_OK(status)) { printf("Failed to obtail schanel creds!\n"); - ret = False; + ret = false; } if (!test_DatabaseSync(samsync_state, mem_ctx)) { printf("DatabaseSync failed\n"); - ret = False; + ret = false; } if (!test_DatabaseDeltas(samsync_state, mem_ctx)) { printf("DatabaseDeltas failed\n"); - ret = False; + ret = false; } if (!test_DatabaseSync2(samsync_state->p, mem_ctx, samsync_state->creds)) { printf("DatabaseSync2 failed\n"); - ret = False; + ret = false; } failed: diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c index 976279a817..630e9cf1e4 100644 --- a/source4/torture/rpc/scanner.c +++ b/source4/torture/rpc/scanner.c @@ -52,7 +52,7 @@ static bool test_num_calls(struct torture_context *tctx, printf("Failed to connect to '%s' on '%s' - %s\n", uuid_str, iface->name, nt_errstr(status)); talloc_free(uuid_str); - return True; + return true; } /* make null calls */ @@ -60,7 +60,7 @@ static bool test_num_calls(struct torture_context *tctx, memset(stub_in.data, 0xFF, stub_in.length); for (i=0;i<200;i++) { - status = dcerpc_request(p, NULL, i, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, i, false, mem_ctx, &stub_in, &stub_out); if (!NT_STATUS_IS_OK(status) && p->last_fault_code == DCERPC_FAULT_OP_RNG_ERROR) { break; @@ -99,7 +99,7 @@ bool torture_rpc_scanner(struct torture_context *torture) NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *loop_ctx; - BOOL ret = True; + bool ret = true; const struct ndr_interface_list *l; struct dcerpc_binding *b; @@ -136,12 +136,12 @@ bool torture_rpc_scanner(struct torture_context *torture) status = torture_rpc_connection(torture, &p, &ndr_table_mgmt); if (!NT_STATUS_IS_OK(status)) { talloc_free(loop_ctx); - ret = False; + ret = false; continue; } if (!test_inq_if_ids(torture, p, torture, test_num_calls, l->table)) { - ret = False; + ret = false; } } diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 69e18a40cd..a1a83c69d7 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -161,12 +161,12 @@ static bool test_samr_ops(struct torture_context *tctx, if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { printf("GetDomPwInfo op %d failed - %s\n", i, nt_errstr(status)); - return False; + return false; } } } - return True; + return true; } @@ -177,7 +177,7 @@ static bool test_lsa_ops(struct torture_context *tctx, struct dcerpc_pipe *p) { struct lsa_GetUserName r; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct lsa_StringPointer authority_name_p; printf("\nTesting GetUserName\n"); @@ -194,30 +194,30 @@ static bool test_lsa_ops(struct torture_context *tctx, struct dcerpc_pipe *p) printf("not considering %s to be an error\n", nt_errstr(status)); } else if (!NT_STATUS_IS_OK(status)) { printf("GetUserName failed - %s\n", nt_errstr(status)); - return False; + return false; } else { if (!r.out.account_name) { - return False; + return false; } if (strcmp(r.out.account_name->string, "ANONYMOUS LOGON") != 0) { printf("GetUserName returned wrong user: %s, expected %s\n", r.out.account_name->string, "ANONYMOUS LOGON"); - return False; + return false; } if (!r.out.authority_name || !r.out.authority_name->string) { - return False; + return false; } if (strcmp(r.out.authority_name->string->string, "NT AUTHORITY") != 0) { printf("GetUserName returned wrong user: %s, expected %s\n", r.out.authority_name->string->string, "NT AUTHORITY"); - return False; + return false; } } if (!test_many_LookupSids(p, tctx, NULL)) { printf("LsaLookupSids3 failed!\n"); - return False; + return false; } return ret; @@ -388,7 +388,7 @@ static bool test_schannel(struct torture_context *tctx, */ bool torture_rpc_schannel(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; struct { uint16_t acct_flags; uint32_t dcerpc_flags; diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 278228f731..9cc42241d2 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -874,12 +874,12 @@ static bool test_AddPort(struct torture_context *tctx, if (!W_ERROR_IS_OK(r.out.result)) { printf("AddPort failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } #endif - return True; + return true; } static bool test_GetJob(struct torture_context *tctx, @@ -987,7 +987,7 @@ static bool test_DoPrintTest(struct torture_context *tctx, struct dcerpc_pipe *p, struct policy_handle *handle) { - bool ret = True; + bool ret = true; NTSTATUS status; struct spoolss_StartDocPrinter s; struct spoolss_DocumentInfo1 info1; @@ -1211,7 +1211,7 @@ static bool test_EnumPrinterData(struct torture_context *tctx, struct dcerpc_pip } while (W_ERROR_IS_OK(r.out.result)); - return True; + return true; } static bool test_EnumPrinterDataEx(struct torture_context *tctx, @@ -1301,7 +1301,7 @@ static bool test_SecondaryClosePrinter(struct torture_context *tctx, /* only makes sense on SMB */ if (p->conn->transport.transport != NCACN_NP) { - return True; + return true; } torture_comment(tctx, "testing close on secondary pipe\n"); @@ -1387,7 +1387,7 @@ static bool test_OpenPrinter(struct torture_context *tctx, NTSTATUS status; struct spoolss_OpenPrinter r; struct policy_handle handle; - BOOL ret = True; + bool ret = true; r.in.printername = talloc_asprintf(tctx, "\\\\%s\\%s", dcerpc_server_name(p), name); r.in.datatype = NULL; @@ -1580,7 +1580,7 @@ static bool test_EnumPrinters_old(struct torture_context *tctx, struct dcerpc_pi } #if 0 -static BOOL test_GetPrinterDriver2(struct dcerpc_pipe *p, +static bool test_GetPrinterDriver2(struct dcerpc_pipe *p, struct policy_handle *handle, const char *driver_name) { @@ -1600,7 +1600,7 @@ static BOOL test_GetPrinterDriver2(struct dcerpc_pipe *p, status = dcerpc_spoolss_GetPrinterDriver2(p, tctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetPrinterDriver2 failed - %s\n", nt_errstr(status)); - return False; + return false; } if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { @@ -1611,16 +1611,16 @@ static BOOL test_GetPrinterDriver2(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("GetPrinterDriver2 failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!W_ERROR_IS_OK(r.out.result)) { printf("GetPrinterDriver2 failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } - return True; + return true; } #endif @@ -1706,12 +1706,12 @@ bool torture_rpc_spoolss(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct test_spoolss_context *ctx; status = torture_rpc_connection(torture, &p, &ndr_table_spoolss); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } ctx = talloc_zero(torture, struct test_spoolss_context); diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index b7e3b488c9..725799f2dd 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -341,7 +341,7 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name, } libnet_r->in.acct_type = acct_flags; - libnet_r->in.recreate_account = True; + libnet_r->in.recreate_account = true; status = libnet_JoinDomain(libnet_ctx, libnet_r, libnet_r); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/torture/rpc/unixinfo.c b/source4/torture/rpc/unixinfo.c index 2904e8b8df..cbe8cf0ff1 100644 --- a/source4/torture/rpc/unixinfo.c +++ b/source4/torture/rpc/unixinfo.c @@ -42,7 +42,7 @@ static bool test_sidtouid(struct torture_context *tctx, struct dcerpc_pipe *p) if (NT_STATUS_EQUAL(NT_STATUS_NONE_MAPPED, status)) { } else torture_assert_ntstatus_ok(tctx, status, "SidToUid failed"); - return True; + return true; } /* |