In looking at some smbtorture DENY1 tests, I noticed that Samba returns NT_STATUS_ACCESS_DENIED when Win2K returns NT_STATUS_SHARING_VIOLATION. This happens when a file is opened and then opened again with an OpenX call where DENY=ALL is specified. The problem is that open_file_shared returns NULL (or False) if it could not open the file, and we get no idea why the file could not be opened when we try to handle the problem in reply_open_and_X (or anywhere else). A couple of solutions suggest themselves: 1. Allow file_open_shared1 to handle the error it self and generate the error response, or 2. Have file_open_shared and file_open_shared1 return an error status that can be used by callers to give better error returns.
Since we now have an internal bug logged to fix this problem, I was thinking of making the following changes ... 1. Change open_file_shared and open_file_shared1 to return an NT_STATUS result. 2. Change all the returns in open_file_shared1 to STATUS_ACCESS_DENIED except for those cases where ENOMEM or SHARING_VIOLATION applies. 3. Change the functions that call open_file_shared to map the status returned as needed and plug it into the response. Do we have any dissent?
OK, it seems that the fix can be simpler than that, since there is already a mechanism for providing explicit error returns there. At the bottom of the loop that deals with share mode violations, add something like: unix_ERR_class = ERRDOS; unix_ERR_code = ERRbadshare; unix_ERR_ntstatus = NT_STATUS_SHARING_VIOLATION; just before the 'return NULL;'
is this fixed?
closing. no response from richard.