r20720: Fix the chkpath problem, still looking at findfirst.
authorJeremy Allison <jra@samba.org>
Sat, 13 Jan 2007 01:07:39 +0000 (01:07 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:17:05 +0000 (12:17 -0500)
Jeremy.
(This used to be commit c5be0082ef60cd041121a9c36f4af934cd60562d)

source3/smbd/filename.c
source3/smbd/reply.c

index 3f02f6090fae9f47d40ac4af46ce9cf3c41c0fa4..44916200daae7b629559ab6126d7dde92a74e942 100644 (file)
@@ -147,7 +147,12 @@ NTSTATUS unix_convert(connection_struct *conn,
 
        if (name[0] == '.' && (name[1] == '/' || name[1] == '\0')) {
                /* Start of pathname can't be "." only. */
-               return NT_STATUS_OBJECT_NAME_INVALID;
+               if (name[1] == '\0' || name[2] == '\0') {
+                       return NT_STATUS_OBJECT_NAME_INVALID;
+               } else {
+                       /* Longer pathname starts with ./ */
+                       return NT_STATUS_OBJECT_PATH_NOT_FOUND;
+               }
        }
 
        /*
index 5914a3b169e0b6d25155877720b6877de6d79991..e42c663cecf6d6735cfdb84165a2692517d4b5ab 100644 (file)
@@ -632,6 +632,13 @@ int reply_chkpth(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
        status = unix_convert(conn, name, False, NULL, &sbuf);
        if (!NT_STATUS_IS_OK(status)) {
                END_PROFILE(SMBchkpth);
+               /* Strange DOS error code semantics only for chkpth... */
+               if (!(SVAL(inbuf,smb_flg2) & FLAGS2_32_BIT_ERROR_CODES)) {
+                       if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_INVALID,status)) {
+                               /* We need to map to ERRbadpath */
+                               status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
+                       }
+               }
                return ERROR_NT(status);
        }