The branch, master has been updated
       via  b85f6f6... s4 torture: Add new RAW-SEARCH test to explore strange 
max count behavior
       via  8ba02d9... s4 torture: Update RAW-QFILEINFO to only test info 
levels that are supported by the server
      from  5930f77... s4 torture: Convert RAW-OPEN to suite form

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


- Log -----------------------------------------------------------------
commit b85f6f63e6e957970f09acb2aab14e63d2661a22
Author: Aravind Srinivasan <aravind.sriniva...@isilon.com>
Date:   Tue Dec 15 09:49:08 2009 -0800

    s4 torture: Add new RAW-SEARCH test to explore strange max count behavior
    
    Signed-off-by: Tim Prouty <tpro...@samba.org>

commit 8ba02d9ed9d1f6f330ed1f72d919bfa3869e37f5
Author: Aravind Srinivasan <aravind.sriniva...@isilon.com>
Date:   Tue Dec 15 09:22:07 2009 -0800

    s4 torture: Update RAW-QFILEINFO to only test info levels that are 
supported by the server
    
    Signed-off-by: Tim Prouty <tpro...@samba.org>

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

Summary of changes:
 source4/torture/raw/qfileinfo.c |   33 +++++++++++++++++
 source4/torture/raw/search.c    |   75 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index d21d1dc..85f9f1b 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -265,11 +265,26 @@ static bool torture_raw_qfileinfo_internals(struct 
torture_context *torture,
 
                if (is_ipc) {
                        if (levels[i].expected_ipc_access_denied && 
NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, levels[i].fname_status)) {
+                       } else if (!levels[i].only_handles &&
+                                  NT_STATUS_EQUAL(levels[i].fname_status,
+                                  NT_STATUS_NOT_SUPPORTED)) {
+                               torture_warning(torture, "fname level %s %s",
+                                       levels[i].name,
+                                       nt_errstr(levels[i].fname_status));
+                               continue;
                        } else if (!levels[i].only_handles && 
!NT_STATUS_EQUAL(NT_STATUS_INVALID_DEVICE_REQUEST, levels[i].fname_status)) {
                                printf("ERROR: fname level %s failed, expected 
NT_STATUS_INVALID_DEVICE_REQUEST - %s\n", 
                                       levels[i].name, 
nt_errstr(levels[i].fname_status));
                                count++;
                        }
+                       if (!levels[i].only_paths &&
+                           NT_STATUS_EQUAL(levels[i].fnum_status,
+                           NT_STATUS_NOT_SUPPORTED)) {
+                               torture_warning(torture, "fnum level %s %s",
+                                       levels[i].name,
+                                       nt_errstr(levels[i].fnum_status));
+                               continue;
+                       }
                        if (!levels[i].only_paths && 
!NT_STATUS_EQUAL(levels[i].expected_ipc_fnum_status, levels[i].fnum_status)) {
                                printf("ERROR: fnum level %s failed, expected 
%s - %s\n", 
                                       levels[i].name, 
nt_errstr(levels[i].expected_ipc_fnum_status), 
@@ -277,6 +292,24 @@ static bool torture_raw_qfileinfo_internals(struct 
torture_context *torture,
                                count++;
                        }
                } else {
+                       if (!levels[i].only_paths &&
+                           NT_STATUS_EQUAL(levels[i].fnum_status,
+                           NT_STATUS_NOT_SUPPORTED)) {
+                               torture_warning(torture, "fnum level %s %s",
+                                       levels[i].name,
+                                       nt_errstr(levels[i].fnum_status));
+                               continue;
+                       }
+
+                       if (!levels[i].only_handles &&
+                           NT_STATUS_EQUAL(levels[i].fname_status,
+                           NT_STATUS_NOT_SUPPORTED)) {
+                                torture_warning(torture, "fname level %s %s",
+                                       levels[i].name,
+                                       nt_errstr(levels[i].fname_status));
+                               continue;
+                       }
+
                        if (!levels[i].only_paths && 
!NT_STATUS_IS_OK(levels[i].fnum_status)) {
                                printf("ERROR: fnum level %s failed - %s\n", 
                                       levels[i].name, 
nt_errstr(levels[i].fnum_status));
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c
index 74186e3..dec7da0 100644
--- a/source4/torture/raw/search.c
+++ b/source4/torture/raw/search.c
@@ -1376,7 +1376,81 @@ static bool test_ea_list(struct torture_context *tctx,
        return ret;
 }
 
+/*
+ Test the behavior of max count parameter in TRANS2_FIND_FIRST2 and
+ TRANS2_FIND_NEXT2 queries
+*/
+static bool test_max_count(struct torture_context *tctx,
+                          struct smbcli_state *cli)
+{
+       const int num_files = 2;
+       int i, fnum;
+       char *fname;
+       bool ret = true;
+       NTSTATUS status;
+       struct multiple_result result;
+       union smb_search_first io;
+       union smb_search_next io2;
+
+       if (!torture_setup_dir(cli, BASEDIR)) {
+               return false;
+       }
+
+       torture_comment(tctx, "Creating %d files\n", num_files);
+
+       for (i=num_files-1;i>=0;i--) {
+               fname = talloc_asprintf(cli, BASEDIR "\\t%03d-%d.txt", i, i);
+               fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
+               if (fnum == -1) {
+                       torture_comment(tctx,
+                               "Failed to create %s - %s\n",
+                               fname, smbcli_errstr(cli->tree));
+                       ret = false;
+                       goto done;
+               }
+               talloc_free(fname);
+               smbcli_close(cli->tree, fnum);
+       }
+
+       torture_comment(tctx, "Set max_count parameter to 0. "
+                       "This should return 1 entry\n");
+       ZERO_STRUCT(result);
+       result.tctx = talloc_new(tctx);
 
+       io.t2ffirst.level = RAW_SEARCH_TRANS2;
+       io.t2ffirst.data_level = RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO;
+       io.t2ffirst.in.search_attrib = 0;
+       io.t2ffirst.in.max_count = 0;
+       io.t2ffirst.in.flags = 0;
+       io.t2ffirst.in.storage_type = 0;
+       io.t2ffirst.in.pattern = BASEDIR "\\*.*";
+
+       status = smb_raw_search_first(cli->tree, tctx,
+                                     &io, &result, multiple_search_callback);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VALUE(result.count, 1);
+
+       torture_comment(tctx, "Set max_count to 1. This should also "
+                       "return 1 entry\n");
+       io2.t2fnext.level = RAW_SEARCH_TRANS2;
+       io2.t2fnext.data_level = RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO;
+       io2.t2fnext.in.handle = io.t2ffirst.out.handle;
+       io2.t2fnext.in.max_count = 1;
+       io2.t2fnext.in.resume_key = 0;
+       io2.t2fnext.in.flags = 0;
+       io2.t2fnext.in.last_name =
+               result.list[result.count-1].both_directory_info.name.s;
+
+       status = smb_raw_search_next(cli->tree, tctx,
+                                    &io2, &result, multiple_search_callback);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VALUE(result.count, 2);
+done:
+       smb_raw_exit(cli->session);
+       smbcli_deltree(cli->tree, BASEDIR);
+
+       return ret;
+}
 
 /* 
    basic testing of all RAW_SEARCH_* calls using a single file
@@ -1392,6 +1466,7 @@ struct torture_suite *torture_raw_search(TALLOC_CTX 
*mem_ctx)
        torture_suite_add_1smb_test(suite, "many dirs", test_many_dirs);
        torture_suite_add_1smb_test(suite, "os2 delete", test_os2_delete);
        torture_suite_add_1smb_test(suite, "ea list", test_ea_list);
+       torture_suite_add_1smb_test(suite, "max count", test_max_count);
 
        return suite;
 }


-- 
Samba Shared Repository

Reply via email to