s3: Unify stream testing in open_directory
authorVolker Lendecke <vl@samba.org>
Tue, 31 Jan 2012 16:26:34 +0000 (17:26 +0100)
committerVolker Lendecke <vlendec@samba.org>
Tue, 31 Jan 2012 19:15:36 +0000 (20:15 +0100)
The second if-statement could never have kicked in, assuming the
SMB_ASSERT above was right.

Jeremy, please check!

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Jan 31 20:15:36 CET 2012 on sn-devel-104

source3/smbd/open.c

index 1c15ca40618739fcaf75af8fb8b3438f3ab685a3..3374fdb2723c1fc4c29ca811e3a5c978f41424d0 100644 (file)
@@ -2675,7 +2675,11 @@ static NTSTATUS open_directory(connection_struct *conn,
        struct timespec mtimespec;
        int info = 0;
 
-       SMB_ASSERT(!is_ntfs_stream_smb_fname(smb_dname));
+       if (is_ntfs_stream_smb_fname(smb_dname)) {
+               DEBUG(2, ("open_directory: %s is a stream name!\n",
+                         smb_fname_str_dbg(smb_dname)));
+               return NT_STATUS_NOT_A_DIRECTORY;
+       }
 
        /* Ensure we have a directory attribute. */
        file_attributes |= FILE_ATTRIBUTE_DIRECTORY;
@@ -2690,14 +2694,6 @@ static NTSTATUS open_directory(connection_struct *conn,
                 (unsigned int)create_disposition,
                 (unsigned int)file_attributes));
 
-       if (!(file_attributes & FILE_FLAG_POSIX_SEMANTICS) &&
-           (conn->fs_capabilities & FILE_NAMED_STREAMS) &&
-           is_ntfs_stream_smb_fname(smb_dname)) {
-               DEBUG(2, ("open_directory: %s is a stream name!\n",
-                         smb_fname_str_dbg(smb_dname)));
-               return NT_STATUS_NOT_A_DIRECTORY;
-       }
-
        status = smbd_calculate_access_mask(conn, smb_dname,
                                            access_mask, &access_mask);
        if (!NT_STATUS_IS_OK(status)) {