From 84bbe948f3beff0fbdc51c9c63e2f674b70b5bbe Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 2 Oct 2004 12:25:02 +0000 Subject: r2786: - match on both long and short name for search posix backend - a final name component of . is illegal (This used to be commit 11c852170b83e5adbdb58407e1c7d3aeb4ab5bb8) --- source4/ntvfs/posix/pvfs_resolve.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source4/ntvfs/posix/pvfs_resolve.c') diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c index dfd6744eff..e846b7be77 100644 --- a/source4/ntvfs/posix/pvfs_resolve.c +++ b/source4/ntvfs/posix/pvfs_resolve.c @@ -159,6 +159,7 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name, uint_t flags, struct pvfs_filename *name) { char *ret, *p; + size_t len; name->original_name = talloc_strdup(name, cifs_name); name->stream_name = NULL; @@ -183,8 +184,13 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name, p = ret + strlen(pvfs->base_directory) + 1; - if (p[strlen(cifs_name)-1] == '\\') { - p[strlen(cifs_name)-1] = 0; + len = strlen(cifs_name); + if (len>0 && p[len-1] == '\\') { + p[len-1] = 0; + len--; + } + if (len>1 && p[len-1] == '.' && p[len-2] == '\\') { + return NT_STATUS_OBJECT_NAME_INVALID; } /* now do an in-place conversion of '\' to '/', checking -- cgit