diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-10-25 07:58:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:04:41 -0500 |
commit | ee0c87b4c98e2d3878aa7ab7f8919aa16c4aa063 (patch) | |
tree | 522611b1e1b35ac0c5117c675e78391e79d2a08f /source4 | |
parent | e1c43f243a7dea8c8a7ae235252091d1e18c2fb4 (diff) | |
download | samba-ee0c87b4c98e2d3878aa7ab7f8919aa16c4aa063.tar.gz samba-ee0c87b4c98e2d3878aa7ab7f8919aa16c4aa063.tar.bz2 samba-ee0c87b4c98e2d3878aa7ab7f8919aa16c4aa063.zip |
r3207: - reformat error msgs in BASE-DIR* tests
- added support for mandatory attributes in old style directory search
- we now pass BASE-DIR1 and BASE-DIR2
(This used to be commit efaa0eaec49e952aa515c3448246d9048a484c26)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/ntvfs/posix/pvfs_search.c | 6 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_unlink.c | 2 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_util.c | 6 | ||||
-rw-r--r-- | source4/ntvfs/posix/vfs_posix.h | 1 | ||||
-rwxr-xr-x | source4/script/tests/test_posix.sh | 4 | ||||
-rw-r--r-- | source4/torture/basic/dir.c | 24 |
6 files changed, 27 insertions, 16 deletions
diff --git a/source4/ntvfs/posix/pvfs_search.c b/source4/ntvfs/posix/pvfs_search.c index 1464609e98..ff9ad20b43 100644 --- a/source4/ntvfs/posix/pvfs_search.c +++ b/source4/ntvfs/posix/pvfs_search.c @@ -54,7 +54,7 @@ static NTSTATUS fill_search_info(struct pvfs_state *pvfs, return status; } - if (!pvfs_match_attrib(pvfs, name, search->search_attrib)) { + if (!pvfs_match_attrib(pvfs, name, search->search_attrib, search->must_attrib)) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; } @@ -296,7 +296,8 @@ static NTSTATUS pvfs_search_first_old(struct ntvfs_module_context *ntvfs, search->handle = id; search->dir = dir; search->current_index = 0; - search->search_attrib = search_attrib; + search->search_attrib = search_attrib & 0xFF; + search->must_attrib = (search_attrib>>8) & 0xFF; talloc_set_destructor(search, pvfs_search_destructor); @@ -425,6 +426,7 @@ NTSTATUS pvfs_search_first(struct ntvfs_module_context *ntvfs, search->dir = dir; search->current_index = 0; search->search_attrib = search_attrib; + search->must_attrib = 0; talloc_set_destructor(search, pvfs_search_destructor); diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index 10a27a5de7..12ab583082 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -42,7 +42,7 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, } /* make sure its matches the given attributes */ - if (!pvfs_match_attrib(pvfs, name, attrib)) { + if (!pvfs_match_attrib(pvfs, name, attrib, 0)) { talloc_free(name); return NT_STATUS_OBJECT_NAME_NOT_FOUND; } diff --git a/source4/ntvfs/posix/pvfs_util.c b/source4/ntvfs/posix/pvfs_util.c index 3c65453798..ae1dc6236d 100644 --- a/source4/ntvfs/posix/pvfs_util.c +++ b/source4/ntvfs/posix/pvfs_util.c @@ -49,11 +49,15 @@ NTSTATUS pvfs_map_errno(struct pvfs_state *pvfs, int unix_errno) this is used by calls like unlink and search which take an attribute and only include special files if they match the given attribute */ -BOOL pvfs_match_attrib(struct pvfs_state *pvfs, struct pvfs_filename *name, uint32_t attrib) +BOOL pvfs_match_attrib(struct pvfs_state *pvfs, struct pvfs_filename *name, + uint32_t attrib, uint32_t must_attrib) { if ((name->dos.attrib & ~attrib) & (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_SYSTEM)) { return False; } + if (must_attrib & ~name->dos.attrib) { + return False; + } return True; } diff --git a/source4/ntvfs/posix/vfs_posix.h b/source4/ntvfs/posix/vfs_posix.h index d4c0b19974..656ac85380 100644 --- a/source4/ntvfs/posix/vfs_posix.h +++ b/source4/ntvfs/posix/vfs_posix.h @@ -90,6 +90,7 @@ struct pvfs_search_state { uint16_t handle; uint_t current_index; uint16_t search_attrib; + uint16_t must_attrib; struct pvfs_dir *dir; }; diff --git a/source4/script/tests/test_posix.sh b/source4/script/tests/test_posix.sh index 1953f43e76..88608a59c9 100755 --- a/source4/script/tests/test_posix.sh +++ b/source4/script/tests/test_posix.sh @@ -30,7 +30,7 @@ testit() { tests="BASE-FDPASS BASE-LOCK1 BASE-LOCK2 BASE-LOCK3 BASE-LOCK4" tests="$tests BASE-LOCK5 BASE-LOCK6 BASE-LOCK7 BASE-UNLINK BASE-ATTR" -tests="$tests BASE-NEGNOWAIT BASE-DIR BASE-VUID" +tests="$tests BASE-NEGNOWAIT BASE-DIR1 BASE-DIR2 BASE-VUID" tests="$tests BASE-DENY2 BASE-TCON BASE-TCONDEV BASE-RW1" tests="$tests BASE-DENY3 BASE-XCOPY BASE-OPEN" tests="$tests BASE-DELETE BASE-PROPERTIES BASE-MANGLE" @@ -39,7 +39,7 @@ tests="$tests RAW-QFSINFO RAW-QFILEINFO RAW-SFILEINFO-BUG" tests="$tests RAW-LOCK RAW-MKDIR RAW-SEEK RAW-CONTEXT BASE-RENAME" -soon="BASE-DIR1 BASE-DENY1 BASE-DEFER_OPEN BASE-OPENATTR BASE-CHARSET" +soon="BASE-DENY1 BASE-DEFER_OPEN BASE-OPENATTR BASE-CHARSET" soon="$soon RAW-SFILEINFO RAW-SEARCH RAW-OPEN RAW-OPLOCK RAW-NOTIFY RAW-MUX RAW-IOCTL" soon="$soon RAW-CHKPATH RAW-UNLINK RAW-READ RAW-WRITE RAW-RENAME RAW-CLOSE BASE-TRANS2" diff --git a/source4/torture/basic/dir.c b/source4/torture/basic/dir.c index a5996ae5ab..de2944e7fe 100644 --- a/source4/torture/basic/dir.c +++ b/source4/torture/basic/dir.c @@ -53,7 +53,8 @@ BOOL torture_dirtest1(int dummy) asprintf(&fname, "\\%x", (int)random()); fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { - fprintf(stderr,"Failed to open %s\n", fname); + fprintf(stderr,"(%s) Failed to open %s\n", + __location__, fname); return False; } smbcli_close(cli->tree, fnum); @@ -117,7 +118,8 @@ BOOL torture_dirtest2(int dummy) fnum = smbcli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_ARCHIVE, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); if (fnum == -1) { - fprintf(stderr,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree)); + fprintf(stderr,"(%s) Failed to open %s, error=%s\n", + __location__, fname, smbcli_errstr(cli->tree)); return False; } free(fname); @@ -127,7 +129,8 @@ BOOL torture_dirtest2(int dummy) char *fname; asprintf(&fname, "\\LISTDIR\\d%d", i); if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) { - fprintf(stderr,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree)); + fprintf(stderr,"(%s) Failed to open %s, error=%s\n", + __location__, fname, smbcli_errstr(cli->tree)); return False; } free(fname); @@ -139,8 +142,8 @@ BOOL torture_dirtest2(int dummy) /* We should see (torture_entries) each of files & directories + . and .. */ if (num_seen != (2*torture_entries)+2) { correct = False; - fprintf(stderr,"entry count mismatch, should be %d, was %d\n", - (2*torture_entries)+2, num_seen); + fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", + __location__, (2*torture_entries)+2, num_seen); } @@ -151,21 +154,22 @@ BOOL torture_dirtest2(int dummy) printf("num_seen = %d\n", num_seen ); if (num_seen != torture_entries+2) { correct = False; - fprintf(stderr,"entry count mismatch, should be %d, was %d\n", - torture_entries+2, num_seen); + fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", + __location__, torture_entries+2, num_seen); } num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); printf("num_seen = %d\n", num_seen ); if (num_seen != torture_entries) { correct = False; - fprintf(stderr,"entry count mismatch, should be %d, was %d\n", - torture_entries, num_seen); + fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", + __location__, torture_entries, num_seen); } /* Delete everything. */ if (smbcli_deltree(cli->tree, "\\LISTDIR") == -1) { - fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", smbcli_errstr(cli->tree)); + fprintf(stderr,"(%s) Failed to deltree %s, error=%s\n", "\\LISTDIR", + __location__, smbcli_errstr(cli->tree)); return False; } |