dos_to_ntstatus can't handle success
Jim McDonough
jmcd at us.ibm.com
Wed Aug 29 20:59:22 GMT 2001
dos_to_ntstatus() in libsmb/errormap.c in HEAD can't handle the situation
where success is returned. The error class is 0 in this case, and this
function assumes there is actually an error to report. Trying to do a
RNetShareEnum fails when nothing is wrong. Here's a patch that adds the
success error class to doserr.h. I can't add this case to the table, since
the search terminates when the ntstatus is 0...so I just added an test
before the loop.
--- include/doserr.h Tue Aug 28 01:35:05 2001
+++ ../../mine/source/include/doserr.h Wed Aug 29 16:40:21 2001
@@ -27,6 +27,7 @@
/* Error classes */
+#define ERRSUC 0x00 /* Success error class */
#define ERRDOS 0x01 /* Error is from the core DOS operating system set.
*/
#define ERRSRV 0x02 /* Error is generated by the server network file
manager.*/
#define ERRHRD 0x03 /* Error is an hardware error. */
--- libsmb/errormap.c Mon Aug 27 15:46:17 2001
+++ ../../mine/source/libsmb/errormap.c Wed Aug 29 16:58:16 2001
@@ -825,6 +825,8 @@
NTSTATUS dos_to_ntstatus(int eclass, int ecode)
{
int i;
+ if ((eclass == ERRSUC) && (ecode == ERRsuccess))
+ return NT_STATUS_OK;
for (i=0; NT_STATUS_V(dos_to_ntstatus_map[i].ntstatus); i++) {
if (eclass == dos_to_ntstatus_map[i].dos_class &&
ecode == dos_to_ntstatus_map[i].dos_code) {
@@ -841,6 +843,11 @@
void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode)
{
int i;
+ if (ntstatus == NT_STATUS_OK) {
+ *eclass = ERRSUC; /* success error class */
+ *ecode = ERRsuccess;
+ return;
+ }
for (i=0; NT_STATUS_V(ntstatus_to_dos_map[i].ntstatus); i++) {
if (NT_STATUS_V(ntstatus) ==
NT_STATUS_V(ntstatus_to_dos_map[i].ntstatus)) {
----------------------------
Jim McDonough
IBM Linux Technology Center
6 Minuteman Drive
Scarborough, ME 04074
USA
jmcd at us.ibm.com
Phone: (207) 885-5565
IBM tie-line: 776-9984
More information about the samba-technical
mailing list