2 Unix SMB/Netbios implementation.
4 Copyright (C) Andrew Tridgell 1998
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 extern int DEBUGLEVEL
;
27 /* error code stuff - put together by Merik Karman
28 merik@blackadder.dsh.oz.au */
37 /* Dos Error Messages */
38 err_code_struct dos_msgs
[] = {
39 {"ERRbadfunc",1,"Invalid function."},
40 {"ERRbadfile",2,"File not found."},
41 {"ERRbadpath",3,"Directory invalid."},
42 {"ERRnofids",4,"No file descriptors available"},
43 {"ERRnoaccess",5,"Access denied."},
44 {"ERRbadfid",6,"Invalid file handle."},
45 {"ERRbadmcb",7,"Memory control blocks destroyed."},
46 {"ERRnomem",8,"Insufficient server memory to perform the requested function."},
47 {"ERRbadmem",9,"Invalid memory block address."},
48 {"ERRbadenv",10,"Invalid environment."},
49 {"ERRbadformat",11,"Invalid format."},
50 {"ERRbadaccess",12,"Invalid open mode."},
51 {"ERRbaddata",13,"Invalid data."},
52 {"ERR",14,"reserved."},
53 {"ERRbaddrive",15,"Invalid drive specified."},
54 {"ERRremcd",16,"A Delete Directory request attempted to remove the server's current directory."},
55 {"ERRdiffdevice",17,"Not same device."},
56 {"ERRnofiles",18,"A File Search command can find no more files matching the specified criteria."},
57 {"ERRbadshare",32,"The sharing mode specified for an Open conflicts with existing FIDs on the file."},
58 {"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."},
59 {"ERRunsup", 50, "The operation is unsupported"},
60 {"ERRnosuchshare", 67, "You specified an invalid share name"},
61 {"ERRfilexists",80,"The file named in a Create Directory, Make New File or Link request already exists."},
62 {"ERRbadpipe",230,"Pipe invalid."},
63 {"ERRpipebusy",231,"All instances of the requested pipe are busy."},
64 {"ERRpipeclosing",232,"Pipe close in progress."},
65 {"ERRnotconnected",233,"No process on other end of pipe."},
66 {"ERRmoredata",234,"There is more data to be returned."},
67 {"ERRinvgroup",2455,"Invalid workgroup (try the -W option)"},
70 /* Server Error Messages */
71 err_code_struct server_msgs
[] = {
72 {"ERRerror",1,"Non-specific error code."},
73 {"ERRbadpw",2,"Bad password - name/password pair in a Tree Connect or Session Setup are invalid."},
74 {"ERRbadtype",3,"reserved."},
75 {"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."},
76 {"ERRinvnid",5,"The tree ID (TID) specified in a command was invalid."},
77 {"ERRinvnetname",6,"Invalid network name in tree connect."},
78 {"ERRinvdevice",7,"Invalid device - printer request made to non-printer connection or non-printer request made to printer connection."},
79 {"ERRqfull",49,"Print queue full (files) -- returned by open print file."},
80 {"ERRqtoobig",50,"Print queue full -- no space."},
81 {"ERRqeof",51,"EOF on print queue dump."},
82 {"ERRinvpfid",52,"Invalid print file FID."},
83 {"ERRsmbcmd",64,"The server did not recognize the command received."},
84 {"ERRsrverror",65,"The server encountered an internal error, e.g., system file unavailable."},
85 {"ERRfilespecs",67,"The file handle (FID) and pathname parameters contained an invalid combination of values."},
86 {"ERRreserved",68,"reserved."},
87 {"ERRbadpermits",69,"The access permissions specified for a file or directory are not a valid combination. The server cannot set the requested attribute."},
88 {"ERRreserved",70,"reserved."},
89 {"ERRsetattrmode",71,"The attribute mode in the Set File Attribute request is invalid."},
90 {"ERRpaused",81,"Server is paused."},
91 {"ERRmsgoff",82,"Not receiving messages."},
92 {"ERRnoroom",83,"No room to buffer message."},
93 {"ERRrmuns",87,"Too many remote user names."},
94 {"ERRtimeout",88,"Operation timed out."},
95 {"ERRnoresource",89,"No resources currently available for request."},
96 {"ERRtoomanyuids",90,"Too many UIDs active on this session."},
97 {"ERRbaduid",91,"The UID is not known as a valid ID on this session."},
98 {"ERRusempx",250,"Temp unable to support Raw, use MPX mode."},
99 {"ERRusestd",251,"Temp unable to support Raw, use standard read/write."},
100 {"ERRcontmpx",252,"Continue in MPX mode."},
101 {"ERRreserved",253,"reserved."},
102 {"ERRreserved",254,"reserved."},
103 {"ERRnosupport",0xFFFF,"Function not supported."},
106 /* Hard Error Messages */
107 err_code_struct hard_msgs
[] = {
108 {"ERRnowrite",19,"Attempt to write on write-protected diskette."},
109 {"ERRbadunit",20,"Unknown unit."},
110 {"ERRnotready",21,"Drive not ready."},
111 {"ERRbadcmd",22,"Unknown command."},
112 {"ERRdata",23,"Data error (CRC)."},
113 {"ERRbadreq",24,"Bad request structure length."},
114 {"ERRseek",25 ,"Seek error."},
115 {"ERRbadmedia",26,"Unknown media type."},
116 {"ERRbadsector",27,"Sector not found."},
117 {"ERRnopaper",28,"Printer out of paper."},
118 {"ERRwrite",29,"Write fault."},
119 {"ERRread",30,"Read fault."},
120 {"ERRgeneral",31,"General failure."},
121 {"ERRbadshare",32,"An open conflicts with an existing open."},
122 {"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."},
123 {"ERRwrongdisk",34,"The wrong disk was found in a drive."},
124 {"ERRFCBUnavail",35,"No FCBs are available to process request."},
125 {"ERRsharebufexc",36,"A sharing buffer has been exceeded."},
133 err_code_struct
*err_msgs
;
136 {0x01,"ERRDOS",dos_msgs
},
137 {0x02,"ERRSRV",server_msgs
},
138 {0x03,"ERRHRD",hard_msgs
},
139 {0x04,"ERRXOS",NULL
},
140 {0xE1,"ERRRMX1",NULL
},
141 {0xE2,"ERRRMX2",NULL
},
142 {0xE3,"ERRRMX3",NULL
},
143 {0xFF,"ERRCMD",NULL
},
147 /****************************************************************************
148 return a SMB error string from a SMB buffer
149 ****************************************************************************/
150 char *smb_errstr(char *inbuf
)
153 int class = CVAL(inbuf
,smb_rcls
);
154 int num
= SVAL(inbuf
,smb_err
);
157 for (i
=0;err_classes
[i
].class;i
++)
158 if (err_classes
[i
].code
== class)
160 if (err_classes
[i
].err_msgs
)
162 err_code_struct
*err
= err_classes
[i
].err_msgs
;
163 for (j
=0;err
[j
].name
;j
++)
164 if (num
== err
[j
].code
)
167 slprintf(ret
, sizeof(ret
) - 1, "%s - %s (%s)",err_classes
[i
].class,
168 err
[j
].name
,err
[j
].message
);
170 slprintf(ret
, sizeof(ret
) - 1, "%s - %s",err_classes
[i
].class,err
[j
].name
);
175 slprintf(ret
, sizeof(ret
) - 1, "%s - %d",err_classes
[i
].class,num
);
179 slprintf(ret
, sizeof(ret
) - 1, "Error: Unknown error (%d,%d)",class,num
);