summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2021-11-19 12:54:47 -0800
committerJule Anger <janger@samba.org>2022-01-31 12:23:53 +0100
commit10242faa0785ca277d584274c151467e78e787bf (patch)
tree0b0b87a737aff1c03c9700829ae6106cc2caf93e
parentf8698b1f797ddf2c6e418e683e6c68392ad3ef9e (diff)
downloadsamba-10242faa0785ca277d584274c151467e78e787bf.tar.gz
CVE-2021-44141: s4: torture: Fix raw.search:test_one_file() to use torture_result() instead of printf.
I think this test pre-dates torture_result. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14911 Signed-off-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source4/torture/raw/search.c60
1 files changed, 41 insertions, 19 deletions
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c
index 14af01bffad..07285893f40 100644
--- a/source4/torture/raw/search.c
+++ b/source4/torture/raw/search.c
@@ -316,7 +316,11 @@ static bool test_one_file(struct torture_context *tctx,
fnum = create_complex_file(cli, tctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
+ torture_result(tctx,
+ TORTURE_FAIL,
+ __location__"ERROR: open of %s failed (%s)\n",
+ fname,
+ smbcli_errstr(cli->tree));
ret = false;
goto done;
}
@@ -343,9 +347,11 @@ static bool test_one_file(struct torture_context *tctx,
}
if (!NT_STATUS_IS_OK(levels[i].status)) {
- printf("search level %s(%d) failed - %s\n",
- levels[i].name, (int)levels[i].level,
- nt_errstr(levels[i].status));
+ torture_result(tctx,
+ TORTURE_FAIL,
+ __location__"search level %s(%d) failed - %s\n",
+ levels[i].name, (int)levels[i].level,
+ nt_errstr(levels[i].status));
ret = false;
continue;
}
@@ -363,7 +369,9 @@ static bool test_one_file(struct torture_context *tctx,
expected_status = STATUS_NO_MORE_FILES;
}
if (!NT_STATUS_EQUAL(status, expected_status)) {
- printf("search level %s(%d) should fail with %s - %s\n",
+ torture_result(tctx,
+ TORTURE_FAIL,
+ __location__"search level %s(%d) should fail with %s - %s\n",
levels[i].name, (int)levels[i].level,
nt_errstr(expected_status),
nt_errstr(status));
@@ -400,8 +408,10 @@ static bool test_one_file(struct torture_context *tctx,
s = find(name); \
if (s) { \
if ((s->sname1.field1) != (v.sname2.out.field2)) { \
- printf("(%s) %s/%s [0x%x] != %s/%s [0x%x]\n", \
- __location__, \
+ torture_result(tctx,\
+ TORTURE_FAIL,\
+ "(%s) %s/%s [0x%x] != %s/%s [0x%x]\n", \
+ __location__, \
#sname1, #field1, (int)s->sname1.field1, \
#sname2, #field2, (int)v.sname2.out.field2); \
ret = false; \
@@ -412,8 +422,10 @@ static bool test_one_file(struct torture_context *tctx,
s = find(name); \
if (s) { \
if (s->sname1.field1 != (~1 & nt_time_to_unix(v.sname2.out.field2))) { \
- printf("(%s) %s/%s [%s] != %s/%s [%s]\n", \
- __location__, \
+ torture_result(tctx,\
+ TORTURE_FAIL,\
+ "(%s) %s/%s [%s] != %s/%s [%s]\n", \
+ __location__, \
#sname1, #field1, timestring(tctx, s->sname1.field1), \
#sname2, #field2, nt_time_string(tctx, v.sname2.out.field2)); \
ret = false; \
@@ -424,8 +436,10 @@ static bool test_one_file(struct torture_context *tctx,
s = find(name); \
if (s) { \
if (s->sname1.field1 != v.sname2.out.field2) { \
- printf("(%s) %s/%s [%s] != %s/%s [%s]\n", \
- __location__, \
+ torture_result(tctx,\
+ TORTURE_FAIL,\
+ "(%s) %s/%s [%s] != %s/%s [%s]\n", \
+ __location__, \
#sname1, #field1, nt_time_string(tctx, s->sname1.field1), \
#sname2, #field2, nt_time_string(tctx, v.sname2.out.field2)); \
ret = false; \
@@ -436,8 +450,10 @@ static bool test_one_file(struct torture_context *tctx,
s = find(name); \
if (s) { \
if (!s->sname1.field1 || strcmp(s->sname1.field1, v.sname2.out.field2.s)) { \
- printf("(%s) %s/%s [%s] != %s/%s [%s]\n", \
- __location__, \
+ torture_result(tctx,\
+ TORTURE_FAIL,\
+ "(%s) %s/%s [%s] != %s/%s [%s]\n", \
+ __location__, \
#sname1, #field1, s->sname1.field1, \
#sname2, #field2, v.sname2.out.field2.s); \
ret = false; \
@@ -450,8 +466,10 @@ static bool test_one_file(struct torture_context *tctx,
if (!s->sname1.field1.s || \
strcmp(s->sname1.field1.s, v.sname2.out.field2.s) || \
wire_bad_flags(&s->sname1.field1, flags, cli->transport)) { \
- printf("(%s) %s/%s [%s] != %s/%s [%s]\n", \
- __location__, \
+ torture_result(tctx,\
+ TORTURE_FAIL,\
+ "(%s) %s/%s [%s] != %s/%s [%s]\n", \
+ __location__, \
#sname1, #field1, s->sname1.field1.s, \
#sname2, #field2, v.sname2.out.field2.s); \
ret = false; \
@@ -464,8 +482,10 @@ static bool test_one_file(struct torture_context *tctx,
if (!s->sname1.field1.s || \
strcmp(s->sname1.field1.s, fname) || \
wire_bad_flags(&s->sname1.field1, flags, cli->transport)) { \
- printf("(%s) %s/%s [%s] != %s\n", \
- __location__, \
+ torture_result(tctx,\
+ TORTURE_FAIL,\
+ "(%s) %s/%s [%s] != %s\n", \
+ __location__, \
#sname1, #field1, s->sname1.field1.s, \
fname); \
ret = false; \
@@ -477,8 +497,10 @@ static bool test_one_file(struct torture_context *tctx,
if (s) { \
if (!s->sname1.field1 || \
strcmp(s->sname1.field1, fname)) { \
- printf("(%s) %s/%s [%s] != %s\n", \
- __location__, \
+ torture_result(tctx,\
+ TORTURE_FAIL,\
+ "(%s) %s/%s [%s] != %s\n", \
+ __location__, \
#sname1, #field1, s->sname1.field1, \
fname); \
ret = false; \