From ee0c87b4c98e2d3878aa7ab7f8919aa16c4aa063 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 25 Oct 2004 07:58:47 +0000 Subject: 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) --- source4/ntvfs/posix/pvfs_search.c | 6 ++++-- source4/ntvfs/posix/pvfs_unlink.c | 2 +- source4/ntvfs/posix/pvfs_util.c | 6 +++++- source4/ntvfs/posix/vfs_posix.h | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) (limited to 'source4/ntvfs/posix') 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; }; -- cgit