r7550: Steal the correct error return for invalid TID on NTcreateX from Samba4
authorJeremy Allison <jra@samba.org>
Mon, 13 Jun 2005 20:42:21 +0000 (20:42 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:57:13 +0000 (10:57 -0500)
(thanks tridge !).
Jeremy.
(This used to be commit 0288823aacdbec6ba99e944c9f06f051e55c64b8)

source3/smbd/process.c

index afde2e94a986faa178d4aea2ebec397925f1ead4..0373cd471c9f80852514ceb1a98a8a7c67663d19 100644 (file)
@@ -936,8 +936,14 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
                        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? */