Author: tridge Date: 2004-10-25 07:58:47 +0000 (Mon, 25 Oct 2004) New Revision: 3207
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=3207&nolog=1 Log: - 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 Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_search.c branches/SAMBA_4_0/source/ntvfs/posix/pvfs_unlink.c branches/SAMBA_4_0/source/ntvfs/posix/pvfs_util.c branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h branches/SAMBA_4_0/source/script/tests/test_posix.sh branches/SAMBA_4_0/source/torture/basic/dir.c Changeset: Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_search.c =================================================================== --- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_search.c 2004-10-25 07:56:48 UTC (rev 3206) +++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_search.c 2004-10-25 07:58:47 UTC (rev 3207) @@ -54,7 +54,7 @@ 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 @@ 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 @@ search->dir = dir; search->current_index = 0; search->search_attrib = search_attrib; + search->must_attrib = 0; talloc_set_destructor(search, pvfs_search_destructor); Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_unlink.c =================================================================== --- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_unlink.c 2004-10-25 07:56:48 UTC (rev 3206) +++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_unlink.c 2004-10-25 07:58:47 UTC (rev 3207) @@ -42,7 +42,7 @@ } /* 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; } Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_util.c =================================================================== --- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_util.c 2004-10-25 07:56:48 UTC (rev 3206) +++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_util.c 2004-10-25 07:58:47 UTC (rev 3207) @@ -49,11 +49,15 @@ 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; } Modified: branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h =================================================================== --- branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h 2004-10-25 07:56:48 UTC (rev 3206) +++ branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h 2004-10-25 07:58:47 UTC (rev 3207) @@ -90,6 +90,7 @@ uint16_t handle; uint_t current_index; uint16_t search_attrib; + uint16_t must_attrib; struct pvfs_dir *dir; }; Modified: branches/SAMBA_4_0/source/script/tests/test_posix.sh =================================================================== --- branches/SAMBA_4_0/source/script/tests/test_posix.sh 2004-10-25 07:56:48 UTC (rev 3206) +++ branches/SAMBA_4_0/source/script/tests/test_posix.sh 2004-10-25 07:58:47 UTC (rev 3207) @@ -30,7 +30,7 @@ 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-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" Modified: branches/SAMBA_4_0/source/torture/basic/dir.c =================================================================== --- branches/SAMBA_4_0/source/torture/basic/dir.c 2004-10-25 07:56:48 UTC (rev 3206) +++ branches/SAMBA_4_0/source/torture/basic/dir.c 2004-10-25 07:58:47 UTC (rev 3207) @@ -53,7 +53,8 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ 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; }