[GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
[samba.git] / source / smbd / error.c
index 74029a2b05cf51af8ac89aac4381505ff8f74c6e..6cb63f0c49e6a200fbef4cb3722528b968ef0e32 100644 (file)
@@ -28,7 +28,7 @@ extern uint32 global_client_caps;
  Create an error packet from errno.
 ****************************************************************************/
 
-int unix_error_packet(const char *inbuf,char *outbuf,int def_class,uint32 def_code, NTSTATUS def_status, int line, const char *file)
+int unix_error_packet(char *outbuf,int def_class,uint32 def_code, NTSTATUS def_status, int line, const char *file)
 {
        int eclass=def_class;
        int ecode=def_code;
@@ -49,7 +49,7 @@ int unix_error_packet(const char *inbuf,char *outbuf,int def_class,uint32 def_co
                }
        }
 
-       return error_packet(inbuf,outbuf,eclass,ecode,ntstatus,line,file);
+       return error_packet(outbuf,eclass,ecode,ntstatus,line,file);
 }
 
 BOOL use_nt_status(void)
@@ -109,9 +109,9 @@ void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatu
        }
 }
 
-int error_packet(const char *inbuf, char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file)
+int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file)
 {
-       int outsize = set_message(inbuf,outbuf,0,0,True);
+       int outsize = set_message(outbuf,0,0,True);
        error_packet_set(outbuf, eclass, ecode, ntstatus, line, file);
        return outsize;
 }
@@ -179,3 +179,20 @@ void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode,
        error_packet_set((char *)req->outbuf, eclass, ecode, ntstatus,
                         line, file);
 }
+
+void reply_openerror(struct smb_request *req, NTSTATUS status)
+{
+       if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+               /*
+                * We hit an existing file, and if we're returning DOS
+                * error codes OBJECT_NAME_COLLISION would map to
+                * ERRDOS/183, we need to return ERRDOS/80, see bug
+                * 4852.
+                */
+               reply_botherror(req, NT_STATUS_OBJECT_NAME_COLLISION,
+                       ERRDOS, ERRfilexists);
+       } else {
+               reply_nterror(req, status);
+       }
+}
+