From 4392d47b34720d2dcd8ee47bd14a71bf1eab2c86 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 30 Jul 2007 10:23:26 +0000 Subject: r24078: Add reply_unixerror (This used to be commit 10ac991750e9476299d39ac6f763d1638ff8c619) --- source3/smbd/error.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'source3/smbd') diff --git a/source3/smbd/error.c b/source3/smbd/error.c index d00c61487a..023e1b7dcc 100644 --- a/source3/smbd/error.c +++ b/source3/smbd/error.c @@ -157,3 +157,33 @@ void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode, 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); +} -- cgit