From: Jeremy Allison Date: Tue, 22 Feb 2005 20:55:48 +0000 (+0000) Subject: r5510: Optimisation to only do can_delete check if client asks for FILE_SHARE_DELETE. X-Git-Tag: samba-misc-tags/initial-v3-0-unstable~5240 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e2d0fcdbb72735f8b53d9faaec07d711ae236d0;p=thirdparty%2Fsamba.git r5510: Optimisation to only do can_delete check if client asks for FILE_SHARE_DELETE. Not completely correct but will catch the XP SP2 problem. Jeremy. --- diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c index 53fee175afd..f07fd8c25b5 100644 --- a/source/smbd/nttrans.c +++ b/source/smbd/nttrans.c @@ -780,7 +780,16 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib } } +#if 0 + /* This is the correct thing to do (check every time) but can_delete is + expensive (it may have to read the parent directory permissions). So + for now we're not doing it unless we have a strong hint the client + is really going to delete this file. */ if (desired_access & DELETE_ACCESS) { +#else + /* Setting FILE_SHARE_DELETE is the hint. */ + if ((share_access & FILE_SHARE_DELETE) && (desired_access & DELETE_ACCESS)) { +#endif status = can_delete(conn, fname, file_attributes, bad_path, True); /* We're only going to fail here if it's access denied, as that's the only error we care about for "can we delete this ?" questions. */