r23346: Fix offline caching with XP/Vista. It was an off-by-one
[tprouty/samba.git] / source / smbd / filename.c
index a36b7ff28211a4cdccfb9ae0897284b918b5a8eb..c26eba2ded2755a19c3000e5b7dea7f7a03f50ab 100644 (file)
@@ -462,6 +462,12 @@ NTSTATUS unix_convert(connection_struct *conn,
                        }
                } /* end else */
 
+#ifdef DEVELOPER
+               if (VALID_STAT(st) && get_delete_on_close_flag(file_id_sbuf(&st))) {
+                       return NT_STATUS_DELETE_PENDING;
+               }
+#endif
+
                /* 
                 * Add to the dirpath that we have resolved so far.
                 */
@@ -512,28 +518,25 @@ NTSTATUS unix_convert(connection_struct *conn,
  a valid one for the user to access.
 ****************************************************************************/
 
-BOOL check_name(const pstring name,connection_struct *conn)
+NTSTATUS check_name(connection_struct *conn, const pstring name)
 {
-       BOOL ret = True;
-
        if (IS_VETO_PATH(conn, name))  {
                /* Is it not dot or dot dot. */
                if (!((name[0] == '.') && (!name[1] || (name[1] == '.' && !name[2])))) {
-                       DEBUG(5,("file path name %s vetoed\n",name));
-                       errno = ENOENT;
-                       return False;
+                       DEBUG(5,("check_name: file path name %s vetoed\n",name));
+                       return map_nt_error_from_unix(ENOENT);
                }
        }
 
        if (!lp_widelinks(SNUM(conn)) || !lp_symlinks(SNUM(conn))) {
-               ret = reduce_name(conn,name);
-       }
-
-       if (!ret) {
-               DEBUG(5,("check_name on %s failed\n",name));
+               NTSTATUS status = reduce_name(conn,name);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(5,("check_name: name %s failed with %s\n",name, nt_errstr(status)));
+                       return status;
+               }
        }
 
-       return(ret);
+       return NT_STATUS_OK;
 }
 
 /****************************************************************************