The branch, master has been updated
       via  b529a1e98723c30f965f71fb1e9577edb23219d1 (commit)
       via  50db2902eebd143cea4e93bdc3771fcf2c5211f5 (commit)
      from  ce791d6645ece67c068079de71a0c96ad28c17b7 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b529a1e98723c30f965f71fb1e9577edb23219d1
Author: Aravind Srinivasan <aravind.sriniva...@isilon.com>
Date:   Thu Oct 1 16:13:37 2009 -0700

    s4/torture: Add two new SMB RAW-OPEN tests
    
    * Add chained NTCREATEX_READX test which first tries to open/read
      a non-existant file failing on the open, then attempts the same
      operation on a file that does exist, opening and reading
      successfully.
    
    * Add test for open_dispositions on directories.

commit 50db2902eebd143cea4e93bdc3771fcf2c5211f5
Author: Aravind Srinivasan <aravind.sriniva...@isilon.com>
Date:   Thu Oct 1 16:11:59 2009 -0700

    s4/torture: convert printf to torture_comment() in RAW-OPEN
    
    Allows "make test" and other harnesses to print cleaner output.

-----------------------------------------------------------------------

Summary of changes:
 source4/libcli/raw/interfaces.h |   52 ++++++
 source4/libcli/raw/rawfile.c    |   74 +++++++++
 source4/torture/raw/open.c      |  332 ++++++++++++++++++++++++++++++++-------
 3 files changed, 399 insertions(+), 59 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
index 1321715..f7d64d0 100644
--- a/source4/libcli/raw/interfaces.h
+++ b/source4/libcli/raw/interfaces.h
@@ -1356,6 +1356,7 @@ enum smb_open_level {
        RAW_OPEN_T2OPEN,
        RAW_OPEN_NTTRANS_CREATE, 
        RAW_OPEN_OPENX_READX,
+       RAW_OPEN_NTCREATEX_READX,
        RAW_OPEN_SMB2
 };
 
@@ -1400,6 +1401,9 @@ union smb_open {
        case RAW_OPEN_OPENX_READX: \
                file = &op->openxreadx.out.file; \
                break; \
+       case RAW_OPEN_NTCREATEX_READX: \
+               file = &op->ntcreatexreadx.out.file; \
+               break; \
        case RAW_OPEN_SMB2: \
                file = &op->smb2.out.file; \
                break; \
@@ -1619,6 +1623,54 @@ union smb_open {
                } out;
        } openxreadx;
 
+       /* chained NTCreateX/ReadX interface */
+       struct {
+               enum smb_open_level level;
+               struct {
+                       uint32_t flags;
+                       uint32_t root_fid;
+                       uint32_t access_mask;
+                       uint64_t alloc_size;
+                       uint32_t file_attr;
+                       uint32_t share_access;
+                       uint32_t open_disposition;
+                       uint32_t create_options;
+                       uint32_t impersonation;
+                       uint8_t  security_flags;
+                       /* NOTE: fname can also be a pointer to a
+                        uint64_t file_id if create_options has the
+                        NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
+                       const char *fname;
+
+                       /* readx part */
+                       uint64_t offset;
+                       uint16_t mincnt;
+                       uint32_t maxcnt;
+                       uint16_t remaining;
+               } in;
+               struct {
+                       union smb_handle file;
+                       uint8_t oplock_level;
+                       uint32_t create_action;
+                       NTTIME create_time;
+                       NTTIME access_time;
+                       NTTIME write_time;
+                       NTTIME change_time;
+                       uint32_t attrib;
+                       uint64_t alloc_size;
+                       uint64_t size;
+                       uint16_t file_type;
+                       uint16_t ipc_state;
+                       uint8_t  is_directory;
+
+                       /* readx part */
+                       uint8_t *data;
+                       uint16_t remaining;
+                       uint16_t compaction_mode;
+                       uint16_t nread;
+               } out;
+       } ntcreatexreadx;
+
 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK           0x0100
 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
 #define SMB2_CREATE_FLAG_GRANT_OPLOCK             0x0001
diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c
index 35d6b75..ea254a5 100644
--- a/source4/libcli/raw/rawfile.c
+++ b/source4/libcli/raw/rawfile.c
@@ -616,6 +616,45 @@ _PUBLIC_ struct smbcli_request *smb_raw_open_send(struct 
smbcli_tree *tree, unio
                        SIVAL(req->out.vwv, 
VWV(10),parms->openxreadx.in.offset>>32);
                }
                break;
+
+       case RAW_OPEN_NTCREATEX_READX:
+               SETUP_REQUEST(SMBntcreateX, 24, 0);
+               SSVAL(req->out.vwv, VWV(0),SMB_CHAIN_NONE);
+               SSVAL(req->out.vwv, VWV(1),0);
+               SCVAL(req->out.vwv, VWV(2),0); /* padding */
+               SIVAL(req->out.vwv,  7, parms->ntcreatexreadx.in.flags);
+               SIVAL(req->out.vwv, 11, parms->ntcreatexreadx.in.root_fid);
+               SIVAL(req->out.vwv, 15, parms->ntcreatexreadx.in.access_mask);
+               SBVAL(req->out.vwv, 19, parms->ntcreatexreadx.in.alloc_size);
+               SIVAL(req->out.vwv, 27, parms->ntcreatexreadx.in.file_attr);
+               SIVAL(req->out.vwv, 31, parms->ntcreatexreadx.in.share_access);
+               SIVAL(req->out.vwv, 35, 
parms->ntcreatexreadx.in.open_disposition);
+               SIVAL(req->out.vwv, 39, 
parms->ntcreatexreadx.in.create_options);
+               SIVAL(req->out.vwv, 43, parms->ntcreatexreadx.in.impersonation);
+               SCVAL(req->out.vwv, 47, 
parms->ntcreatexreadx.in.security_flags);
+
+               smbcli_req_append_string_len(req, 
parms->ntcreatexreadx.in.fname, STR_TERMINATE, &len);
+               SSVAL(req->out.vwv, 5, len);
+
+               if (tree->session->transport->negotiate.capabilities & 
CAP_LARGE_FILES) {
+                       bigoffset = true;
+               }
+
+               smbcli_chained_request_setup(req, SMBreadX, bigoffset ? 12 : 
10, 0);
+
+               SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE);
+               SSVAL(req->out.vwv, VWV(1), 0);
+               SSVAL(req->out.vwv, VWV(2), 0);
+               SIVAL(req->out.vwv, VWV(3), parms->ntcreatexreadx.in.offset);
+               SSVAL(req->out.vwv, VWV(5), parms->ntcreatexreadx.in.maxcnt & 
0xFFFF);
+               SSVAL(req->out.vwv, VWV(6), parms->ntcreatexreadx.in.mincnt);
+               SIVAL(req->out.vwv, VWV(7), parms->ntcreatexreadx.in.maxcnt >> 
16);
+               SSVAL(req->out.vwv, VWV(9), parms->ntcreatexreadx.in.remaining);
+               if (bigoffset) {
+                       SIVAL(req->out.vwv, 
VWV(10),parms->ntcreatexreadx.in.offset>>32);
+               }
+               break;
+
        case RAW_OPEN_SMB2:
                return NULL;
        }
@@ -753,6 +792,41 @@ _PUBLIC_ NTSTATUS smb_raw_open_recv(struct smbcli_request 
*req, TALLOC_CTX *mem_
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
                }
                break;
+
+       case RAW_OPEN_NTCREATEX_READX:
+               SMBCLI_CHECK_MIN_WCT(req, 34);
+               parms->ntcreatexreadx.out.oplock_level =              
CVAL(req->in.vwv, 4);
+               parms->ntcreatexreadx.out.file.fnum =                 
SVAL(req->in.vwv, 5);
+               parms->ntcreatexreadx.out.create_action =             
IVAL(req->in.vwv, 7);
+               parms->ntcreatexreadx.out.create_time =   
smbcli_pull_nttime(req->in.vwv, 11);
+               parms->ntcreatexreadx.out.access_time =   
smbcli_pull_nttime(req->in.vwv, 19);
+               parms->ntcreatexreadx.out.write_time =    
smbcli_pull_nttime(req->in.vwv, 27);
+               parms->ntcreatexreadx.out.change_time =   
smbcli_pull_nttime(req->in.vwv, 35);
+               parms->ntcreatexreadx.out.attrib =                   
IVAL(req->in.vwv, 43);
+               parms->ntcreatexreadx.out.alloc_size =               
BVAL(req->in.vwv, 47);
+               parms->ntcreatexreadx.out.size =                     
BVAL(req->in.vwv, 55);
+               parms->ntcreatexreadx.out.file_type =                
SVAL(req->in.vwv, 63);
+               parms->ntcreatexreadx.out.ipc_state =                
SVAL(req->in.vwv, 65);
+               parms->ntcreatexreadx.out.is_directory =             
CVAL(req->in.vwv, 67);
+
+               status = smbcli_chained_advance(req);
+               if (!NT_STATUS_IS_OK(status)) {
+                       return status;
+               }
+
+               SMBCLI_CHECK_WCT(req, 12);
+               parms->ntcreatexreadx.out.remaining       = SVAL(req->in.vwv, 
VWV(2));
+               parms->ntcreatexreadx.out.compaction_mode = SVAL(req->in.vwv, 
VWV(3));
+               parms->ntcreatexreadx.out.nread = SVAL(req->in.vwv, VWV(5));
+               if (parms->ntcreatexreadx.out.nread >
+                   MAX(parms->openxreadx.in.mincnt, 
parms->openxreadx.in.maxcnt) ||
+                   !smbcli_raw_pull_data(&req->in.bufinfo, req->in.hdr + 
SVAL(req->in.vwv, VWV(6)),
+                                         parms->ntcreatexreadx.out.nread,
+                                         parms->ntcreatexreadx.out.data)) {
+                       req->status = NT_STATUS_BUFFER_TOO_SMALL;
+               }
+               break;
+
        case RAW_OPEN_SMB2:
                req->status = NT_STATUS_INTERNAL_ERROR;
                break;
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 9f35aae..49540d8 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -65,7 +65,8 @@ static const char *rdwr_string(enum rdwr_mode m)
 
 #define CHECK_STATUS(status, correct) do { \
        if (!NT_STATUS_EQUAL(status, correct)) { \
-               printf("(%s) Incorrect status %s - should be %s\n", \
+               torture_result(tctx, TORTURE_FAIL, \
+                       "(%s) Incorrect status %s - should be %s\n", \
                       __location__, nt_errstr(status), nt_errstr(correct)); \
                ret = false; \
                goto done; \
@@ -74,7 +75,9 @@ static const char *rdwr_string(enum rdwr_mode m)
 #define CREATE_FILE do { \
        fnum = create_complex_file(cli, tctx, fname); \
        if (fnum == -1) { \
-               printf("(%s) Failed to create %s - %s\n", __location__, fname, 
smbcli_errstr(cli->tree)); \
+               torture_result(tctx, TORTURE_FAIL, \
+                       "(%s) Failed to create %s - %s\n", \
+                        __location__, fname, smbcli_errstr(cli->tree)); \
                ret = false; \
                goto done; \
        }} while (0)
@@ -82,7 +85,8 @@ static const char *rdwr_string(enum rdwr_mode m)
 #define CHECK_RDWR(fnum, correct) do { \
        enum rdwr_mode m = check_rdwr(cli->tree, fnum); \
        if (m != correct) { \
-               printf("(%s) Incorrect readwrite mode %s - expected %s\n", \
+               torture_result(tctx, TORTURE_FAIL, \
+                      "(%s) Incorrect readwrite mode %s - expected %s\n", \
                       __location__, rdwr_string(m), rdwr_string(correct)); \
                ret = false; \
        }} while (0)
@@ -96,7 +100,8 @@ static const char *rdwr_string(enum rdwr_mode m)
        t1 = t & ~1; \
        t2 = nt_time_to_unix(finfo.all_info.out.field) & ~1; \
        if (abs(t1-t2) > 2) { \
-               printf("(%s) wrong time for field %s  %s - %s\n", \
+               torture_result(tctx, TORTURE_FAIL, \
+                      "(%s) wrong time for field %s  %s - %s\n", \
                       __location__, #field, \
                       timestring(tctx, t1), \
                       timestring(tctx, t2)); \
@@ -112,7 +117,8 @@ static const char *rdwr_string(enum rdwr_mode m)
        CHECK_STATUS(status, NT_STATUS_OK); \
        t2 = finfo.all_info.out.field; \
        if (t != t2) { \
-               printf("(%s) wrong time for field %s  %s - %s\n", \
+               torture_result(tctx, TORTURE_FAIL, \
+                      "(%s) wrong time for field %s  %s - %s\n", \
                       __location__, #field, \
                       nt_time_string(tctx, t), \
                       nt_time_string(tctx, t2)); \
@@ -126,7 +132,8 @@ static const char *rdwr_string(enum rdwr_mode m)
        status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \
        CHECK_STATUS(status, NT_STATUS_OK); \
        if ((v) != (finfo.all_info.out.field)) { \
-               printf("(%s) wrong value for field %s  0x%x - 0x%x\n", \
+               torture_result(tctx, TORTURE_FAIL, \
+                      "(%s) wrong value for field %s  0x%x - 0x%x\n", \
                       __location__, #field, (int)v, 
(int)(finfo.all_info.out.field)); \
                dump_all_info(tctx, &finfo); \
                ret = false; \
@@ -134,7 +141,8 @@ static const char *rdwr_string(enum rdwr_mode m)
 
 #define CHECK_VAL(v, correct) do { \
        if ((v) != (correct)) { \
-               printf("(%s) wrong value for %s  0x%x - should be 0x%x\n", \
+               torture_result(tctx, TORTURE_FAIL, \
+                      "(%s) wrong value for %s  0x%x - should be 0x%x\n", \
                       __location__, #v, (int)(v), (int)correct); \
                ret = false; \
        }} while (0)
@@ -147,7 +155,7 @@ static const char *rdwr_string(enum rdwr_mode m)
        sfinfo.basic_info.in.attrib = sattrib; \
        status = smb_raw_setpathinfo(cli->tree, &sfinfo); \
        if (!NT_STATUS_IS_OK(status)) { \
-               printf("(%s) Failed to set attrib 0x%x on %s\n", \
+               torture_warning(tctx, "(%s) Failed to set attrib 0x%x on %s\n", 
\
                       __location__, sattrib, fname); \
        }} while (0)
 
@@ -163,7 +171,7 @@ static bool test_open(struct smbcli_state *cli, struct 
torture_context *tctx)
        int fnum = -1, fnum2;
        bool ret = true;
 
-       printf("Checking RAW_OPEN_OPEN\n");
+       torture_comment(tctx, "Checking RAW_OPEN_OPEN\n");
 
        io.openold.level = RAW_OPEN_OPEN;
        io.openold.in.fname = fname;
@@ -223,7 +231,7 @@ static bool test_open(struct smbcli_state *cli, struct 
torture_context *tctx)
        CHECK_RDWR(fnum, RDWR_RDWR);
        
        if (io.openold.in.open_mode != io.openold.out.rmode) {
-               printf("(%s) rmode should equal open_mode - 0x%x 0x%x\n",
+               torture_warning(tctx, "(%s) rmode should equal open_mode - 0x%x 
0x%x\n",
                       __location__, io.openold.out.rmode, 
io.openold.in.open_mode);
        }
 
@@ -295,7 +303,7 @@ static bool test_openx(struct smbcli_state *cli, struct 
torture_context *tctx)
                { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, false, 
NT_STATUS_OK },
        };
 
-       printf("Checking RAW_OPEN_OPENX\n");
+       torture_comment(tctx, "Checking RAW_OPEN_OPENX\n");
        smbcli_unlink(cli->tree, fname);
 
        io.openx.level = RAW_OPEN_OPENX;
@@ -313,7 +321,9 @@ static bool test_openx(struct smbcli_state *cli, struct 
torture_context *tctx)
                if (open_funcs[i].with_file) {
                        fnum = create_complex_file(cli, tctx, fname);
                        if (fnum == -1) {
-                               d_printf("Failed to create file %s - %s\n", 
fname, smbcli_errstr(cli->tree));
+                               torture_result(tctx, TORTURE_FAIL,
+                                       "Failed to create file %s - %s\n",
+                                       fname, smbcli_errstr(cli->tree));
                                ret = false;
                                goto done;
                        }
@@ -322,9 +332,13 @@ static bool test_openx(struct smbcli_state *cli, struct 
torture_context *tctx)
                io.openx.in.open_func = open_funcs[i].open_func;
                status = smb_raw_open(cli->tree, tctx, &io);
                if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
-                       printf("(%s) incorrect status %s should be %s (i=%d 
with_file=%d open_func=0x%x)\n", 
-                              __location__, nt_errstr(status), 
nt_errstr(open_funcs[i].correct_status),
-                              i, (int)open_funcs[i].with_file, 
(int)open_funcs[i].open_func);
+                       torture_result(tctx, TORTURE_FAIL,
+                               "(%s) incorrect status %s should be %s "
+                               "(i=%d with_file=%d open_func=0x%x)\n",
+                               __location__, nt_errstr(status),
+                               nt_errstr(open_funcs[i].correct_status),
+                               i, (int)open_funcs[i].with_file,
+                               (int)open_funcs[i].open_func);
                        ret = false;
                }
                if (NT_STATUS_IS_OK(status)) {
@@ -424,8 +438,10 @@ static bool test_openx(struct smbcli_state *cli, struct 
torture_context *tctx)
        status = smb_raw_open(cli->tree, tctx, &io);
        CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
        if (timeval_elapsed(&tv) > 3.0) {
-               printf("(%s) Incorrect timing in openx with timeout - waited 
%.2f seconds\n",
-                      __location__, timeval_elapsed(&tv));
+               torture_result(tctx, TORTURE_FAIL,
+                       "(%s) Incorrect timing in openx with timeout "
+                       "- waited %.2f seconds\n",
+                       __location__, timeval_elapsed(&tv));
                ret = false;
        }
        smbcli_close(cli->tree, fnum);
@@ -527,13 +543,15 @@ static bool test_t2open(struct smbcli_state *cli, struct 
torture_context *tctx)
 
        fnum = create_complex_file(cli, tctx, fname1);
        if (fnum == -1) {
-               d_printf("Failed to create file %s - %s\n", fname1, 
smbcli_errstr(cli->tree));
+               torture_result(tctx, TORTURE_FAIL,
+                       "(%s): Failed to create file %s - %s\n",
+                       __location__, fname1, smbcli_errstr(cli->tree));
                ret = false;
                goto done;
        }
        smbcli_close(cli->tree, fnum);
 
-       printf("Checking RAW_OPEN_T2OPEN\n");
+       torture_comment(tctx, "Checking RAW_OPEN_T2OPEN\n");
 
        io.t2open.level = RAW_OPEN_T2OPEN;
        io.t2open.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
@@ -570,16 +588,21 @@ static bool test_t2open(struct smbcli_state *cli, struct 
torture_context *tctx)
                if ((io.t2open.in.num_eas != 0)
                    && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)
                    && torture_setting_bool(tctx, "samba3", false)) {
-                       printf("(%s) EAs not supported, not treating as fatal "
-                              "in Samba3 test\n", __location__);
+                       torture_warning(tctx, "(%s) EAs not supported, not "
+                               "treating as fatal in Samba3 test\n",
+                               __location__);
                        io.t2open.in.num_eas = 0;
                        goto again;
                }
 
                if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
-                       printf("(%s) incorrect status %s should be %s (i=%d 
with_file=%d open_func=0x%x)\n", 
-                              __location__, nt_errstr(status), 
nt_errstr(open_funcs[i].correct_status),
-                              i, (int)open_funcs[i].with_file, 
(int)open_funcs[i].open_func);
+                       torture_result(tctx, TORTURE_FAIL,
+                               "(%s) incorrect status %s should be %s "
+                               "(i=%d with_file=%d open_func=0x%x)\n",
+                                __location__, nt_errstr(status),
+                               nt_errstr(open_funcs[i].correct_status),
+                               i, (int)open_funcs[i].with_file,
+                               (int)open_funcs[i].open_func);
                        ret = false;
                }
                if (NT_STATUS_IS_OK(status)) {
@@ -691,7 +714,7 @@ static bool test_ntcreatex(struct smbcli_state *cli, struct 
torture_context *tct
                { 6,                            false, 
NT_STATUS_INVALID_PARAMETER },
        };
 
-       printf("Checking RAW_OPEN_NTCREATEX\n");
+       torture_comment(tctx, "Checking RAW_OPEN_NTCREATEX\n");
 
        /* reasonable default parameters */
        io.generic.level = RAW_OPEN_NTCREATEX;
@@ -712,7 +735,9 @@ static bool test_ntcreatex(struct smbcli_state *cli, struct 
torture_context *tct
                if (open_funcs[i].with_file) {
                        fnum = smbcli_open(cli->tree, fname, 
O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
                        if (fnum == -1) {
-                               d_printf("Failed to create file %s - %s\n", 
fname, smbcli_errstr(cli->tree));
+                               torture_result(tctx, TORTURE_FAIL,
+                                       "Failed to create file %s - %s\n",
+                                       fname, smbcli_errstr(cli->tree));
                                ret = false;
                                goto done;
                        }
@@ -721,9 +746,13 @@ static bool test_ntcreatex(struct smbcli_state *cli, 
struct torture_context *tct
                io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
                status = smb_raw_open(cli->tree, tctx, &io);
                if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
-                       printf("(%s) incorrect status %s should be %s (i=%d 
with_file=%d open_disp=%d)\n", 
-                              __location__, nt_errstr(status), 
nt_errstr(open_funcs[i].correct_status),
-                              i, (int)open_funcs[i].with_file, 
(int)open_funcs[i].open_disp);
+                       torture_result(tctx, TORTURE_FAIL,
+                               "(%s) incorrect status %s should be %s "
+                               "(i=%d with_file=%d open_disp=%d)\n",
+                               __location__, nt_errstr(status),
+                               nt_errstr(open_funcs[i].correct_status),
+                               i, (int)open_funcs[i].with_file,
+                               (int)open_funcs[i].open_disp);
                        ret = false;
                }
                if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
@@ -866,7 +895,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, 
struct torture_context
                { 6,                            false, 
NT_STATUS_INVALID_PARAMETER },
        };
 
-       printf("Checking RAW_OPEN_NTTRANS_CREATE\n");
+       torture_comment(tctx, "Checking RAW_OPEN_NTTRANS_CREATE\n");
 
        /* reasonable default parameters */
        io.generic.level = RAW_OPEN_NTTRANS_CREATE;
@@ -889,7 +918,9 @@ static bool test_nttrans_create(struct smbcli_state *cli, 
struct torture_context
                if (open_funcs[i].with_file) {
                        fnum = smbcli_open(cli->tree, fname, 
O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
                        if (fnum == -1) {
-                               d_printf("Failed to create file %s - %s\n", 
fname, smbcli_errstr(cli->tree));
+                               torture_result(tctx, TORTURE_FAIL,
+                                       "Failed to create file %s - %s\n",
+                                       fname, smbcli_errstr(cli->tree));
                                ret = false;
                                goto done;
                        }
@@ -898,9 +929,13 @@ static bool test_nttrans_create(struct smbcli_state *cli, 
struct torture_context
                io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
                status = smb_raw_open(cli->tree, tctx, &io);
                if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
-                       printf("(%s) incorrect status %s should be %s (i=%d 
with_file=%d open_disp=%d)\n", 
-                              __location__, nt_errstr(status), 
nt_errstr(open_funcs[i].correct_status),
-                              i, (int)open_funcs[i].with_file, 
(int)open_funcs[i].open_disp);
+                       torture_result(tctx, TORTURE_FAIL,
+                               "(%s) incorrect status %s should be %s "
+                               "(i=%d with_file=%d open_disp=%d)\n",
+                               __location__, nt_errstr(status),
+                               nt_errstr(open_funcs[i].correct_status),
+                               i, (int)open_funcs[i].with_file,
+                               (int)open_funcs[i].open_disp);
                        ret = false;
                }
                if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
@@ -984,8 +1019,9 @@ static bool test_nttrans_create(struct smbcli_state *cli, 
struct torture_context
                io.ntcreatex.in.create_options = create_option;
                status = smb_raw_open(cli->tree, tctx, &io);
                if (!NT_STATUS_IS_OK(status)) {
-                       printf("ntcreatex create option 0x%08x gave %s - should 
give NT_STATUS_OK\n",
-                              create_option, nt_errstr(status));
+                       torture_warning(tctx, "ntcreatex create option 0x%08x "
+                               "gave %s - should give NT_STATUS_OK\n",
+                               create_option, nt_errstr(status));
                }
                CHECK_STATUS(status, NT_STATUS_OK);
                fnum = io.ntcreatex.out.file.fnum;
@@ -1032,7 +1068,8 @@ static bool test_nttrans_create(struct smbcli_state *cli, 
struct torture_context
                        not_a_directory_mask |= 1<<i;
                } else {
                        unexpected_mask |= 1<<i;
-                       printf("create option 0x%08x returned %s\n", 
create_option, nt_errstr(status));
+                       torture_comment(tctx, "create option 0x%08x returned 
%s\n",
+                                       create_option, nt_errstr(status));
                }
        }
 
@@ -1110,7 +1147,7 @@ static bool test_ntcreatex_brlocked(struct smbcli_state 
*cli, struct torture_con
        NTSTATUS status;
        bool ret = true;
 
-       printf("Testing ntcreatex with a byte range locked file\n");
+       torture_comment(tctx, "Testing ntcreatex with a byte range locked 
file\n");
 
        io.generic.level = RAW_OPEN_NTCREATEX;
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
@@ -1181,7 +1218,7 @@ static bool test_mknew(struct smbcli_state *cli, struct 
torture_context *tctx)
        time_t basetime = (time(NULL) + 3600*24*3) & ~1;
        union smb_fileinfo finfo;
 
-       printf("Checking RAW_OPEN_MKNEW\n");
+       torture_comment(tctx, "Checking RAW_OPEN_MKNEW\n");
 
        io.mknew.level = RAW_OPEN_MKNEW;
        io.mknew.in.attrib = 0;
@@ -1236,7 +1273,7 @@ static bool test_create(struct smbcli_state *cli, struct 
torture_context *tctx)
        time_t basetime = (time(NULL) + 3600*24*3) & ~1;
        union smb_fileinfo finfo;
 
-       printf("Checking RAW_OPEN_CREATE\n");
+       torture_comment(tctx, "Checking RAW_OPEN_CREATE\n");
 
        io.create.level = RAW_OPEN_CREATE;
        io.create.in.attrib = 0;
@@ -1292,7 +1329,7 @@ static bool test_ctemp(struct smbcli_state *cli, 
TALLOC_CTX *tctx)
        union smb_fileinfo finfo;
        const char *name, *fname = NULL;
 
-       printf("Checking RAW_OPEN_CTEMP\n");
+       torture_comment(tctx, "Checking RAW_OPEN_CTEMP\n");
 
        io.ctemp.level = RAW_OPEN_CTEMP;
        io.ctemp.in.attrib = FILE_ATTRIBUTE_HIDDEN;
@@ -1310,7 +1347,7 @@ static bool test_ctemp(struct smbcli_state *cli, 
TALLOC_CTX *tctx)
        CHECK_STATUS(status, NT_STATUS_OK);


-- 
Samba Shared Repository

Reply via email to