diff options
Diffstat (limited to 'source4/torture/basic')
-rw-r--r-- | source4/torture/basic/base.c | 250 | ||||
-rw-r--r-- | source4/torture/basic/delaywrite.c | 90 | ||||
-rw-r--r-- | source4/torture/basic/delete.c | 172 | ||||
-rw-r--r-- | source4/torture/basic/denytest.c | 36 | ||||
-rw-r--r-- | source4/torture/basic/dir.c | 20 | ||||
-rw-r--r-- | source4/torture/basic/disconnect.c | 24 | ||||
-rw-r--r-- | source4/torture/basic/locking.c | 114 | ||||
-rw-r--r-- | source4/torture/basic/mangle_test.c | 18 | ||||
-rw-r--r-- | source4/torture/basic/misc.c | 78 | ||||
-rw-r--r-- | source4/torture/basic/properties.c | 4 | ||||
-rw-r--r-- | source4/torture/basic/scanner.c | 52 | ||||
-rw-r--r-- | source4/torture/basic/secleak.c | 14 | ||||
-rw-r--r-- | source4/torture/basic/unlink.c | 2 | ||||
-rw-r--r-- | source4/torture/basic/utable.c | 2 |
14 files changed, 438 insertions, 438 deletions
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 303cbee62f..2c5f335503 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -68,12 +68,12 @@ failed: return NULL; } -static BOOL tcon_devtest(struct torture_context *tctx, +static bool tcon_devtest(struct torture_context *tctx, struct smbcli_state *cli, const char *myshare, const char *devtype, NTSTATUS expected_error) { - BOOL status; + bool status; const char *password = torture_setting_string(tctx, "password", NULL); status = NT_STATUS_IS_OK(smbcli_tconX(cli, myshare, devtype, @@ -158,13 +158,13 @@ static bool run_fdpasstest(struct torture_context *tctx, /** This checks how the getatr calls works */ -static BOOL run_attrtest(struct torture_context *tctx, +static bool run_attrtest(struct torture_context *tctx, struct smbcli_state *cli) { int fnum; time_t t, t2; const char *fname = "\\attrib123456789.tst"; - BOOL correct = True; + bool correct = true; smbcli_unlink(cli->tree, fname); fnum = smbcli_open(cli->tree, fname, @@ -173,7 +173,7 @@ static BOOL run_attrtest(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_getatr(cli->tree, fname, NULL, NULL, &t))) { torture_comment(tctx, "getatr failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } torture_comment(tctx, "New file time is %s", ctime(&t)); @@ -182,7 +182,7 @@ static BOOL run_attrtest(struct torture_context *tctx, torture_comment(tctx, "ERROR: SMBgetatr bug. time is %s", ctime(&t)); t = time(NULL); - correct = False; + correct = false; } t2 = t-60*60*24; /* 1 day ago */ @@ -191,12 +191,12 @@ static BOOL run_attrtest(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_setatr(cli->tree, fname, 0, t2))) { torture_comment(tctx, "setatr failed (%s)\n", smbcli_errstr(cli->tree)); - correct = True; + correct = true; } if (NT_STATUS_IS_ERR(smbcli_getatr(cli->tree, fname, NULL, NULL, &t))) { torture_comment(tctx, "getatr failed (%s)\n", smbcli_errstr(cli->tree)); - correct = True; + correct = true; } torture_comment(tctx, "Retrieved file time as %s", ctime(&t)); @@ -205,7 +205,7 @@ static BOOL run_attrtest(struct torture_context *tctx, torture_comment(tctx, "ERROR: getatr/setatr bug. times are\n%s", ctime(&t)); torture_comment(tctx, "%s", ctime(&t2)); - correct = True; + correct = true; } smbcli_unlink(cli->tree, fname); @@ -216,7 +216,7 @@ static BOOL run_attrtest(struct torture_context *tctx, /** This checks a couple of trans2 calls */ -static BOOL run_trans2test(struct torture_context *tctx, +static bool run_trans2test(struct torture_context *tctx, struct smbcli_state *cli) { int fnum; @@ -226,7 +226,7 @@ static BOOL run_trans2test(struct torture_context *tctx, const char *dname = "\\trans2"; const char *fname2 = "\\trans2\\trans2.tst"; const char *pname; - BOOL correct = True; + bool correct = true; smbcli_unlink(cli->tree, fname); @@ -237,20 +237,20 @@ static BOOL run_trans2test(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_qfileinfo(cli->tree, fnum, NULL, &size, &c_time, &a_time, &m_time, NULL, NULL))) { torture_comment(tctx, "ERROR: qfileinfo failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } torture_comment(tctx, "Testing NAME_INFO\n"); if (NT_STATUS_IS_ERR(smbcli_qfilename(cli->tree, fnum, &pname))) { torture_comment(tctx, "ERROR: qfilename failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } if (!pname || strcmp(pname, fname)) { torture_comment(tctx, "qfilename gave different name? [%s] [%s]\n", fname, pname); - correct = False; + correct = false; } smbcli_close(cli->tree, fnum); @@ -260,7 +260,7 @@ static BOOL run_trans2test(struct torture_context *tctx, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); if (fnum == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } smbcli_close(cli->tree, fnum); @@ -268,7 +268,7 @@ static BOOL run_trans2test(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_qpathinfo(cli->tree, fname, &c_time, &a_time, &m_time, &size, NULL))) { torture_comment(tctx, "ERROR: qpathinfo failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } else { if (c_time != m_time) { torture_comment(tctx, "create time=%s", ctime(&c_time)); @@ -278,12 +278,12 @@ static BOOL run_trans2test(struct torture_context *tctx, if (a_time % (60*60) == 0) { torture_comment(tctx, "access time=%s", ctime(&a_time)); torture_comment(tctx, "This system appears to set a midnight access time\n"); - correct = False; + correct = false; } if (abs(m_time - time(NULL)) > 60*60*24*7) { torture_comment(tctx, "ERROR: totally incorrect times - maybe word reversed? mtime=%s", ctime(&m_time)); - correct = False; + correct = false; } } @@ -294,12 +294,12 @@ static BOOL run_trans2test(struct torture_context *tctx, smbcli_close(cli->tree, fnum); if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, fname, &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) { torture_comment(tctx, "ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } else { if (w_time < 60*60*24*2) { torture_comment(tctx, "write time=%s", ctime(&w_time)); torture_comment(tctx, "This system appears to set a initial 0 write time\n"); - correct = False; + correct = false; } } @@ -310,12 +310,12 @@ static BOOL run_trans2test(struct torture_context *tctx, when creating a new file */ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, dname))) { torture_comment(tctx, "ERROR: mkdir failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } sleep(3); if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) { torture_comment(tctx, "ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } fnum = smbcli_open(cli->tree, fname2, @@ -324,11 +324,11 @@ static BOOL run_trans2test(struct torture_context *tctx, smbcli_close(cli->tree, fnum); if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) { torture_comment(tctx, "ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } else { if (m_time2 == m_time) { torture_comment(tctx, "This system does not update directory modification times\n"); - correct = False; + correct = false; } } smbcli_unlink(cli->tree, fname2); @@ -338,17 +338,17 @@ static BOOL run_trans2test(struct torture_context *tctx, } /* send smb negprot commands, not reading the response */ -static BOOL run_negprot_nowait(struct torture_context *tctx) +static bool run_negprot_nowait(struct torture_context *tctx) { int i; struct smbcli_state *cli, *cli2; - BOOL correct = True; + bool correct = true; torture_comment(tctx, "starting negprot nowait test\n"); cli = open_nbt_connection(tctx); if (!cli) { - return False; + return false; } torture_comment(tctx, "Filling send buffer\n"); @@ -364,7 +364,7 @@ static BOOL run_negprot_nowait(struct torture_context *tctx) } else { torture_comment(tctx, "Failed to fill pipe - %s \n", nt_errstr(req->status)); torture_close_connection(cli); - return False; + return false; } } } @@ -372,12 +372,12 @@ static BOOL run_negprot_nowait(struct torture_context *tctx) torture_comment(tctx, "Opening secondary connection\n"); if (!torture_open_connection(&cli2, 1)) { torture_comment(tctx, "Failed to open secondary connection\n"); - correct = False; + correct = false; } if (!torture_close_connection(cli2)) { torture_comment(tctx, "Failed to close secondary connection\n"); - correct = False; + correct = false; } torture_close_connection(cli); @@ -389,14 +389,14 @@ static BOOL run_negprot_nowait(struct torture_context *tctx) this checks to see if a secondary tconx can use open files from an earlier tconx */ -static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli) +static bool run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli) { const char *fname = "\\tcontest.tmp"; int fnum1; uint16_t cnum1, cnum2, cnum3; uint16_t vuid1, vuid2; uint8_t buf[4]; - BOOL ret = True; + bool ret = true; struct smbcli_tree *tree1; const char *host = torture_setting_string(tctx, "host", NULL); const char *share = torture_setting_string(tctx, "share", NULL); @@ -409,7 +409,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } cnum1 = cli->tree->tid; @@ -418,7 +418,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli memset(&buf, 0, 4); /* init buf so valgrind won't complain */ if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) != 4) { torture_comment(tctx, "initial write failed (%s)\n", smbcli_errstr(cli->tree)); - return False; + return false; } tree1 = cli->tree; /* save old tree connection */ @@ -426,7 +426,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli torture_comment(tctx, "%s refused 2nd tree connect (%s)\n", host, smbcli_errstr(cli->tree)); talloc_free(cli); - return False; + return false; } cnum2 = cli->tree->tid; @@ -438,7 +438,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) { torture_comment(tctx, "* server allows write with wrong TID\n"); - ret = False; + ret = false; } else { torture_comment(tctx, "server fails write with wrong TID : %s\n", smbcli_errstr(cli->tree)); } @@ -449,7 +449,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) { torture_comment(tctx, "* server allows write with invalid TID\n"); - ret = False; + ret = false; } else { torture_comment(tctx, "server fails write with invalid TID : %s\n", smbcli_errstr(cli->tree)); } @@ -460,7 +460,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) { torture_comment(tctx, "* server allows write with invalid VUID\n"); - ret = False; + ret = false; } else { torture_comment(tctx, "server fails write with invalid VUID : %s\n", smbcli_errstr(cli->tree)); } @@ -470,14 +470,14 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum1))) { torture_comment(tctx, "close failed (%s)\n", smbcli_errstr(cli->tree)); - return False; + return false; } cli->tree->tid = cnum2; if (NT_STATUS_IS_ERR(smbcli_tdis(cli))) { torture_comment(tctx, "secondary tdis failed (%s)\n", smbcli_errstr(cli->tree)); - return False; + return false; } cli->tree = tree1; /* restore initial tree */ @@ -491,7 +491,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli /** checks for correct tconX support */ -static BOOL run_tcon_devtype_test(struct torture_context *tctx, +static bool run_tcon_devtype_test(struct torture_context *tctx, struct smbcli_state *cli1) { const char *share = torture_setting_string(tctx, "share", NULL); @@ -529,7 +529,7 @@ static BOOL run_tcon_devtype_test(struct torture_context *tctx, return true; } -static BOOL rw_torture2(struct torture_context *tctx, +static bool rw_torture2(struct torture_context *tctx, struct smbcli_state *c1, struct smbcli_state *c2) { const char *lockfname = "\\torture2.lck"; @@ -538,7 +538,7 @@ static BOOL rw_torture2(struct torture_context *tctx, int i; uint8_t buf[131072]; uint8_t buf_rd[131072]; - BOOL correct = True; + bool correct = true; ssize_t bytes_read, bytes_written; torture_assert(tctx, smbcli_deltree(c1->tree, lockfname) != -1, @@ -575,14 +575,14 @@ static BOOL rw_torture2(struct torture_context *tctx, if ((bytes_written = smbcli_write(c1->tree, fnum1, 0, buf, 0, buf_size)) != buf_size) { torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(c1->tree)); torture_comment(tctx, "wrote %d, expected %d\n", (int)bytes_written, (int)buf_size); - correct = False; + correct = false; break; } if ((bytes_read = smbcli_read(c2->tree, fnum2, buf_rd, 0, buf_size)) != buf_size) { torture_comment(tctx, "read failed (%s)\n", smbcli_errstr(c2->tree)); torture_comment(tctx, "read %d, expected %d\n", (int)bytes_read, (int)buf_size); - correct = False; + correct = false; break; } @@ -624,16 +624,16 @@ static bool run_readwritetest(struct torture_context *tctx, /* test the timing of deferred open requests */ -static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli, int dummy) +static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli, int dummy) { const char *fname = "\\defer_open_test.dat"; int retries=4; int i = 0; - BOOL correct = True; + bool correct = true; if (retries <= 0) { torture_comment(tctx, "failed to connect\n"); - return False; + return false; } torture_comment(tctx, "Testing deferred open requests.\n"); @@ -663,7 +663,7 @@ static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli if (fnum == -1) { torture_comment(tctx,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } torture_comment(tctx, "pid %u open %d\n", (unsigned)getpid(), i); @@ -672,7 +672,7 @@ static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli i++; if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) { torture_comment(tctx,"Failed to close %s, error=%s\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } sleep(2); } @@ -681,7 +681,7 @@ static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli /* All until the last unlink will fail with sharing violation. */ if (!NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) { torture_comment(tctx, "unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - correct = False; + correct = false; } } @@ -693,7 +693,7 @@ static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli Try with a wrong vuid and check error message. */ -static BOOL run_vuidtest(struct torture_context *tctx, +static bool run_vuidtest(struct torture_context *tctx, struct smbcli_state *cli) { const char *fname = "\\vuid.tst"; @@ -744,7 +744,7 @@ static BOOL run_vuidtest(struct torture_context *tctx, /* Test open mode returns on read-only files. */ - static BOOL run_opentest(struct torture_context *tctx, struct smbcli_state *cli1, + static bool run_opentest(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2) { const char *fname = "\\readonly.file"; @@ -752,7 +752,7 @@ static BOOL run_vuidtest(struct torture_context *tctx, int fnum1, fnum2; uint8_t buf[20]; size_t fsize; - BOOL correct = True; + bool correct = true; char *tmp_path; int failures = 0; int i; @@ -787,25 +787,25 @@ static BOOL run_vuidtest(struct torture_context *tctx, fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "close2 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0))) { torture_comment(tctx, "smbcli_setatr failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test1); - return False; + return false; } fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE); if (fnum1 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test1); - return False; + return false; } /* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */ @@ -827,7 +827,7 @@ error_test1: fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE); if (fnum1 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } /* This will fail - but the error should be ERRshare. */ @@ -840,7 +840,7 @@ error_test1: if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "close2 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } smbcli_unlink(cli1->tree, fname); @@ -852,7 +852,7 @@ error_test1: fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "(3) open (1) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } /* write 20 bytes. */ @@ -861,25 +861,25 @@ error_test1: if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) { torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(cli1->tree)); - correct = False; + correct = false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "(3) close1 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } /* Ensure size == 20. */ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { torture_comment(tctx, "(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } if (fsize != 20) { torture_comment(tctx, "(3) file size != 20\n"); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } /* Now test if we can truncate a file opened for readonly. */ @@ -888,25 +888,25 @@ error_test1: if (fnum1 == -1) { torture_comment(tctx, "(3) open (2) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "close2 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } /* Ensure size == 0. */ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { torture_comment(tctx, "(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } if (fsize != 0) { torture_comment(tctx, "(3) file size != 0\n"); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } torture_comment(tctx, "finished open test 3\n"); error_test3: @@ -918,7 +918,7 @@ error_test3: if (fnum1 == -1) { torture_comment(tctx, "ctemp failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test4); - return False; + return false; } torture_comment(tctx, "ctemp gave path %s\n", tmp_path); if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { @@ -941,7 +941,7 @@ error_test4: if (fnum1 == -1) { torture_comment(tctx, "test 1 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test10); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -949,16 +949,16 @@ error_test4: if (fnum2 == -1) { torture_comment(tctx, "test 1 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test10); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #1 passed.\n"); @@ -973,7 +973,7 @@ error_test10: if (fnum1 == -1) { torture_comment(tctx, "test 2 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test20); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -982,16 +982,16 @@ error_test10: if (fnum2 == -1) { torture_comment(tctx, "test 2 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test20); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #2 passed.\n"); @@ -1006,7 +1006,7 @@ error_test20: if (fnum1 == -1) { torture_comment(tctx, "test 3 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test30); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1015,16 +1015,16 @@ error_test20: if (fnum2 == -1) { torture_comment(tctx, "test 3 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test30); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 3 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 3 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #3 passed.\n"); @@ -1039,7 +1039,7 @@ error_test30: if (fnum1 == -1) { torture_comment(tctx, "test 4 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test40); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1048,14 +1048,14 @@ error_test30: if (fnum2 != -1) { torture_comment(tctx, "test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test40); - return False; + return false; } torture_comment(tctx, "test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation"); if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 4 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #4 passed.\n"); @@ -1070,7 +1070,7 @@ error_test40: if (fnum1 == -1) { torture_comment(tctx, "test 5 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test50); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1079,17 +1079,17 @@ error_test40: if (fnum2 == -1) { torture_comment(tctx, "test 5 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test50); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 5 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 5 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #5 passed.\n"); @@ -1104,7 +1104,7 @@ error_test50: if (fnum1 == -1) { torture_comment(tctx, "test 6 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test60); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1113,17 +1113,17 @@ error_test50: if (fnum2 == -1) { torture_comment(tctx, "test 6 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test60); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 6 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 6 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #6 passed.\n"); @@ -1138,7 +1138,7 @@ error_test60: if (fnum1 == -1) { torture_comment(tctx, "test 7 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test70); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1147,14 +1147,14 @@ error_test60: if (fnum2 != -1) { torture_comment(tctx, "test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test70); - return False; + return false; } torture_comment(tctx, "test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation"); if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 7 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #7 passed.\n"); @@ -1168,7 +1168,7 @@ error_test70: fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "(8) open (1) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } /* write 20 bytes. */ @@ -1177,56 +1177,56 @@ error_test70: if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) { torture_comment(tctx, "(8) write failed (%s)\n", smbcli_errstr(cli1->tree)); - correct = False; + correct = false; } /* Ensure size == 20. */ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { torture_comment(tctx, "(8) getatr (1) failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } if (fsize != 20) { torture_comment(tctx, "(8) file size != 20\n"); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } /* Get an exclusive lock on the open file. */ if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) { torture_comment(tctx, "(8) lock1 failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } fnum2 = smbcli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "(8) open (2) of %s with truncate failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } /* Ensure size == 0. */ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { torture_comment(tctx, "(8) getatr (2) failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } if (fsize != 0) { torture_comment(tctx, "(8) file size != 0\n"); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "(8) close1 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) { torture_comment(tctx, "(8) close1 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } error_test80: @@ -1315,7 +1315,7 @@ static bool run_iometer(struct torture_context *tctx, ops = 0; - while (True) { + while (true) { int i, num_reads, num_writes; num_reads = random() % 10; @@ -1351,11 +1351,11 @@ static bool run_iometer(struct torture_context *tctx, /** tries variants of chkpath */ -static BOOL torture_chkpath_test(struct torture_context *tctx, +static bool torture_chkpath_test(struct torture_context *tctx, struct smbcli_state *cli) { int fnum; - BOOL ret; + bool ret; torture_comment(tctx, "Testing valid and invalid paths\n"); @@ -1366,29 +1366,29 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\chkpath.dir"))) { torture_comment(tctx, "mkdir1 failed : %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\chkpath.dir\\dir2"))) { torture_comment(tctx, "mkdir2 failed : %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } fnum = smbcli_open(cli->tree, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { torture_comment(tctx, "open1 failed (%s)\n", smbcli_errstr(cli->tree)); - return False; + return false; } smbcli_close(cli->tree, fnum); if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir"))) { torture_comment(tctx, "chkpath1 failed: %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; } if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\dir2"))) { torture_comment(tctx, "chkpath2 failed: %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; } if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\foo.txt"))) { @@ -1396,7 +1396,7 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, NT_STATUS_NOT_A_DIRECTORY); } else { torture_comment(tctx, "* chkpath on a file should fail\n"); - ret = False; + ret = false; } if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\bar.txt"))) { @@ -1404,7 +1404,7 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, NT_STATUS_OBJECT_NAME_NOT_FOUND); } else { torture_comment(tctx, "* chkpath on a non existent file should fail\n"); - ret = False; + ret = false; } if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\dirxx\\bar.txt"))) { @@ -1412,7 +1412,7 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, NT_STATUS_OBJECT_PATH_NOT_FOUND); } else { torture_comment(tctx, "* chkpath on a non existent component should fail\n"); - ret = False; + ret = false; } smbcli_rmdir(cli->tree, "\\chkpath.dir\\dir2"); @@ -1426,11 +1426,11 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, * This is a test to excercise some weird Samba3 error paths. */ -static BOOL torture_samba3_errorpaths(struct torture_context *tctx) +static bool torture_samba3_errorpaths(struct torture_context *tctx) { - BOOL nt_status_support; + bool nt_status_support; struct smbcli_state *cli_nt = NULL, *cli_dos = NULL; - BOOL result = False; + bool result = false; int fnum; const char *os2_fname = ".+,;=[]."; const char *dname = "samba3_errordir"; @@ -1440,7 +1440,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) if (mem_ctx == NULL) { torture_comment(tctx, "talloc_init failed\n"); - return False; + return false; } nt_status_support = lp_nt_status_support(global_loadparm); @@ -1634,7 +1634,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) torture_comment(tctx, "ntcreate as dir gave %s, " "expected NT_STATUS_NOT_A_DIRECTORY\n", nt_errstr(status)); - result = False; + result = false; } if (NT_STATUS_IS_OK(status)) { @@ -1647,7 +1647,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) torture_comment(tctx, "ntcreate as dir gave %s, " "expected NT_STATUS_NOT_A_DIRECTORY\n", nt_errstr(status)); - result = False; + result = false; } if (NT_STATUS_IS_OK(status)) { @@ -1658,7 +1658,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) smbcli_unlink(cli_nt->tree, fname); } - if (!torture_setting_bool(tctx, "samba3", False)) { + if (!torture_setting_bool(tctx, "samba3", false)) { goto done; } @@ -1697,7 +1697,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) } done: - result = True; + result = true; fail: if (cli_dos != NULL) { diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 289e08ae59..8928754e1a 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -31,24 +31,24 @@ #define BASEDIR "\\delaywrite" -static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcli_state *cli) +static bool test_delayed_write_update(struct torture_context *tctx, struct smbcli_state *cli) { union smb_fileinfo finfo1, finfo2; const char *fname = BASEDIR "\\torture_file.txt"; NTSTATUS status; int fnum1 = -1; - BOOL ret = True; + bool ret = true; ssize_t written; time_t t; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "Failed to open %s\n", fname); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -59,7 +59,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "Initial write time %s\n", @@ -74,7 +74,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl if (written != 1) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } t = time(NULL); @@ -84,7 +84,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -100,7 +100,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { torture_comment(tctx, "Server did not update write time?!\n"); - ret = False; + ret = false; } @@ -116,7 +116,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl * Do as above, but using 2 connections. */ -static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbcli_state *cli, +static bool test_delayed_write_update2(struct torture_context *tctx, struct smbcli_state *cli, struct smbcli_state *cli2) { union smb_fileinfo finfo1, finfo2; @@ -124,19 +124,19 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc NTSTATUS status; int fnum1 = -1; int fnum2 = -1; - BOOL ret = True; + bool ret = true; ssize_t written; time_t t; union smb_flush flsh; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "Failed to open %s\n", fname); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -147,7 +147,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "Initial write time %s\n", @@ -180,7 +180,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("sfileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } } @@ -193,7 +193,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -209,7 +209,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { torture_comment(tctx, "Server did not update write time?!\n"); - ret = False; + ret = false; } /* Now try a write to see if the write time gets reset. */ @@ -222,7 +222,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "Modified write time %s\n", @@ -236,7 +236,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (written != 10) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } /* Just to prove to tridge that the an smbflush has no effect on @@ -249,7 +249,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc status = smb_raw_flush(cli->tree, &flsh); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("smbflush failed: %s\n", nt_errstr(status))); - return False; + return false; } t = time(NULL); @@ -262,7 +262,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -283,7 +283,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE); if (fnum2 == -1) { torture_comment(tctx, "Failed to open %s\n", fname); - return False; + return false; } torture_comment(tctx, "Doing a 10 byte write to extend the file via second fd and see if this changes the last write time.\n"); @@ -293,14 +293,14 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (written != 10) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } status = smb_raw_fileinfo(cli->tree, tctx, &finfo2); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); @@ -319,7 +319,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (written != 10) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -329,7 +329,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); @@ -347,7 +347,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -373,7 +373,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc fnum1 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "Failed to open %s\n", fname); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -384,7 +384,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "Second open initial write time %s\n", @@ -398,7 +398,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (written != 10) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -408,7 +408,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); @@ -426,7 +426,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -468,7 +468,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc * nasty.... */ -static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_state *cli, +static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_state *cli, struct smbcli_state *cli2) { union smb_fileinfo finfo1, finfo2; @@ -476,16 +476,16 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s NTSTATUS status; int fnum1 = -1; int fnum2; - BOOL ret = True; + bool ret = true; ssize_t written; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { - ret = False; + ret = false; torture_result(tctx, TORTURE_FAIL, __location__": unable to open %s", fname); goto done; } @@ -496,7 +496,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s status = smb_raw_fileinfo(cli->tree, tctx, &finfo1); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; torture_result(tctx, TORTURE_FAIL, __location__": fileinfo failed: %s", nt_errstr(status)); goto done; } @@ -507,7 +507,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (written != 1) { torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written); - ret = False; + ret = false; goto done; } @@ -515,7 +515,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (fnum2 == -1) { torture_result(tctx, TORTURE_FAIL, __location__": failed to open 2nd time - %s", smbcli_errstr(cli2->tree)); - ret = False; + ret = false; goto done; } @@ -524,7 +524,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (written != 1) { torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written); - ret = False; + ret = false; goto done; } @@ -536,21 +536,21 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (!NT_STATUS_IS_OK(status)) { torture_result(tctx, TORTURE_FAIL, __location__": fileinfo failed: %s", nt_errstr(status)); - ret = False; + ret = false; goto done; } if (finfo1.basic_info.out.create_time != finfo2.basic_info.out.create_time) { torture_result(tctx, TORTURE_FAIL, __location__": create_time changed"); - ret = False; + ret = false; goto done; } if (finfo1.basic_info.out.access_time != finfo2.basic_info.out.access_time) { torture_result(tctx, TORTURE_FAIL, __location__": access_time changed"); - ret = False; + ret = false; goto done; } @@ -560,14 +560,14 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s "write time conn 1 = %s, conn 2 = %s", nt_time_string(tctx, finfo1.basic_info.out.write_time), nt_time_string(tctx, finfo2.basic_info.out.write_time)); - ret = False; + ret = false; goto done; } if (finfo1.basic_info.out.change_time != finfo2.basic_info.out.change_time) { torture_result(tctx, TORTURE_FAIL, __location__": change_time changed"); - ret = False; + ret = false; goto done; } @@ -587,7 +587,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (!NT_STATUS_IS_OK(status)) { torture_result(tctx, TORTURE_FAIL, __location__": fileinfo failed: %s", nt_errstr(status)); - ret = False; + ret = false; goto done; } diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c index 93b282272f..38528cd845 100644 --- a/source4/torture/basic/delete.c +++ b/source4/torture/basic/delete.c @@ -144,7 +144,7 @@ static bool deltest1(struct torture_context *tctx, struct smbcli_state *cli1, st torture_assert(tctx, fnum1 == -1, talloc_asprintf(tctx, "open of %s succeeded (should fail)", fname)); - return True; + return true; } /* Test 2 - this should delete the file on close. */ @@ -163,7 +163,7 @@ static bool deltest2(struct torture_context *tctx, struct smbcli_state *cli1, st talloc_asprintf(tctx, "open of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); @@ -178,7 +178,7 @@ static bool deltest2(struct torture_context *tctx, struct smbcli_state *cli1, st if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { printf("(%s) close failed (%s)\n", __location__, smbcli_errstr(cli1->tree)); - return False; + return false; } smbcli_unlink(cli1->tree, fname); } @@ -227,7 +227,7 @@ static bool deltest3(struct torture_context *tctx, struct smbcli_state *cli1, st fname, smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + smbcli_nt_delete_on_close(cli1->tree, fnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); @@ -250,9 +250,9 @@ static bool deltest3(struct torture_context *tctx, struct smbcli_state *cli1, st __location__, smbcli_errstr(cli1->tree)); } smbcli_unlink(cli1->tree, fname); - return False; + return false; } - return True; + return true; } /* Test 4 ... */ @@ -260,7 +260,7 @@ static bool deltest4(struct torture_context *tctx, struct smbcli_state *cli1, st { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -292,7 +292,7 @@ static bool deltest4(struct torture_context *tctx, struct smbcli_state *cli1, st smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + smbcli_nt_delete_on_close(cli1->tree, fnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); @@ -328,13 +328,13 @@ static bool deltest5(struct torture_context *tctx, struct smbcli_state *cli1, st /* This should fail - only allowed on NT opens with DELETE access. */ - torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, True)), + torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, true)), "setting delete_on_close on OpenX file succeeded - should fail !"); torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close - 2 failed (%s)", smbcli_errstr(cli1->tree))); - return True; + return true; } /* Test 6 ... */ @@ -358,7 +358,7 @@ static bool deltest6(struct torture_context *tctx, struct smbcli_state *cli1, st /* This should fail - only allowed on NT opens with DELETE access. */ torture_assert(tctx, - !NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, True)), + !NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, true)), "setting delete_on_close on file with no delete access succeeded - should fail !"); torture_assert_ntstatus_ok(tctx, @@ -366,14 +366,14 @@ static bool deltest6(struct torture_context *tctx, struct smbcli_state *cli1, st talloc_asprintf(tctx, "close - 2 failed (%s)", smbcli_errstr(cli1->tree))); - return True; + return true; } /* Test 7 ... */ static bool deltest7(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2) { int fnum1 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -387,16 +387,16 @@ static bool deltest7(struct torture_context *tctx, struct smbcli_state *cli1, st torture_assert(tctx, fnum1 != -1, talloc_asprintf(tctx, "open of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, true), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, true, __location__); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, False), + smbcli_nt_delete_on_close(cli1->tree, fnum1, false), "unsetting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close - 2 failed (%s)", smbcli_errstr(cli1->tree))); @@ -419,7 +419,7 @@ static bool deltest8(struct torture_context *tctx, struct smbcli_state *cli1, st { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -447,18 +447,18 @@ static bool deltest8(struct torture_context *tctx, struct smbcli_state *cli1, st fname, smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + smbcli_nt_delete_on_close(cli1->tree, fnum1, true), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, True, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, true, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, true, __location__); torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close - 1 failed (%s)", smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, -1, fname, True, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, -1, fname, true, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, true, __location__); torture_assert_ntstatus_ok(tctx, smbcli_close(cli2->tree, fnum2), talloc_asprintf(tctx, "close - 2 failed (%s)", smbcli_errstr(cli2->tree))); @@ -490,7 +490,7 @@ static bool deltest9(struct torture_context *tctx, struct smbcli_state *cli1, st talloc_asprintf(tctx, "open of %s succeeded should have failed!", fname)); - return True; + return true; } /* Test 10 ... */ @@ -544,7 +544,7 @@ static bool deltest11(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, fnum1 != -1, talloc_asprintf(tctx, "open of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - status = smbcli_nt_delete_on_close(cli1->tree, fnum1, True); + status = smbcli_nt_delete_on_close(cli1->tree, fnum1, true); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_CANNOT_DELETE, talloc_asprintf(tctx, "setting delete_on_close should fail with NT_STATUS_CANNOT_DELETE. Got %s instead)", smbcli_errstr(cli1->tree))); @@ -553,7 +553,7 @@ static bool deltest11(struct torture_context *tctx, struct smbcli_state *cli1, s talloc_asprintf(tctx, "close failed (%s)", smbcli_errstr(cli1->tree))); - return True; + return true; } /* Test 12 ... */ @@ -593,7 +593,7 @@ static bool deltest13(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -631,18 +631,18 @@ static bool deltest13(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, - True), + true), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, True, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, true, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, true, __location__); torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli2->tree, fnum2, - False), + false), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close - 1 failed (%s)", @@ -684,10 +684,10 @@ static bool deltest14(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, dnum1 != -1, talloc_asprintf(tctx, "open of %s failed: %s!", dname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, dnum1, dname, False, __location__); - torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, dnum1, True), + correct &= check_delete_on_close(tctx, cli1, dnum1, dname, false, __location__); + torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, dnum1, true), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, dnum1, dname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, dnum1, dname, true, __location__); smbcli_close(cli1->tree, dnum1); /* Now it should be gone... */ @@ -751,7 +751,7 @@ static bool deltest15(struct torture_context *tctx, struct smbcli_state *cli1, s talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname_new, smbcli_errstr(cli1->tree))); - status = smbcli_nt_delete_on_close(cli2->tree, fnum2, True); + status = smbcli_nt_delete_on_close(cli2->tree, fnum2, true); torture_assert_ntstatus_ok(tctx, status, "setting delete_on_close on file failed !"); @@ -761,7 +761,7 @@ static bool deltest15(struct torture_context *tctx, struct smbcli_state *cli1, s /* The file should be around under the new name, there's a second * handle open */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname_new, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname_new, true, __location__); fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_GENERIC_ALL, @@ -775,7 +775,7 @@ static bool deltest15(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, fnum2 != -1, talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); smbcli_close(cli2->tree, fnum2); smbcli_close(cli1->tree, fnum1); @@ -840,11 +840,11 @@ static bool deltest16(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert (tctx, fnum1 != -1, talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, -1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, -1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, -1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, -1, fname, false, __location__); /* Now try opening again for read-only. */ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, @@ -860,15 +860,15 @@ static bool deltest16(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, fnum2 != -1, talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli1, -1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, -1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli1, -1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, -1, fname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, True, __location__); - correct &= check_delete_on_close(tctx, cli2, -1, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, true, __location__); + correct &= check_delete_on_close(tctx, cli2, -1, fname, true, __location__); smbcli_close(cli2->tree, fnum2); @@ -885,7 +885,7 @@ static bool deltest17(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -926,7 +926,7 @@ static bool deltest17(struct torture_context *tctx, struct smbcli_state *cli1, s fname, smbcli_errstr(cli1->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); /* Now try opening again for read-only. */ fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, @@ -944,12 +944,12 @@ static bool deltest17(struct torture_context *tctx, struct smbcli_state *cli1, s fname, smbcli_errstr(cli1->tree))); /* still not reported as being set on either */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli1, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, fname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli1, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, fname, false, __location__); smbcli_close(cli1->tree, fnum2); @@ -966,7 +966,7 @@ static bool deltest18(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -994,7 +994,7 @@ static bool deltest18(struct torture_context *tctx, struct smbcli_state *cli1, s dname, smbcli_errstr(cli1->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, dname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, dname, false, __location__); /* Now try opening again for read-only. */ fnum2 = smbcli_nt_create_full(cli1->tree, dname, 0, @@ -1011,12 +1011,12 @@ static bool deltest18(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, fnum2 != -1, talloc_asprintf(tctx, "open - 1 of %s failed (%s)", dname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, fnum1, dname, False, __location__); - correct &= check_delete_on_close(tctx, cli1, fnum2, dname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, dname, false, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, dname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli1, fnum2, dname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, dname, true, __location__); smbcli_close(cli1->tree, fnum2); @@ -1040,7 +1040,7 @@ static bool deltest19(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -1082,7 +1082,7 @@ static bool deltest19(struct torture_context *tctx, struct smbcli_state *cli1, s talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, dname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, dname, false, __location__); /* Now try opening again for read-only. */ fnum2 = smbcli_nt_create_full(cli1->tree, dname, 0, @@ -1100,7 +1100,7 @@ static bool deltest19(struct torture_context *tctx, struct smbcli_state *cli1, s smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli1, fnum2, dname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, dname, true, __location__); smbcli_close(cli1->tree, fnum2); @@ -1127,15 +1127,15 @@ static bool deltest20(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int dnum1 = -1; - bool correct = True; + bool correct = true; NTSTATUS status; del_clean_area(cli1, cli2); /* Test 20 -- non-empty directory hardest to get right... */ - if (torture_setting_bool(tctx, "samba3", False)) { - return True; + if (torture_setting_bool(tctx, "samba3", false)) { + return true; } smbcli_deltree(cli1->tree, dname); @@ -1153,8 +1153,8 @@ static bool deltest20(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, dnum1 != -1, talloc_asprintf(tctx, "open of %s failed: %s!", dname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, dnum1, dname, False, __location__); - status = smbcli_nt_delete_on_close(cli1->tree, dnum1, True); + correct &= check_delete_on_close(tctx, cli1, dnum1, dname, false, __location__); + status = smbcli_nt_delete_on_close(cli1->tree, dnum1, true); { char *fullname; @@ -1172,7 +1172,7 @@ static bool deltest20(struct torture_context *tctx, struct smbcli_state *cli1, s "smbcli_open failed"); } - status = smbcli_nt_delete_on_close(cli1->tree, dnum1, False); + status = smbcli_nt_delete_on_close(cli1->tree, dnum1, false); torture_assert_ntstatus_ok(tctx, status, "setting delete_on_close on file failed !"); @@ -1187,7 +1187,7 @@ static bool deltest20(struct torture_context *tctx, struct smbcli_state *cli1, s smbcli_close(cli1->tree, fnum1); } - status = smbcli_nt_delete_on_close(cli1->tree, dnum1, True); + status = smbcli_nt_delete_on_close(cli1->tree, dnum1, true); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_DIRECTORY_NOT_EMPTY, "setting delete_on_close failed"); @@ -1201,7 +1201,7 @@ static bool deltest20a(struct torture_context *tctx, struct smbcli_state *cli1, { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -1239,12 +1239,12 @@ static bool deltest20a(struct torture_context *tctx, struct smbcli_state *cli1, fname, smbcli_errstr(cli2->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); smbcli_close(cli2->tree, fnum2); @@ -1267,7 +1267,7 @@ static bool deltest20b(struct torture_context *tctx, struct smbcli_state *cli1, { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -1322,12 +1322,12 @@ static bool deltest20b(struct torture_context *tctx, struct smbcli_state *cli1, fname, smbcli_errstr(cli2->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); /* Rename the file by handle. */ @@ -1349,7 +1349,7 @@ static bool deltest20b(struct torture_context *tctx, struct smbcli_state *cli1, fname, fname_new, smbcli_errstr(cli2->tree))); } - correct &= check_delete_on_close(tctx, cli2, fnum2, fname_new, False, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname_new, false, __location__); smbcli_close(cli2->tree, fnum2); @@ -1371,13 +1371,13 @@ static bool deltest21(struct torture_context *tctx) int fnum1 = -1; struct smbcli_state *cli1; struct smbcli_state *cli2; - bool correct = True; + bool correct = true; if (!torture_open_connection(&cli1, 0)) - return False; + return false; if (!torture_open_connection(&cli2, 1)) - return False; + return false; del_clean_area(cli1, cli2); @@ -1392,12 +1392,12 @@ static bool deltest21(struct torture_context *tctx) fname, smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + smbcli_nt_delete_on_close(cli1->tree, fnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); /* Ensure delete on close is set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, true, __location__); /* Now yank the rug from under cli1. */ smbcli_transport_dead(cli1->transport, NT_STATUS_LOCAL_DISCONNECT); @@ -1405,7 +1405,7 @@ static bool deltest21(struct torture_context *tctx) fnum1 = -1; if (!torture_open_connection(&cli1, 0)) { - return False; + return false; } /* On slow build farm machines it might happen that they are not fast @@ -1438,10 +1438,10 @@ static bool deltest22(struct torture_context *tctx) int dnum1 = -1; int dnum2 = -1; struct smbcli_state *cli1; - bool correct = True; + bool correct = true; if (!torture_open_connection(&cli1, 0)) - return False; + return false; smbcli_deltree(cli1->tree, dname); @@ -1480,7 +1480,7 @@ static bool deltest22(struct torture_context *tctx) dname, smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok( - tctx, smbcli_nt_delete_on_close(cli1->tree, dnum1, True), + tctx, smbcli_nt_delete_on_close(cli1->tree, dnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c index 7709ccebca..bc64d4b2ff 100644 --- a/source4/torture/basic/denytest.c +++ b/source4/torture/basic/denytest.c @@ -1415,7 +1415,7 @@ bool torture_denytest1(struct torture_context *tctx, { int fnum1, fnum2; int i; - BOOL correct = True; + bool correct = true; struct timeval tv, tv_start; const char *fnames[2] = {"\\denytest1.dat", "\\denytest1.exe"}; int failures=0; @@ -1461,7 +1461,7 @@ bool torture_denytest1(struct torture_context *tctx, } } - if (torture_setting_bool(tctx, "showall", False) || + if (torture_setting_bool(tctx, "showall", false) || res != denytable1[i].result) { int64_t tdif; GetTimeOfDay(&tv); @@ -1479,7 +1479,7 @@ bool torture_denytest1(struct torture_context *tctx, } if (res != denytable1[i].result) { - correct = False; + correct = false; CHECK_MAX_FAILURES(failed); } @@ -1506,7 +1506,7 @@ bool torture_denytest2(struct torture_context *tctx, { int fnum1, fnum2; int i; - BOOL correct = True; + bool correct = true; const char *fnames[2] = {"\\denytest2.dat", "\\denytest2.exe"}; struct timeval tv, tv_start; int failures=0; @@ -1548,7 +1548,7 @@ bool torture_denytest2(struct torture_context *tctx, } } - if (torture_setting_bool(tctx, "showall", False) || + if (torture_setting_bool(tctx, "showall", false) || res != denytable2[i].result) { int64_t tdif; GetTimeOfDay(&tv); @@ -1566,7 +1566,7 @@ bool torture_denytest2(struct torture_context *tctx, } if (res != denytable2[i].result) { - correct = False; + correct = false; CHECK_MAX_FAILURES(failed); } @@ -1616,7 +1616,7 @@ bool torture_denytest3(struct torture_context *tctx, smbcli_unlink(cli1->tree, fname); torture_comment(tctx, "fnum1=%d fnum2=%d\n", fnum1, fnum2); - return True; + return true; } struct bit_value { @@ -1658,7 +1658,7 @@ static const char *bit_string(TALLOC_CTX *mem_ctx, const struct bit_value *bv, i determine if two opens conflict */ static NTSTATUS predict_share_conflict(uint32_t sa1, uint32_t am1, uint32_t sa2, uint32_t am2, - BOOL read_for_execute, enum deny_result *res) + bool read_for_execute, enum deny_result *res) { #define CHECK_MASK(am, sa, right, share) do { \ if (((am) & (right)) && !((sa) & (share))) { \ @@ -1721,7 +1721,7 @@ static NTSTATUS predict_share_conflict(uint32_t sa1, uint32_t am1, uint32_t sa2, /* a denytest for ntcreatex */ -static BOOL torture_ntdenytest(struct torture_context *tctx, +static bool torture_ntdenytest(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2, int client) { const struct bit_value share_access_bits[] = { @@ -1741,7 +1741,7 @@ static BOOL torture_ntdenytest(struct torture_context *tctx, }; int fnum1; int i; - BOOL correct = True; + bool correct = true; struct timeval tv, tv_start; const char *fname; int nbits1 = ARRAY_SIZE(share_access_bits); @@ -1787,7 +1787,7 @@ static BOOL torture_ntdenytest(struct torture_context *tctx, int b_am1 = random() & ((1<<nbits2)-1); int b_sa2 = random() & ((1<<nbits1)-1); int b_am2 = random() & ((1<<nbits2)-1); - BOOL read_for_execute; + bool read_for_execute; progress_bar(tctx, i, torture_numops); @@ -1801,9 +1801,9 @@ static BOOL torture_ntdenytest(struct torture_context *tctx, status2 = smb_raw_open(cli2->tree, mem_ctx, &io2); if (random() % 2 == 0) { - read_for_execute = True; + read_for_execute = true; } else { - read_for_execute = False; + read_for_execute = false; } if (!NT_STATUS_IS_OK(status1)) { @@ -1853,7 +1853,7 @@ static BOOL torture_ntdenytest(struct torture_context *tctx, GetTimeOfDay(&tv); tdif = usec_time_diff(&tv, &tv_start); tdif /= 1000; - if (torture_setting_bool(tctx, "showall", False) || + if (torture_setting_bool(tctx, "showall", false) || !NT_STATUS_EQUAL(status2, status2_p) || res != res2) { torture_comment(tctx, "\n%-20s %-70s\n%-20s %-70s %4s %4s %s/%s\n", @@ -1871,7 +1871,7 @@ static BOOL torture_ntdenytest(struct torture_context *tctx, if (res != res2 || !NT_STATUS_EQUAL(status2, status2_p)) { CHECK_MAX_FAILURES(failed); - correct = False; + correct = false; } talloc_free(mem_ctx); @@ -1916,7 +1916,7 @@ bool torture_ntdenytest2(struct torture_context *torture, if (!NT_STATUS_EQUAL(status, correct)) { \ torture_comment(tctx, "(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -1924,7 +1924,7 @@ bool torture_ntdenytest2(struct torture_context *torture, if ((v) != (correct)) { \ torture_comment(tctx, "(%s) wrong value for %s 0x%x - should be 0x%x\n", \ __location__, #v, (int)(v), (int)correct); \ - ret = False; \ + ret = false; \ }} while (0) /* @@ -1938,7 +1938,7 @@ bool torture_denydos_sharing(struct torture_context *tctx, const char *fname = "\\torture_denydos.txt"; NTSTATUS status; int fnum1 = -1, fnum2 = -1; - BOOL ret = True; + bool ret = true; union smb_setfileinfo sfinfo; TALLOC_CTX *mem_ctx; diff --git a/source4/torture/basic/dir.c b/source4/torture/basic/dir.c index 9f9122fe32..9a1ae2f744 100644 --- a/source4/torture/basic/dir.c +++ b/source4/torture/basic/dir.c @@ -38,7 +38,7 @@ bool torture_dirtest1(struct torture_context *tctx, { int i; int fnum; - BOOL correct = True; + bool correct = true; extern int torture_numops; struct timeval tv; @@ -53,7 +53,7 @@ bool torture_dirtest1(struct torture_context *tctx, if (fnum == -1) { fprintf(stderr,"(%s) Failed to open %s\n", __location__, fname); - return False; + return false; } smbcli_close(cli->tree, fnum); free(fname); @@ -81,11 +81,11 @@ bool torture_dirtest2(struct torture_context *tctx, { int i; int fnum, num_seen; - BOOL correct = True; + bool correct = true; extern int torture_entries; if (!torture_setup_dir(cli, "\\LISTDIR")) { - return False; + return false; } torture_comment(tctx, "Creating %d files\n", torture_entries); @@ -102,7 +102,7 @@ bool torture_dirtest2(struct torture_context *tctx, if (fnum == -1) { fprintf(stderr,"(%s) Failed to open %s, error=%s\n", __location__, fname, smbcli_errstr(cli->tree)); - return False; + return false; } free(fname); smbcli_close(cli->tree, fnum); @@ -113,7 +113,7 @@ bool torture_dirtest2(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) { fprintf(stderr,"(%s) Failed to open %s, error=%s\n", __location__, fname, smbcli_errstr(cli->tree)); - return False; + return false; } free(fname); } @@ -123,7 +123,7 @@ bool torture_dirtest2(struct torture_context *tctx, torture_comment(tctx, "num_seen = %d\n", num_seen ); /* We should see (torture_entries) each of files & directories + . and .. */ if (num_seen != (2*torture_entries)+2) { - correct = False; + correct = false; fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", __location__, (2*torture_entries)+2, num_seen); } @@ -135,7 +135,7 @@ bool torture_dirtest2(struct torture_context *tctx, num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); torture_comment(tctx, "num_seen = %d\n", num_seen ); if (num_seen != torture_entries+2) { - correct = False; + correct = false; fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", __location__, torture_entries+2, num_seen); } @@ -143,7 +143,7 @@ bool torture_dirtest2(struct torture_context *tctx, num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); torture_comment(tctx, "num_seen = %d\n", num_seen ); if (num_seen != torture_entries) { - correct = False; + correct = false; fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", __location__, torture_entries, num_seen); } @@ -152,7 +152,7 @@ bool torture_dirtest2(struct torture_context *tctx, if (smbcli_deltree(cli->tree, "\\LISTDIR") == -1) { fprintf(stderr,"(%s) Failed to deltree %s, error=%s\n", "\\LISTDIR", __location__, smbcli_errstr(cli->tree)); - return False; + return false; } #if 0 diff --git a/source4/torture/basic/disconnect.c b/source4/torture/basic/disconnect.c index 1dab4b0cae..cb77bfe984 100644 --- a/source4/torture/basic/disconnect.c +++ b/source4/torture/basic/disconnect.c @@ -33,13 +33,13 @@ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ talloc_free(cli); \ - return False; \ + return false; \ }} while (0) /* test disconnect after async open */ -static BOOL test_disconnect_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_disconnect_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; NTSTATUS status; @@ -71,14 +71,14 @@ static BOOL test_disconnect_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) talloc_free(cli); - return True; + return true; } /* test disconnect with timed lock */ -static BOOL test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_lock io; NTSTATUS status; @@ -92,7 +92,7 @@ static BOOL test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) O_RDWR | O_CREAT, DENY_NONE); if (fnum == -1) { printf("open failed in mux_write - %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } io.lockx.level = RAW_LOCK_LOCKX; @@ -118,7 +118,7 @@ static BOOL test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) talloc_free(cli); - return True; + return true; } @@ -128,7 +128,7 @@ static BOOL test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) */ bool torture_disconnect(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx; int i; extern int torture_numops; @@ -137,25 +137,25 @@ bool torture_disconnect(struct torture_context *torture) mem_ctx = talloc_init("torture_raw_mux"); if (!torture_open_connection(&cli, 0)) { - return False; + return false; } if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } for (i=0;i<torture_numops;i++) { ret &= test_disconnect_lock(cli, mem_ctx); if (!torture_open_connection(&cli, 0)) { - return False; + return false; } ret &= test_disconnect_open(cli, mem_ctx); if (!torture_open_connection(&cli, 0)) { - return False; + return false; } - if (torture_setting_bool(torture, "samba3", False)) { + if (torture_setting_bool(torture, "samba3", false)) { /* * In Samba3 it might happen that the old smbd from * test_disconnect_lock is not scheduled before the diff --git a/source4/torture/basic/locking.c b/source4/torture/basic/locking.c index 0d66ecf30b..2e2585b976 100644 --- a/source4/torture/basic/locking.c +++ b/source4/torture/basic/locking.c @@ -48,7 +48,7 @@ static bool torture_locktest1(struct torture_context *tctx, uint_t lock_timeout; if (!torture_setup_dir(cli1, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); @@ -71,14 +71,14 @@ static bool torture_locktest1(struct torture_context *tctx, "lock2 succeeded! This is a locking bug\n"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)), "lock2 succeeded! This is a locking bug\n"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; torture_assert_ntstatus_ok(tctx, smbcli_lock(cli1->tree, fnum1, 5, 9, 0, WRITE_LOCK), @@ -90,21 +90,21 @@ static bool torture_locktest1(struct torture_context *tctx, "lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)), "lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)), "lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; lock_timeout = (6 + (random() % 20)); torture_comment(tctx, "Testing lock timeout with timeout=%u\n", @@ -115,7 +115,7 @@ static bool torture_locktest1(struct torture_context *tctx, "lock3 succeeded! This is a locking bug\n"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; t2 = time(NULL); if (t2 - t1 < 5) { @@ -133,7 +133,7 @@ static bool torture_locktest1(struct torture_context *tctx, "lock4 succeeded! This is a locking bug"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close2 failed (%s)", smbcli_errstr(cli1->tree))); @@ -166,7 +166,7 @@ static bool torture_locktest2(struct torture_context *tctx, int fnum1, fnum2, fnum3; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } torture_comment(tctx, "Testing pid context\n"); @@ -202,21 +202,21 @@ static bool torture_locktest2(struct torture_context *tctx, "WRITE lock1 succeeded! This is a locking bug"); if (!check_error(__location__, cli, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum2, 0, 4, 0, WRITE_LOCK)), "WRITE lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum2, 0, 4, 0, READ_LOCK)), "READ lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; torture_assert_ntstatus_ok(tctx, smbcli_lock(cli->tree, fnum1, 100, 4, 0, WRITE_LOCK), @@ -235,7 +235,7 @@ static bool torture_locktest2(struct torture_context *tctx, if (!check_error(__location__, cli, ERRDOS, ERRnotlocked, - NT_STATUS_RANGE_NOT_LOCKED)) return False; + NT_STATUS_RANGE_NOT_LOCKED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_unlock(cli->tree, fnum1, 0, 8)), @@ -243,13 +243,13 @@ static bool torture_locktest2(struct torture_context *tctx, if (!check_error(__location__, cli, ERRDOS, ERRnotlocked, - NT_STATUS_RANGE_NOT_LOCKED)) return False; + NT_STATUS_RANGE_NOT_LOCKED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum3, 0, 4, 0, WRITE_LOCK)), "lock3 succeeded! This is a locking bug"); - if (!check_error(__location__, cli, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False; + if (!check_error(__location__, cli, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return false; cli->session->pid = 1; @@ -285,7 +285,7 @@ static bool torture_locktest3(struct torture_context *tctx, torture_comment(tctx, "Testing 32 bit offset ranges"); if (!torture_setup_dir(cli1, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); @@ -362,7 +362,7 @@ static bool torture_locktest3(struct torture_context *tctx, } #define EXPECTED(ret, v) if ((ret) != (v)) { \ - torture_comment(tctx, "** "); correct = False; \ + torture_comment(tctx, "** "); correct = false; \ } /* @@ -374,12 +374,12 @@ static bool torture_locktest4(struct torture_context *tctx, { const char *fname = BASEDIR "\\lockt4.lck"; int fnum1, fnum2, f; - BOOL ret; + bool ret; uint8_t buf[1000]; - BOOL correct = True; + bool correct = true; if (!torture_setup_dir(cli1, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); @@ -389,80 +389,80 @@ static bool torture_locktest4(struct torture_context *tctx, if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) { torture_comment(tctx, "Failed to create file\n"); - correct = False; + correct = false; goto fail; } ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 2, 4, 0, WRITE_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s set overlapping write locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 10, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 12, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s set overlapping read locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 20, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 22, 4, 0, WRITE_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "a different connection %s set overlapping write locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 30, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 32, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "a different connection %s set overlapping read locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 40, 4, 0, WRITE_LOCK))) && NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 42, 4, 0, WRITE_LOCK))); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "a different pid %s set overlapping write locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 50, 4, 0, READ_LOCK))) && NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 52, 4, 0, READ_LOCK))); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "a different pid %s set overlapping read locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s set the same read lock twice\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s set the same write lock twice\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 80, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 80, 4, 0, WRITE_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s overlay a read lock with a write lock\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 90, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 90, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s overlay a write lock with a read lock\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 100, 4, 0, WRITE_LOCK))) && NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 100, 4, 0, READ_LOCK))); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "a different pid %s overlay a write lock with a read lock\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 110, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 112, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 110, 6)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s coalesce read locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 120, 4, 0, WRITE_LOCK)) && (smbcli_read(cli2->tree, fnum2, buf, 120, 4) == 4); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "this server %s strict write locking\n", ret?"doesn't do":"does"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK)) && (smbcli_write(cli2->tree, fnum2, 0, buf, 130, 4) == 4); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "this server %s strict read locking\n", ret?"doesn't do":"does"); @@ -470,7 +470,7 @@ static bool torture_locktest4(struct torture_context *tctx, NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 140, 4)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 140, 4)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "this server %s do recursive read locking\n", ret?"does":"doesn't"); @@ -480,21 +480,21 @@ static bool torture_locktest4(struct torture_context *tctx, (smbcli_read(cli2->tree, fnum2, buf, 150, 4) == 4) && !(smbcli_write(cli2->tree, fnum2, 0, buf, 150, 4) == 4) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 150, 4)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "this server %s do recursive lock overlays\n", ret?"does":"doesn't"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 160, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 160, 4)) && (smbcli_write(cli2->tree, fnum2, 0, buf, 160, 4) == 4) && (smbcli_read(cli2->tree, fnum2, buf, 160, 4) == 4); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s remove a read lock using write locking\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 170, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 170, 4)) && (smbcli_write(cli2->tree, fnum2, 0, buf, 170, 4) == 4) && (smbcli_read(cli2->tree, fnum2, buf, 170, 4) == 4); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s remove a write lock using read locking\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 190, 4, 0, WRITE_LOCK)) && @@ -502,7 +502,7 @@ static bool torture_locktest4(struct torture_context *tctx, NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 190, 4)) && !(smbcli_write(cli2->tree, fnum2, 0, buf, 190, 4) == 4) && (smbcli_read(cli2->tree, fnum2, buf, 190, 4) == 4); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s remove the first lock first\n", ret?"does":"doesn't"); smbcli_close(cli1->tree, fnum1); @@ -516,7 +516,7 @@ static bool torture_locktest4(struct torture_context *tctx, NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK)); smbcli_close(cli1->tree, f); smbcli_close(cli1->tree, fnum1); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the server %s have the NT byte range lock bug\n", !ret?"does":"doesn't"); fail: @@ -535,12 +535,12 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state { const char *fname = BASEDIR "\\lockt5.lck"; int fnum1, fnum2, fnum3; - BOOL ret; + bool ret; uint8_t buf[1000]; - BOOL correct = True; + bool correct = true; if (!torture_setup_dir(cli1, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); @@ -558,7 +558,7 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state smbcli_close(cli1->tree, fnum1); fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "this server %s the NT locking bug\n", ret ? "doesn't have" : "has"); smbcli_close(cli1->tree, fnum1); fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE); @@ -566,11 +566,11 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 1, 1, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s overlay a write with a read lock\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "a different processs %s get a read lock on the first process lock stack\n", ret?"can":"cannot"); @@ -578,7 +578,7 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state smbcli_unlock(cli2->tree, fnum2, 0, 4); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum3, 0, 4, 0, READ_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same processs on a different fnum %s get a read lock\n", ret?"can":"cannot"); @@ -589,7 +589,7 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s stack read locks\n", ret?"can":"cannot"); /* Unlock the first process lock, then check this was the WRITE lock that was @@ -598,7 +598,7 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) && NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the first unlock removes the %s lock\n", ret?"WRITE":"READ"); /* Unlock the process 2 lock. */ @@ -610,17 +610,17 @@ ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s unlock the stack of 4 locks\n", ret?"can":"cannot"); /* Ensure the next unlock fails. */ ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s count the lock stack\n", !ret?"can":"cannot"); /* Ensure connection 2 can get a write lock. */ ret = NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, WRITE_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "a different processs %s get a write lock on the unlocked stack\n", ret?"can":"cannot"); @@ -644,7 +644,7 @@ static bool torture_locktest6(struct torture_context *tctx, NTSTATUS status; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } for (i=0;i<1;i++) { @@ -665,7 +665,7 @@ static bool torture_locktest6(struct torture_context *tctx, smbcli_unlink(cli->tree, fname[i]); } - return True; + return true; } static bool torture_locktest7(struct torture_context *tctx, @@ -676,7 +676,7 @@ static bool torture_locktest7(struct torture_context *tctx, int fnum2 = -1; size_t size; uint8_t buf[200]; - BOOL correct = False; + bool correct = false; torture_assert(tctx, torture_setup_dir(cli1, BASEDIR), talloc_asprintf(tctx, "Unable to set up %s", BASEDIR)); @@ -785,7 +785,7 @@ static bool torture_locktest7(struct torture_context *tctx, cli1->session->pid = 1; smbcli_unlock(cli1->tree, fnum1, 130, 4); - correct = True; + correct = true; fail: smbcli_close(cli1->tree, fnum1); diff --git a/source4/torture/basic/mangle_test.c b/source4/torture/basic/mangle_test.c index dc7bc21a55..58d7098972 100644 --- a/source4/torture/basic/mangle_test.c +++ b/source4/torture/basic/mangle_test.c @@ -58,25 +58,25 @@ static bool test_one(struct torture_context *tctx ,struct smbcli_state *cli, status = smbcli_qpathinfo_alt_name(cli->tree, name, &shortname); if (!NT_STATUS_IS_OK(status)) { printf("query altname of %s failed (%s)\n", name, smbcli_errstr(cli->tree)); - return False; + return false; } name2 = talloc_asprintf(tctx, "\\mangle_test\\%s", shortname); if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, name2))) { printf("unlink of %s (%s) failed (%s)\n", name2, name, smbcli_errstr(cli->tree)); - return False; + return false; } /* recreate by short name */ fnum = smbcli_open(cli->tree, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { printf("open2 of %s failed (%s)\n", name2, smbcli_errstr(cli->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) { printf("close of %s failed (%s)\n", name, smbcli_errstr(cli->tree)); - return False; + return false; } /* and unlink by long name */ @@ -85,7 +85,7 @@ static bool test_one(struct torture_context *tctx ,struct smbcli_state *cli, name, name2, smbcli_errstr(cli->tree)); failures++; smbcli_unlink(cli->tree, name2); - return True; + return true; } /* see if the short name is already in the tdb */ @@ -108,7 +108,7 @@ static bool test_one(struct torture_context *tctx ,struct smbcli_state *cli, tdb_store_bystring(tdb, shortname, namedata, TDB_REPLACE); } - return True; + return true; } @@ -170,11 +170,11 @@ bool torture_mangle(struct torture_context *torture, tdb = tdb_open(NULL, 100000, TDB_INTERNAL, 0, 0); if (!tdb) { printf("ERROR: Failed to open tdb\n"); - return False; + return false; } if (!torture_setup_dir(cli, "\\mangle_test")) { - return False; + return false; } for (i=0;i<torture_numops;i++) { @@ -196,7 +196,7 @@ bool torture_mangle(struct torture_context *torture, smbcli_unlink(cli->tree, "\\mangle_test\\*"); if (NT_STATUS_IS_ERR(smbcli_rmdir(cli->tree, "\\mangle_test"))) { printf("ERROR: Failed to remove directory\n"); - return False; + return false; } printf("\nTotal collisions %u/%u - %.2f%% (%u failures)\n", diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c index 19eef87f6f..f0d5ef5536 100644 --- a/source4/torture/basic/misc.c +++ b/source4/torture/basic/misc.c @@ -37,16 +37,16 @@ extern struct cli_credentials *cmdline_credentials; -static BOOL wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len) +static bool wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len) { while (NT_STATUS_IS_ERR(smbcli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) { - if (!check_error(__location__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False; + if (!check_error(__location__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return false; } - return True; + return true; } -static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) +static bool rw_torture(struct torture_context *tctx, struct smbcli_state *c) { const char *lockfname = "\\torture.lck"; char *fname; @@ -55,7 +55,7 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) pid_t pid2, pid = getpid(); int i, j; uint8_t buf[1024]; - BOOL correct = True; + bool correct = true; fnum2 = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, DENY_NONE); @@ -63,7 +63,7 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) fnum2 = smbcli_open(c->tree, lockfname, O_RDWR, DENY_NONE); if (fnum2 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", lockfname, smbcli_errstr(c->tree)); - return False; + return false; } generate_random_buffer(buf, sizeof(buf)); @@ -79,19 +79,19 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) asprintf(&fname, "\\torture.%u", n); if (!wait_lock(c, fnum2, n*sizeof(int), sizeof(int))) { - return False; + return false; } fnum = smbcli_open(c->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL); if (fnum == -1) { torture_comment(tctx, "open failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; break; } if (smbcli_write(c->tree, fnum, 0, &pid, 0, sizeof(pid)) != sizeof(pid)) { torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } for (j=0;j<50;j++) { @@ -99,7 +99,7 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) sizeof(pid)+(j*sizeof(buf)), sizeof(buf)) != sizeof(buf)) { torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } } @@ -107,27 +107,27 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) if (smbcli_read(c->tree, fnum, &pid2, 0, sizeof(pid)) != sizeof(pid)) { torture_comment(tctx, "read failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } if (pid2 != pid) { torture_comment(tctx, "data corruption!\n"); - correct = False; + correct = false; } if (NT_STATUS_IS_ERR(smbcli_close(c->tree, fnum))) { torture_comment(tctx, "close failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } if (NT_STATUS_IS_ERR(smbcli_unlink(c->tree, fname))) { torture_comment(tctx, "unlink failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } if (NT_STATUS_IS_ERR(smbcli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int)))) { torture_comment(tctx, "unlock failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } free(fname); } @@ -140,7 +140,7 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) return correct; } -BOOL run_torture(struct torture_context *tctx, struct smbcli_state *cli, int dummy) +bool run_torture(struct torture_context *tctx, struct smbcli_state *cli, int dummy) { return rw_torture(tctx, cli); } @@ -149,7 +149,7 @@ BOOL run_torture(struct torture_context *tctx, struct smbcli_state *cli, int dum /* see how many RPC pipes we can open at once */ -BOOL run_pipe_number(struct torture_context *tctx, +bool run_pipe_number(struct torture_context *tctx, struct smbcli_state *cli1) { const char *pipe_name = "\\WKSSVC"; @@ -172,7 +172,7 @@ BOOL run_pipe_number(struct torture_context *tctx, } torture_comment(tctx, "pipe_number test - we can open %d %s pipes.\n", num_pipes, pipe_name ); - return True; + return true; } @@ -183,7 +183,7 @@ BOOL run_pipe_number(struct torture_context *tctx, used for testing performance when there are N idle users already connected */ -BOOL torture_holdcon(struct torture_context *tctx) +bool torture_holdcon(struct torture_context *tctx) { int i; struct smbcli_state **cli; @@ -195,7 +195,7 @@ BOOL torture_holdcon(struct torture_context *tctx) for (i=0;i<torture_numops;i++) { if (!torture_open_connection(&cli[i], i)) { - return False; + return false; } if (torture_setting_bool(tctx, "progress", true)) { torture_comment(tctx, "opened %d connections\r", i); @@ -228,34 +228,34 @@ BOOL torture_holdcon(struct torture_context *tctx) fflush(stdout); } - return True; + return true; } /* test how many open files this server supports on the one socket */ -BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int dummy) +bool run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int dummy) { #define MAXFID_TEMPLATE "\\maxfid\\fid%d\\maxfid.%d.%d" char *fname; int fnums[0x11000], i; int retries=4, maxfid; - BOOL correct = True; + bool correct = true; if (retries <= 0) { torture_comment(tctx, "failed to connect\n"); - return False; + return false; } if (smbcli_deltree(cli->tree, "\\maxfid") == -1) { torture_comment(tctx, "Failed to deltree \\maxfid - %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\maxfid"))) { torture_comment(tctx, "Failed to mkdir \\maxfid, error=%s\n", smbcli_errstr(cli->tree)); - return False; + return false; } torture_comment(tctx, "Testing maximum number of open files\n"); @@ -266,7 +266,7 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) { torture_comment(tctx, "Failed to mkdir %s, error=%s\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } free(fname); } @@ -299,7 +299,7 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) { torture_comment(tctx, "unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - correct = False; + correct = false; } free(fname); @@ -310,7 +310,7 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) { torture_comment(tctx, "unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - correct = False; + correct = false; } free(fname); @@ -324,12 +324,12 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int if (smbcli_deltree(cli->tree, "\\maxfid") == -1) { torture_comment(tctx, "Failed to deltree \\maxfid - %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } torture_comment(tctx, "maxfid test finished\n"); if (!torture_close_connection(cli)) { - correct = False; + correct = false; } return correct; #undef MAXFID_TEMPLATE @@ -340,7 +340,7 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int /* sees what IOCTLs are supported */ -BOOL torture_ioctl_test(struct torture_context *tctx, +bool torture_ioctl_test(struct torture_context *tctx, struct smbcli_state *cli) { uint16_t device, function; @@ -357,7 +357,7 @@ BOOL torture_ioctl_test(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } parms.ioctl.level = RAW_IOCTL_IOCTL; @@ -379,7 +379,7 @@ BOOL torture_ioctl_test(struct torture_context *tctx, } } - return True; + return true; } static void benchrw_callback(struct smbcli_request *req); @@ -582,7 +582,7 @@ static NTSTATUS benchrw_readwrite(struct torture_context *tctx, rd.readx.in.maxcnt = rd.readx.in.mincnt; rd.readx.in.remaining = 0 ; rd.readx.out.data = state->buffer; - rd.readx.in.read_for_execute = False; + rd.readx.in.read_for_execute = false; if(state->readcnt < state->lp_params->writeblocks){ state->readcnt++; }else{ @@ -819,13 +819,13 @@ static struct composite_context *torture_connect_async( smb->in.called_name = strupper_talloc(mem_ctx, host); smb->in.service_type=NULL; smb->in.credentials=cmdline_credentials; - smb->in.fallback_to_anonymous=False; + smb->in.fallback_to_anonymous=false; smb->in.workgroup=workgroup; return smb_composite_connect_send(smb,mem_ctx,ev); } -BOOL run_benchrw(struct torture_context *tctx) +bool run_benchrw(struct torture_context *tctx) { struct smb_composite_connect *smb_con; const char *fname = "\\rwtest.dat"; @@ -837,7 +837,7 @@ BOOL run_benchrw(struct torture_context *tctx) struct params lpparams; union smb_mkdir parms; int finished = 0; - BOOL success=True; + bool success=true; int torture_nprocs = torture_setting_int(tctx, "nprocs", 4); torture_comment(tctx, "Start BENCH-READWRITE num_ops=%d " @@ -911,7 +911,7 @@ BOOL run_benchrw(struct torture_context *tctx) /* error occured , finish */ case ERROR: finished++; - success=False; + success=false; break; /* cleanup , close connection */ case CLEANUP: diff --git a/source4/torture/basic/properties.c b/source4/torture/basic/properties.c index f389fa35f9..1825dff993 100644 --- a/source4/torture/basic/properties.c +++ b/source4/torture/basic/properties.c @@ -91,7 +91,7 @@ static void show_bits(const struct bitmapping *bm, uint32_t value) bool torture_test_properties(struct torture_context *torture, struct smbcli_state *cli) { - BOOL correct = True; + bool correct = true; union smb_fsinfo fs; NTSTATUS status; @@ -103,7 +103,7 @@ bool torture_test_properties(struct torture_context *torture, status = smb_raw_fsinfo(cli->tree, cli, &fs); if (!NT_STATUS_IS_OK(status)) { d_printf("qfsinfo failed - %s\n", nt_errstr(status)); - correct = False; + correct = false; } else { d_printf("Filesystem attributes: 0x%08x\n", fs.attribute_info.out.fs_attr); diff --git a/source4/torture/basic/scanner.c b/source4/torture/basic/scanner.c index f68674911f..dd596c9ee3 100644 --- a/source4/torture/basic/scanner.c +++ b/source4/torture/basic/scanner.c @@ -122,7 +122,7 @@ static NTSTATUS try_trans2_len(struct smbcli_state *cli, /**************************************************************************** check whether a trans2 opnum exists at all ****************************************************************************/ -static BOOL trans2_op_exists(struct smbcli_state *cli, int op) +static bool trans2_op_exists(struct smbcli_state *cli, int op) { int data_len = 0; int param_len = 0; @@ -146,17 +146,17 @@ static BOOL trans2_op_exists(struct smbcli_state *cli, int op) status2 = try_trans2(cli, op, param, data, param_len, data_len, &rparam_len, &rdata_len); - if (NT_STATUS_EQUAL(status1, status2)) return False; + if (NT_STATUS_EQUAL(status1, status2)) return false; printf("Found op %d (status=%s)\n", op, nt_errstr(status2)); - return True; + return true; } /**************************************************************************** check for existance of a trans2 call ****************************************************************************/ -static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, +static bool scan_trans2(struct smbcli_state *cli, int op, int level, int fnum, int dnum, int qfnum, const char *fname) { int data_len = 0; @@ -173,7 +173,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, SSVAL(param, 0, level); status = try_trans2_len(cli, "void", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a file descriptor */ param_len = 6; @@ -182,7 +182,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, 0); status = try_trans2_len(cli, "fnum", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a quota file descriptor */ param_len = 6; @@ -191,7 +191,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, 0); status = try_trans2_len(cli, "qfnum", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a notify style */ param_len = 6; @@ -200,7 +200,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, level); status = try_trans2_len(cli, "notify", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a file name */ param_len = 6; @@ -211,7 +211,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, status = try_trans2_len(cli, "fname", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a new file name */ param_len = 6; @@ -224,7 +224,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, &rparam_len, &rdata_len); smbcli_unlink(cli->tree, "\\newfile.dat"); smbcli_rmdir(cli->tree, "\\newfile.dat"); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try dfs style */ smbcli_mkdir(cli->tree, "\\testdir"); @@ -235,13 +235,13 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, status = try_trans2_len(cli, "dfs", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); smbcli_rmdir(cli->tree, "\\testdir"); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; - return False; + return false; } -BOOL torture_trans2_scan(struct torture_context *torture, +bool torture_trans2_scan(struct torture_context *torture, struct smbcli_state *cli) { int op, level; @@ -292,7 +292,7 @@ BOOL torture_trans2_scan(struct torture_context *torture, } } - return True; + return true; } @@ -396,7 +396,7 @@ static NTSTATUS try_nttrans_len(struct smbcli_state *cli, /**************************************************************************** check for existance of a nttrans call ****************************************************************************/ -static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, +static bool scan_nttrans(struct smbcli_state *cli, int op, int level, int fnum, int dnum, const char *fname) { int data_len = 0; @@ -413,7 +413,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, SSVAL(param, 0, level); status = try_nttrans_len(cli, "void", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a file descriptor */ param_len = 6; @@ -422,7 +422,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, 0); status = try_nttrans_len(cli, "fnum", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a notify style */ @@ -432,7 +432,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, level); status = try_nttrans_len(cli, "notify", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a file name */ param_len = 6; @@ -443,7 +443,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, status = try_nttrans_len(cli, "fname", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a new file name */ param_len = 6; @@ -456,7 +456,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, &rparam_len, &rdata_len); smbcli_unlink(cli->tree, "\\newfile.dat"); smbcli_rmdir(cli->tree, "\\newfile.dat"); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try dfs style */ smbcli_mkdir(cli->tree, "\\testdir"); @@ -467,9 +467,9 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, status = try_nttrans_len(cli, "dfs", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); smbcli_rmdir(cli->tree, "\\testdir"); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; - return False; + return false; } @@ -500,12 +500,12 @@ bool torture_nttrans_scan(struct torture_context *torture, } printf("nttrans scan finished\n"); - return True; + return true; } /* scan for valid base SMB requests */ -BOOL torture_smb_scan(struct torture_context *torture) +bool torture_smb_scan(struct torture_context *torture) { static struct smbcli_state *cli; int op; @@ -516,7 +516,7 @@ BOOL torture_smb_scan(struct torture_context *torture) if (op == SMBreadbraw) continue; if (!torture_open_connection(&cli, 0)) { - return False; + return false; } req = smbcli_request_setup(cli->tree, op, 0, 0); @@ -551,5 +551,5 @@ BOOL torture_smb_scan(struct torture_context *torture) printf("smb scan finished\n"); - return True; + return true; } diff --git a/source4/torture/basic/secleak.c b/source4/torture/basic/secleak.c index 75d3117967..3d4aeea956 100644 --- a/source4/torture/basic/secleak.c +++ b/source4/torture/basic/secleak.c @@ -29,13 +29,13 @@ #include "auth/credentials/credentials.h" #include "param/param.h" -static BOOL try_failed_login(struct smbcli_state *cli) +static bool try_failed_login(struct smbcli_state *cli) { NTSTATUS status; struct smb_composite_sesssetup setup; struct smbcli_session *session; - session = smbcli_session_init(cli->transport, cli, False); + session = smbcli_session_init(cli->transport, cli, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; setup.in.workgroup = lp_workgroup(global_loadparm); @@ -50,23 +50,23 @@ static BOOL try_failed_login(struct smbcli_state *cli) talloc_free(session); if (NT_STATUS_IS_OK(status)) { printf("Allowed session setup with invalid credentials?!\n"); - return False; + return false; } - return True; + return true; } -BOOL torture_sec_leak(struct torture_context *tctx, struct smbcli_state *cli) +bool torture_sec_leak(struct torture_context *tctx, struct smbcli_state *cli) { time_t t1 = time(NULL); int timelimit = torture_setting_int(tctx, "timelimit", 20); while (time(NULL) < t1+timelimit) { if (!try_failed_login(cli)) { - return False; + return false; } talloc_report(NULL, stdout); } - return True; + return true; } diff --git a/source4/torture/basic/unlink.c b/source4/torture/basic/unlink.c index bb829051a2..9e13021d20 100644 --- a/source4/torture/basic/unlink.c +++ b/source4/torture/basic/unlink.c @@ -37,7 +37,7 @@ bool torture_unlinktest(struct torture_context *tctx, struct smbcli_state *cli) { const char *fname = BASEDIR "\\unlink.tst"; int fnum; - BOOL correct = True; + bool correct = true; union smb_open io; NTSTATUS status; diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c index 52babe4d53..82511aa8f9 100644 --- a/source4/torture/basic/utable.c +++ b/source4/torture/basic/utable.c @@ -166,7 +166,7 @@ bool torture_casetable(struct torture_context *tctx, torture_comment(tctx, "too many chars match?? size=%d c=0x%04x\n", (int)size, c); smbcli_close(cli->tree, fnum); - return False; + return false; } smbcli_read(cli->tree, fnum, c2, 0, size); |