svn commit: samba r24078 - in branches/SAMBA_3_2/source: include
smbd
vlendec at samba.org
vlendec at samba.org
Mon Jul 30 10:23:28 GMT 2007
Author: vlendec
Date: 2007-07-30 10:23:26 +0000 (Mon, 30 Jul 2007)
New Revision: 24078
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24078
Log:
Add reply_unixerror
Modified:
branches/SAMBA_3_2/source/include/smb_macros.h
branches/SAMBA_3_2/source/smbd/error.c
Changeset:
Modified: branches/SAMBA_3_2/source/include/smb_macros.h
===================================================================
--- branches/SAMBA_3_2/source/include/smb_macros.h 2007-07-30 10:20:52 UTC (rev 24077)
+++ branches/SAMBA_3_2/source/include/smb_macros.h 2007-07-30 10:23:26 UTC (rev 24078)
@@ -172,6 +172,7 @@
#define reply_nterror(req,status) reply_nt_error(req,status,__LINE__,__FILE__)
#define reply_doserror(req,eclass,ecode) reply_dos_error(req,eclass,ecode,__LINE__,__FILE__)
#define reply_botherror(req,status,eclass,ecode) reply_both_error(req,eclass,ecode,status,__LINE__,__FILE__)
+#define reply_unixerror(req,defclass,deferror) reply_unix_error(req,defclass,deferror,NT_STATUS_OK,__LINE__,__FILE__)
/* this is how errors are generated */
#define UNIXERROR(defclass,deferror) unix_error_packet(inbuf,outbuf,defclass,deferror,NT_STATUS_OK,__LINE__,__FILE__)
Modified: branches/SAMBA_3_2/source/smbd/error.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/error.c 2007-07-30 10:20:52 UTC (rev 24077)
+++ branches/SAMBA_3_2/source/smbd/error.c 2007-07-30 10:23:26 UTC (rev 24078)
@@ -157,3 +157,33 @@
error_packet_set((char *)req->outbuf, eclass, ecode, status,
line, file);
}
+
+void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode,
+ NTSTATUS defstatus, int line, const char *file)
+{
+ int eclass=defclass;
+ int ecode=defcode;
+ NTSTATUS ntstatus = defstatus;
+ int i=0;
+
+ TALLOC_FREE(req->outbuf);
+ reply_outbuf(req, 0, 0);
+
+ if (errno != 0) {
+ DEBUG(3,("unix_error_packet: error string = %s\n",
+ strerror(errno)));
+
+ while (unix_dos_nt_errmap[i].dos_class != 0) {
+ if (unix_dos_nt_errmap[i].unix_error == errno) {
+ eclass = unix_dos_nt_errmap[i].dos_class;
+ ecode = unix_dos_nt_errmap[i].dos_code;
+ ntstatus = unix_dos_nt_errmap[i].nt_error;
+ break;
+ }
+ i++;
+ }
+ }
+
+ error_packet_set((char *)req->outbuf, eclass, ecode, ntstatus,
+ line, file);
+}
More information about the samba-cvs
mailing list