summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/include/doserr.h1
-rw-r--r--source4/libcli/config.mk1
-rw-r--r--source4/libcli/util/nterr.c125
-rw-r--r--source4/libcli/util/smberr.c181
4 files changed, 121 insertions, 187 deletions
diff --git a/source4/include/doserr.h b/source4/include/doserr.h
index fa4f2f48e9..f124fb1b9c 100644
--- a/source4/include/doserr.h
+++ b/source4/include/doserr.h
@@ -135,7 +135,6 @@
#define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */
#define ERRuseSTD 251 /* temporarily unable to use raw mode, use standard mode */
#define ERRcontMPX 252 /* resume MPX mode */
-#define ERRbadPW /* reserved */
#define ERRnosupport 0xFFFF
#define ERRunknownsmb 22 /* from NT 3.5 response */
diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk
index 11e54498cf..7779adabaf 100644
--- a/source4/libcli/config.mk
+++ b/source4/libcli/config.mk
@@ -1,6 +1,5 @@
[SUBSYSTEM::LIBCLI_UTILS]
ADD_OBJ_FILES = libcli/util/asn1.o \
- libcli/util/smberr.o \
libcli/util/doserr.o \
libcli/util/errormap.o \
libcli/util/clierror.o \
diff --git a/source4/libcli/util/nterr.c b/source4/libcli/util/nterr.c
index a5ba1305e4..9bef2cf35c 100644
--- a/source4/libcli/util/nterr.c
+++ b/source4/libcli/util/nterr.c
@@ -29,6 +29,8 @@ typedef struct
NTSTATUS nt_errcode;
} nt_err_code_struct;
+#define DOS_CODE(class, code) { #class ":" #code, NT_STATUS_DOS(class, code) }
+
static const nt_err_code_struct nt_errs[] =
{
{ "NT_STATUS_OK", NT_STATUS_OK },
@@ -541,6 +543,124 @@ static const nt_err_code_struct nt_errs[] =
{ "NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX", NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX },
{ "STATUS_MORE_ENTRIES", STATUS_MORE_ENTRIES },
{ "STATUS_SOME_UNMAPPED", STATUS_SOME_UNMAPPED },
+
+ DOS_CODE(ERRDOS, ERRsuccess),
+ DOS_CODE(ERRDOS, ERRbadfunc),
+ DOS_CODE(ERRDOS, ERRbadfile),
+ DOS_CODE(ERRDOS, ERRbadpath),
+ DOS_CODE(ERRDOS, ERRnofids),
+ DOS_CODE(ERRDOS, ERRnoaccess),
+ DOS_CODE(ERRDOS, ERRbadfid),
+ DOS_CODE(ERRDOS, ERRbadmcb),
+ DOS_CODE(ERRDOS, ERRnomem),
+ DOS_CODE(ERRDOS, ERRbadmem),
+ DOS_CODE(ERRDOS, ERRbadenv),
+ DOS_CODE(ERRDOS, ERRbadaccess),
+ DOS_CODE(ERRDOS, ERRbaddata),
+ DOS_CODE(ERRDOS, ERRres),
+ DOS_CODE(ERRDOS, ERRbaddrive),
+ DOS_CODE(ERRDOS, ERRremcd),
+ DOS_CODE(ERRDOS, ERRdiffdevice),
+ DOS_CODE(ERRDOS, ERRnofiles),
+ DOS_CODE(ERRDOS, ERRgeneral),
+ DOS_CODE(ERRDOS, ERRbadshare),
+ DOS_CODE(ERRDOS, ERRlock),
+ DOS_CODE(ERRDOS, ERRunsup),
+ DOS_CODE(ERRDOS, ERRnetnamedel),
+ DOS_CODE(ERRDOS, ERRnosuchshare),
+ DOS_CODE(ERRDOS, ERRfilexists),
+ DOS_CODE(ERRDOS, ERRinvalidparam),
+ DOS_CODE(ERRDOS, ERRcannotopen),
+ DOS_CODE(ERRDOS, ERRinsufficientbuffer),
+ DOS_CODE(ERRDOS, ERRinvalidname),
+ DOS_CODE(ERRDOS, ERRunknownlevel),
+ DOS_CODE(ERRDOS, ERRnotlocked),
+ DOS_CODE(ERRDOS, ERRrename),
+ DOS_CODE(ERRDOS, ERRbadpipe),
+ DOS_CODE(ERRDOS, ERRpipebusy),
+ DOS_CODE(ERRDOS, ERRpipeclosing),
+ DOS_CODE(ERRDOS, ERRnotconnected),
+ DOS_CODE(ERRDOS, ERRmoredata),
+ DOS_CODE(ERRDOS, ERRnomoreitems),
+ DOS_CODE(ERRDOS, ERRbaddirectory),
+ DOS_CODE(ERRDOS, ERReasnotsupported),
+ DOS_CODE(ERRDOS, ERRlogonfailure),
+ DOS_CODE(ERRDOS, ERRbuftoosmall),
+ DOS_CODE(ERRDOS, ERRunknownipc),
+ DOS_CODE(ERRDOS, ERRnosuchprintjob),
+ DOS_CODE(ERRDOS, ERRinvgroup),
+ DOS_CODE(ERRDOS, ERRnoipc),
+ DOS_CODE(ERRDOS, ERRdriveralreadyinstalled),
+ DOS_CODE(ERRDOS, ERRunknownprinterport),
+ DOS_CODE(ERRDOS, ERRunknownprinterdriver),
+ DOS_CODE(ERRDOS, ERRunknownprintprocessor),
+ DOS_CODE(ERRDOS, ERRinvalidseparatorfile),
+ DOS_CODE(ERRDOS, ERRinvalidjobpriority),
+ DOS_CODE(ERRDOS, ERRinvalidprintername),
+ DOS_CODE(ERRDOS, ERRprinteralreadyexists),
+ DOS_CODE(ERRDOS, ERRinvalidprintercommand),
+ DOS_CODE(ERRDOS, ERRinvaliddatatype),
+ DOS_CODE(ERRDOS, ERRinvalidenvironment),
+ DOS_CODE(ERRDOS, ERRunknownprintmonitor),
+ DOS_CODE(ERRDOS, ERRprinterdriverinuse),
+ DOS_CODE(ERRDOS, ERRspoolfilenotfound),
+ DOS_CODE(ERRDOS, ERRnostartdoc),
+ DOS_CODE(ERRDOS, ERRnoaddjob),
+ DOS_CODE(ERRDOS, ERRprintprocessoralreadyinstalled),
+ DOS_CODE(ERRDOS, ERRprintmonitoralreadyinstalled),
+ DOS_CODE(ERRDOS, ERRinvalidprintmonitor),
+ DOS_CODE(ERRDOS, ERRprintmonitorinuse),
+ DOS_CODE(ERRDOS, ERRprinterhasjobsqueued),
+
+ DOS_CODE(ERRSRV, ERRerror),
+ DOS_CODE(ERRSRV, ERRbadpw),
+ DOS_CODE(ERRSRV, ERRbadtype),
+ DOS_CODE(ERRSRV, ERRaccess),
+ DOS_CODE(ERRSRV, ERRinvnid),
+ DOS_CODE(ERRSRV, ERRinvnetname),
+ DOS_CODE(ERRSRV, ERRinvdevice),
+ DOS_CODE(ERRSRV, ERRqfull),
+ DOS_CODE(ERRSRV, ERRqtoobig),
+ DOS_CODE(ERRSRV, ERRinvpfid),
+ DOS_CODE(ERRSRV, ERRsmbcmd),
+ DOS_CODE(ERRSRV, ERRsrverror),
+ DOS_CODE(ERRSRV, ERRfilespecs),
+ DOS_CODE(ERRSRV, ERRbadlink),
+ DOS_CODE(ERRSRV, ERRbadpermits),
+ DOS_CODE(ERRSRV, ERRbadpid),
+ DOS_CODE(ERRSRV, ERRsetattrmode),
+ DOS_CODE(ERRSRV, ERRpaused),
+ DOS_CODE(ERRSRV, ERRmsgoff),
+ DOS_CODE(ERRSRV, ERRnoroom),
+ DOS_CODE(ERRSRV, ERRrmuns),
+ DOS_CODE(ERRSRV, ERRtimeout),
+ DOS_CODE(ERRSRV, ERRnoresource),
+ DOS_CODE(ERRSRV, ERRtoomanyuids),
+ DOS_CODE(ERRSRV, ERRbaduid),
+ DOS_CODE(ERRSRV, ERRuseMPX),
+ DOS_CODE(ERRSRV, ERRuseSTD),
+ DOS_CODE(ERRSRV, ERRcontMPX),
+ DOS_CODE(ERRSRV, ERRnosupport),
+ DOS_CODE(ERRSRV, ERRunknownsmb),
+
+ DOS_CODE(ERRHRD, ERRnowrite),
+ DOS_CODE(ERRHRD, ERRbadunit),
+ DOS_CODE(ERRHRD, ERRnotready),
+ DOS_CODE(ERRHRD, ERRbadcmd),
+ DOS_CODE(ERRHRD, ERRdata),
+ DOS_CODE(ERRHRD, ERRbadreq),
+ DOS_CODE(ERRHRD, ERRseek),
+ DOS_CODE(ERRHRD, ERRbadmedia),
+ DOS_CODE(ERRHRD, ERRbadsector),
+ DOS_CODE(ERRHRD, ERRnopaper),
+ DOS_CODE(ERRHRD, ERRwrite),
+ DOS_CODE(ERRHRD, ERRread),
+ DOS_CODE(ERRHRD, ERRgeneral),
+ DOS_CODE(ERRHRD, ERRwrongdisk),
+ DOS_CODE(ERRHRD, ERRFCBunavail),
+ DOS_CODE(ERRHRD, ERRsharebufexc),
+ DOS_CODE(ERRHRD, ERRdiskfull),
+
{ NULL, NT_STATUS(0) }
};
@@ -651,10 +771,7 @@ const char *nt_errstr(NTSTATUS nt_code)
static char msg[40];
int idx = 0;
- if (NT_STATUS_IS_DOS(nt_code)) {
- return dos_errstr(NT_STATUS_DOS_CLASS(nt_code),
- NT_STATUS_DOS_CODE(nt_code));
- } else if (NT_STATUS_IS_LDAP(nt_code)) {
+ if (NT_STATUS_IS_LDAP(nt_code)) {
slprintf(msg, sizeof(msg), "LDAP code %u", NT_STATUS_LDAP_CODE(nt_code));
return msg;
}
diff --git a/source4/libcli/util/smberr.c b/source4/libcli/util/smberr.c
deleted file mode 100644
index 87cc601b8d..0000000000
--- a/source4/libcli/util/smberr.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Copyright (C) Andrew Tridgell 1998-2003
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-
-/*
- error code stuff - put together by Merik Karman
- merik@blackadder.dsh.oz.au
-*/
-
-struct err_code_struct {
- const char *name;
- int code;
- const char *message;
-};
-
-/* Dos Error Messages */
-static const struct err_code_struct dos_msgs[] = {
- {"ERRbadfunc",ERRbadfunc,"Invalid function."},
- {"ERRbadfile",ERRbadfile,"File not found."},
- {"ERRbadpath",ERRbadpath,"Directory invalid."},
- {"ERRnofids",ERRnofids,"No file descriptors available"},
- {"ERRnoaccess",ERRnoaccess,"Access denied."},
- {"ERRbadfid",ERRbadfid,"Invalid file handle."},
- {"ERRbadmcb",ERRbadmcb,"Memory control blocks destroyed."},
- {"ERRnomem",ERRnomem,"Insufficient server memory to perform the requested function."},
- {"ERRbadmem",ERRbadmem,"Invalid memory block address."},
- {"ERRbadenv",ERRbadenv,"Invalid environment."},
- {"ERRbadformat",11,"Invalid format."},
- {"ERRbadaccess",ERRbadaccess,"Invalid open mode."},
- {"ERRbaddata",ERRbaddata,"Invalid data."},
- {"ERRres",ERRres,"reserved."},
- {"ERRbaddrive",ERRbaddrive,"Invalid drive specified."},
- {"ERRremcd",ERRremcd,"A Delete Directory request attempted to remove the server's current directory."},
- {"ERRdiffdevice",ERRdiffdevice,"Not same device."},
- {"ERRnofiles",ERRnofiles,"A File Search command can find no more files matching the specified criteria."},
- {"ERRbadshare",ERRbadshare,"The sharing mode specified for an Open conflicts with existing FIDs on the file."},
- {"ERRlock",ERRlock,"A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process."},
- {"ERRunsup", ERRunsup, "The operation is unsupported"},
- {"ERRnosuchshare", ERRnosuchshare, "You specified an invalid share name"},
- {"ERRfilexists",ERRfilexists,"The file named in a Create Directory, Make New File or Link request already exists."},
- {"ERRinvalidname",ERRinvalidname, "Invalid name"},
- {"ERRbadpipe",ERRbadpipe,"Pipe invalid."},
- {"ERRpipebusy",ERRpipebusy,"All instances of the requested pipe are busy."},
- {"ERRpipeclosing",ERRpipeclosing,"Pipe close in progress."},
- {"ERRnotconnected",ERRnotconnected,"No process on other end of pipe."},
- {"ERRmoredata",ERRmoredata,"There is more data to be returned."},
- {"ERRinvgroup",ERRinvgroup,"Invalid workgroup (try the -W option)"},
- {"ERRlogonfailure",ERRlogonfailure,"Logon failure"},
- {"ERRdiskfull",ERRdiskfull,"Disk full"},
- {"ERRgeneral",ERRgeneral, "General failure"},
- {"ERRunknownlevel",ERRunknownlevel, "Unknown info level"},
- {NULL,-1,NULL}};
-
-/* Server Error Messages */
-static const struct err_code_struct server_msgs[] = {
- {"ERRerror",1,"Non-specific error code."},
- {"ERRbadpw",2,"Bad password - name/password pair in a Tree Connect or Session Setup are invalid."},
- {"ERRbadtype",3,"reserved."},
- {"ERRaccess",4,"The requester does not have the necessary access rights within the specified context for the requested function. The context is defined by the TID or the UID."},
- {"ERRinvnid",5,"The tree ID (TID) specified in a command was invalid."},
- {"ERRinvnetname",6,"Invalid network name in tree connect."},
- {"ERRinvdevice",7,"Invalid device - printer request made to non-printer connection or non-printer request made to printer connection."},
- {"ERRqfull",49,"Print queue full (files) -- returned by open print file."},
- {"ERRqtoobig",50,"Print queue full -- no space."},
- {"ERRqeof",51,"EOF on print queue dump."},
- {"ERRinvpfid",52,"Invalid print file FID."},
- {"ERRsmbcmd",64,"The server did not recognize the command received."},
- {"ERRsrverror",65,"The server encountered an internal error, e.g., system file unavailable."},
- {"ERRfilespecs",67,"The file handle (FID) and pathname parameters contained an invalid combination of values."},
- {"ERRreserved",68,"reserved."},
- {"ERRbadpermits",69,"The access permissions specified for a file or directory are not a valid combination. The server cannot set the requested attribute."},
- {"ERRreserved",70,"reserved."},
- {"ERRsetattrmode",71,"The attribute mode in the Set File Attribute request is invalid."},
- {"ERRpaused",81,"Server is paused."},
- {"ERRmsgoff",82,"Not receiving messages."},
- {"ERRnoroom",83,"No room to buffer message."},
- {"ERRrmuns",87,"Too many remote user names."},
- {"ERRtimeout",88,"Operation timed out."},
- {"ERRnoresource",89,"No resources currently available for request."},
- {"ERRtoomanyuids",90,"Too many UIDs active on this session."},
- {"ERRbaduid",91,"The UID is not known as a valid ID on this session."},
- {"ERRusempx",250,"Temp unable to support Raw, use MPX mode."},
- {"ERRusestd",251,"Temp unable to support Raw, use standard read/write."},
- {"ERRcontmpx",252,"Continue in MPX mode."},
- {"ERRreserved",253,"reserved."},
- {"ERRreserved",254,"reserved."},
- {"ERRnosupport",0xFFFF,"Function not supported."},
- {NULL,-1,NULL}};
-
-/* Hard Error Messages */
-static const struct err_code_struct hard_msgs[] = {
- {"ERRnowrite",19,"Attempt to write on write-protected diskette."},
- {"ERRbadunit",20,"Unknown unit."},
- {"ERRnotready",21,"Drive not ready."},
- {"ERRbadcmd",22,"Unknown command."},
- {"ERRdata",23,"Data error (CRC)."},
- {"ERRbadreq",24,"Bad request structure length."},
- {"ERRseek",25 ,"Seek error."},
- {"ERRbadmedia",26,"Unknown media type."},
- {"ERRbadsector",27,"Sector not found."},
- {"ERRnopaper",28,"Printer out of paper."},
- {"ERRwrite",29,"Write fault."},
- {"ERRread",30,"Read fault."},
- {"ERRgeneral",31,"General failure."},
- {"ERRbadshare",32,"An open conflicts with an existing open."},
- {"ERRlock",33,"A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process."},
- {"ERRwrongdisk",34,"The wrong disk was found in a drive."},
- {"ERRFCBUnavail",35,"No FCBs are available to process request."},
- {"ERRsharebufexc",36,"A sharing buffer has been exceeded."},
- {NULL,-1,NULL}};
-
-
-static const struct {
- uint8_t class;
- const char *class_name;
- const struct err_code_struct *err_msgs;
-} err_classes[] = {
- {0,"SUCCESS",NULL},
- {0x01,"ERRDOS",dos_msgs},
- {0x02,"ERRSRV",server_msgs},
- {0x03,"ERRHRD",hard_msgs},
- {0x04,"ERRXOS",NULL},
- {0xE1,"ERRRMX1",NULL},
- {0xE2,"ERRRMX2",NULL},
- {0xE3,"ERRRMX3",NULL},
- {0xFF,"ERRCMD",NULL},
- {-1,NULL,NULL}};
-
-
-/* return a dos error string given a error class and error code */
-const char *dos_errstr(uint8_t class, uint16_t code)
-{
- static char *msg;
- int i, j;
- const struct err_code_struct *err_msgs;
-
- if (msg) {
- free(msg);
- msg = NULL;
- }
-
- for (i=0;err_classes[i].class_name;i++) {
- if (class == err_classes[i].class) break;
- }
- if (!err_classes[i].class_name) {
- asprintf(&msg, "Unknown DOS error %d:%d\n", class, code);
- return msg;
- }
-
- err_msgs = err_classes[i].err_msgs;
-
- for (j=0;err_msgs && err_msgs[j].name;j++) {
- if (err_msgs[j].code == code) {
- asprintf(&msg, "%s:%s (%s)\n",
- err_classes[i].class_name,
- err_msgs[j].name,
- err_msgs[j].message);
- return msg;
- }
- }
-
- asprintf(&msg, "Unknown DOS error %s:%d\n", err_classes[i].class_name, code);
- return msg;
-}