change_to_root_user();
/* does this protocol need a valid tree connection? */
- if ((flags & AS_USER) && !conn)
- return ERROR_DOS(ERRSRV, ERRinvnid);
+ if ((flags & AS_USER) && !conn) {
+ /* Amazingly, the error code depends on the command (from Samba4). */
+ if (type == SMBntcreateX) {
+ return ERROR_NT(NT_STATUS_INVALID_HANDLE);
+ } else {
+ return ERROR_DOS(ERRSRV, ERRinvnid);
+ }
+ }
/* does this protocol need to be run as the connected user? */