summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source3/include/doserr.h4
-rwxr-xr-xsource3/include/rpc_spoolss.h10
-rw-r--r--source3/lib/error.c6
-rw-r--r--source3/libsmb/errormap.c584
-rw-r--r--source3/libsmb/smberr.c11
-rw-r--r--source3/printing/nt_printing.c10
-rw-r--r--source3/printing/printing.c22
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c314
8 files changed, 779 insertions, 182 deletions
diff --git a/source3/include/doserr.h b/source3/include/doserr.h
index ee6a27ee32..cfc94a359a 100644
--- a/source3/include/doserr.h
+++ b/source3/include/doserr.h
@@ -136,11 +136,15 @@
/* these are win32 error codes. There are only a few places where
these matter for Samba, primarily in the NT printing code */
#define WERR_OK W_ERROR(0)
+#define WERR_ACCESS_DENIED W_ERROR(5)
#define WERR_BADFID W_ERROR(6)
+#define WERR_BADFUNC W_ERROR(1)
#define WERR_INSUFFICIENT_BUFFER W_ERROR(122)
+#define WERR_INVALID_PARAM W_ERROR(87)
#define WERR_NOMEM W_ERROR(8)
#define WERR_INVALID_NAME W_ERROR(123)
#define WERR_UNKNOWN_LEVEL W_ERROR(124)
+#define WERR_NO_MORE_ITEMS W_ERROR(259)
#define WERR_UNKNOWN_PRINTER_DRIVER W_ERROR(1797)
#define WERR_INVALID_PRINTER_NAME W_ERROR(1801)
#define WERR_INVALID_DATATYPE W_ERROR(1804)
diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h
index 4dba97b8ce..bf58e1cce7 100755
--- a/source3/include/rpc_spoolss.h
+++ b/source3/include/rpc_spoolss.h
@@ -629,7 +629,7 @@ SPOOL_Q_STARTDOCPRINTER;
typedef struct spool_r_startdocprinter
{
uint32 jobid;
- NTSTATUS status;
+ WERROR status;
}
SPOOL_R_STARTDOCPRINTER;
@@ -736,7 +736,7 @@ typedef struct spool_r_rfnpcnex
{
uint32 info_ptr;
SPOOL_NOTIFY_INFO info;
- NTSTATUS status;
+ WERROR status;
}
SPOOL_R_RFNPCNEX;
@@ -870,7 +870,7 @@ typedef struct spool_r_enumprinters
NEW_BUFFER *buffer;
uint32 needed; /* bytes needed */
uint32 returned; /* number of printers */
- NTSTATUS status;
+ WERROR status;
}
SPOOL_R_ENUMPRINTERS;
@@ -899,7 +899,7 @@ typedef struct spool_r_getprinter
{
NEW_BUFFER *buffer;
uint32 needed;
- NTSTATUS status;
+ WERROR status;
} SPOOL_R_GETPRINTER;
typedef struct driver_info_1
@@ -984,7 +984,7 @@ typedef struct spool_r_getprinterdriver2
uint32 needed;
uint32 servermajorversion;
uint32 serverminorversion;
- NTSTATUS status;
+ WERROR status;
}
SPOOL_R_GETPRINTERDRIVER2;
diff --git a/source3/lib/error.c b/source3/lib/error.c
index 880eba5949..3f66912995 100644
--- a/source3/lib/error.c
+++ b/source3/lib/error.c
@@ -54,13 +54,13 @@ struct {
};
/* Map an NT error code from a Unix error code */
-
-uint32 map_nt_error_from_unix(int unix_error)
+NTSTATUS map_nt_error_from_unix(int unix_error)
{
int i = 0;
- /* Look through list */
+ if (unix_error == 0) return NT_STATUS_OK;
+ /* Look through list */
while(unix_dos_nt_errmap[i].unix_error != 0) {
if (unix_dos_nt_errmap[i].unix_error == unix_error) {
return unix_dos_nt_errmap[i].nt_error;
diff --git a/source3/libsmb/errormap.c b/source3/libsmb/errormap.c
index 73bbde71eb..65dcdf4bdf 100644
--- a/source3/libsmb/errormap.c
+++ b/source3/libsmb/errormap.c
@@ -818,6 +818,547 @@ static struct {
{ERRHRD, 1022, NT_STATUS(0x0000010c)},
};
+/* errmap NTSTATUS->Win32 */
+static struct {
+ NTSTATUS ntstatus;
+ WERROR werror;
+} ntstatus_to_werror_map[] = {
+ {NT_STATUS(0x103), W_ERROR(0x3e5)},
+ {NT_STATUS(0x105), W_ERROR(0xea)},
+ {NT_STATUS(0x106), W_ERROR(0x514)},
+ {NT_STATUS(0x107), W_ERROR(0x515)},
+ {NT_STATUS(0x10c), W_ERROR(0x3fe)},
+ {NT_STATUS(0x10d), W_ERROR(0x516)},
+ {NT_STATUS(0x121), W_ERROR(0x2009)},
+ {NT_STATUS(0xc0000001), W_ERROR(0x1f)},
+ {NT_STATUS(0xc0000002), W_ERROR(0x1)},
+ {NT_STATUS(0xc0000003), W_ERROR(0x57)},
+ {NT_STATUS(0xc0000004), W_ERROR(0x18)},
+ {NT_STATUS(0xc0000005), W_ERROR(0x3e6)},
+ {NT_STATUS(0xc0000006), W_ERROR(0x3e7)},
+ {NT_STATUS(0xc0000007), W_ERROR(0x5ae)},
+ {NT_STATUS(0xc0000008), W_ERROR(0x6)},
+ {NT_STATUS(0xc0000009), W_ERROR(0x3e9)},
+ {NT_STATUS(0xc000000a), W_ERROR(0xc1)},
+ {NT_STATUS(0xc000000b), W_ERROR(0x57)},
+ {NT_STATUS(0xc000000d), W_ERROR(0x57)},
+ {NT_STATUS(0xc000000e), W_ERROR(0x2)},
+ {NT_STATUS(0xc000000f), W_ERROR(0x2)},
+ {NT_STATUS(0xc0000010), W_ERROR(0x1)},
+ {NT_STATUS(0xc0000011), W_ERROR(0x26)},
+ {NT_STATUS(0xc0000012), W_ERROR(0x22)},
+ {NT_STATUS(0xc0000013), W_ERROR(0x15)},
+ {NT_STATUS(0xc0000014), W_ERROR(0x6f9)},
+ {NT_STATUS(0xc0000015), W_ERROR(0x1b)},
+ {NT_STATUS(0xc0000016), W_ERROR(0xea)},
+ {NT_STATUS(0xc0000017), W_ERROR(0x8)},
+ {NT_STATUS(0xc0000018), W_ERROR(0x1e7)},
+ {NT_STATUS(0xc0000019), W_ERROR(0x1e7)},
+ {NT_STATUS(0xc000001a), W_ERROR(0x57)},
+ {NT_STATUS(0xc000001b), W_ERROR(0x57)},
+ {NT_STATUS(0xc000001c), W_ERROR(0x1)},
+ {NT_STATUS(0xc000001d), W_ERROR(0xc000001d)},
+ {NT_STATUS(0xc000001e), W_ERROR(0x5)},
+ {NT_STATUS(0xc000001f), W_ERROR(0x5)},
+ {NT_STATUS(0xc0000020), W_ERROR(0xc1)},
+ {NT_STATUS(0xc0000021), W_ERROR(0x5)},
+ {NT_STATUS(0xc0000022), W_ERROR(0x5)},
+ {NT_STATUS(0xc0000023), W_ERROR(0x7a)},
+ {NT_STATUS(0xc0000024), W_ERROR(0x6)},
+ {NT_STATUS(0xc0000025), W_ERROR(0xc0000025)},
+ {NT_STATUS(0xc0000026), W_ERROR(0xc0000026)},
+ {NT_STATUS(0xc000002a), W_ERROR(0x9e)},
+ {NT_STATUS(0xc000002b), W_ERROR(0xc000002b)},
+ {NT_STATUS(0xc000002c), W_ERROR(0x1e7)},
+ {NT_STATUS(0xc000002d), W_ERROR(0x1e7)},
+ {NT_STATUS(0xc0000030), W_ERROR(0x57)},
+ {NT_STATUS(0xc0000032), W_ERROR(0x571)},
+ {NT_STATUS(0xc0000033), W_ERROR(0x7b)},
+ {NT_STATUS(0xc0000034), W_ERROR(0x2)},
+ {NT_STATUS(0xc0000035), W_ERROR(0xb7)},
+ {NT_STATUS(0xc0000037), W_ERROR(0x6)},
+ {NT_STATUS(0xc0000039), W_ERROR(0xa1)},
+ {NT_STATUS(0xc000003a), W_ERROR(0x3)},
+ {NT_STATUS(0xc000003b), W_ERROR(0xa1)},
+ {NT_STATUS(0xc000003c), W_ERROR(0x45d)},
+ {NT_STATUS(0xc000003d), W_ERROR(0x45d)},
+ {NT_STATUS(0xc000003e), W_ERROR(0x17)},
+ {NT_STATUS(0xc000003f), W_ERROR(0x17)},
+ {NT_STATUS(0xc0000040), W_ERROR(0x8)},
+ {NT_STATUS(0xc0000041), W_ERROR(0x5)},
+ {NT_STATUS(0xc0000042), W_ERROR(0x6)},
+ {NT_STATUS(0xc0000043), W_ERROR(0x20)},
+ {NT_STATUS(0xc0000044), W_ERROR(0x718)},
+ {NT_STATUS(0xc0000045), W_ERROR(0x57)},
+ {NT_STATUS(0xc0000046), W_ERROR(0x120)},
+ {NT_STATUS(0xc0000047), W_ERROR(0x12a)},
+ {NT_STATUS(0xc0000048), W_ERROR(0x57)},
+ {NT_STATUS(0xc0000049), W_ERROR(0x57)},
+ {NT_STATUS(0xc000004a), W_ERROR(0x9c)},
+ {NT_STATUS(0xc000004b), W_ERROR(0x5)},
+ {NT_STATUS(0xc000004c), W_ERROR(0x57)},
+ {NT_STATUS(0xc000004d), W_ERROR(0x57)},
+ {NT_STATUS(0xc000004e), W_ERROR(0x57)},
+ {NT_STATUS(0xc000004f), W_ERROR(0x11a)},
+ {NT_STATUS(0xc0000050), W_ERROR(0xff)},
+ {NT_STATUS(0xc0000051), W_ERROR(0x570)},
+ {NT_STATUS(0xc0000052), W_ERROR(0x570)},
+ {NT_STATUS(0xc0000053), W_ERROR(0x570)},
+ {NT_STATUS(0xc0000054), W_ERROR(0x21)},
+ {NT_STATUS(0xc0000055), W_ERROR(0x21)},
+ {NT_STATUS(0xc0000056), W_ERROR(0x5)},
+ {NT_STATUS(0xc0000057), W_ERROR(0x32)},
+ {NT_STATUS(0xc0000058), W_ERROR(0x519)},
+ {NT_STATUS(0xc0000059), W_ERROR(0x51a)},
+ {NT_STATUS(0xc000005a), W_ERROR(0x51b)},
+ {NT_STATUS(0xc000005b), W_ERROR(0x51c)},
+ {NT_STATUS(0xc000005c), W_ERROR(0x51d)},
+ {NT_STATUS(0xc000005d), W_ERROR(0x51e)},
+ {NT_STATUS(0xc000005e), W_ERROR(0x51f)},
+ {NT_STATUS(0xc000005f), W_ERROR(0x520)},
+ {NT_STATUS(0xc0000060), W_ERROR(0x521)},
+ {NT_STATUS(0xc0000061), W_ERROR(0x522)},
+ {NT_STATUS(0xc0000062), W_ERROR(0x523)},
+ {NT_STATUS(0xc0000063), W_ERROR(0x524)},
+ {NT_STATUS(0xc0000064), W_ERROR(0x525)},
+ {NT_STATUS(0xc0000065), W_ERROR(0x526)},
+ {NT_STATUS(0xc0000066), W_ERROR(0x527)},
+ {NT_STATUS(0xc0000067), W_ERROR(0x528)},
+ {NT_STATUS(0xc0000068), W_ERROR(0x529)},
+ {NT_STATUS(0xc0000069), W_ERROR(0x52a)},
+ {NT_STATUS(0xc000006a), W_ERROR(0x56)},
+ {NT_STATUS(0xc000006b), W_ERROR(0x52c)},
+ {NT_STATUS(0xc000006c), W_ERROR(0x52d)},
+ {NT_STATUS(0xc000006d), W_ERROR(0x52e)},
+ {NT_STATUS(0xc000006e), W_ERROR(0x52f)},
+ {NT_STATUS(0xc000006f), W_ERROR(0x530)},
+ {NT_STATUS(0xc0000070), W_ERROR(0x531)},
+ {NT_STATUS(0xc0000071), W_ERROR(0x532)},
+ {NT_STATUS(0xc0000072), W_ERROR(0x533)},
+ {NT_STATUS(0xc0000073), W_ERROR(0x534)},
+ {NT_STATUS(0xc0000074), W_ERROR(0x535)},
+ {NT_STATUS(0xc0000075), W_ERROR(0x536)},
+ {NT_STATUS(0xc0000076), W_ERROR(0x537)},
+ {NT_STATUS(0xc0000077), W_ERROR(0x538)},
+ {NT_STATUS(0xc0000078), W_ERROR(0x539)},
+ {NT_STATUS(0xc0000079), W_ERROR(0x53a)},
+ {NT_STATUS(0xc000007a), W_ERROR(0x7f)},
+ {NT_STATUS(0xc000007b), W_ERROR(0xc1)},
+ {NT_STATUS(0xc000007c), W_ERROR(0x3f0)},
+ {NT_STATUS(0xc000007d), W_ERROR(0x53c)},
+ {NT_STATUS(0xc000007e), W_ERROR(0x9e)},
+ {NT_STATUS(0xc000007f), W_ERROR(0x70)},
+ {NT_STATUS(0xc0000080), W_ERROR(0x53d)},
+ {NT_STATUS(0xc0000081), W_ERROR(0x53e)},
+ {NT_STATUS(0xc0000082), W_ERROR(0x44)},
+ {NT_STATUS(0xc0000083), W_ERROR(0x103)},
+ {NT_STATUS(0xc0000084), W_ERROR(0x53f)},
+ {NT_STATUS(0xc0000085), W_ERROR(0x103)},
+ {NT_STATUS(0xc0000086), W_ERROR(0x9a)},
+ {NT_STATUS(0xc0000087), W_ERROR(0xe)},
+ {NT_STATUS(0xc0000088), W_ERROR(0x1e7)},
+ {NT_STATUS(0xc0000089), W_ERROR(0x714)},
+ {NT_STATUS(0xc000008a), W_ERROR(0x715)},
+ {NT_STATUS(0xc000008b), W_ERROR(0x716)},
+ {NT_STATUS(0xc000008c), W_ERROR(0xc000008c)},
+ {NT_STATUS(0xc000008d), W_ERROR(0xc000008d)},
+ {NT_STATUS(0xc000008e), W_ERROR(0xc000008e)},
+ {NT_STATUS(0xc000008f), W_ERROR(0xc000008f)},
+ {NT_STATUS(0xc0000090), W_ERROR(0xc0000090)},
+ {NT_STATUS(0xc0000091), W_ERROR(0xc0000091)},
+ {NT_STATUS(0xc0000092), W_ERROR(0xc0000092)},
+ {NT_STATUS(0xc0000093), W_ERROR(0xc0000093)},
+ {NT_STATUS(0xc0000094), W_ERROR(0xc0000094)},
+ {NT_STATUS(0xc0000095), W_ERROR(0x216)},
+ {NT_STATUS(0xc0000096), W_ERROR(0xc0000096)},
+ {NT_STATUS(0xc0000097), W_ERROR(0x8)},
+ {NT_STATUS(0xc0000098), W_ERROR(0x3ee)},
+ {NT_STATUS(0xc0000099), W_ERROR(0x540)},
+ {NT_STATUS(0xc000009a), W_ERROR(0x5aa)},
+ {NT_STATUS(0xc000009b), W_ERROR(0x3)},
+ {NT_STATUS(0xc000009c), W_ERROR(0x17)},
+ {NT_STATUS(0xc000009d), W_ERROR(0x48f)},
+ {NT_STATUS(0xc000009e), W_ERROR(0x15)},
+ {NT_STATUS(0xc000009f), W_ERROR(0x1e7)},
+ {NT_STATUS(0xc00000a0), W_ERROR(0x1e7)},
+ {NT_STATUS(0xc00000a1), W_ERROR(0x5ad)},
+ {NT_STATUS(0xc00000a2), W_ERROR(0x13)},
+ {NT_STATUS(0xc00000a3), W_ERROR(0x15)},
+ {NT_STATUS(0xc00000a4), W_ERROR(0x541)},
+ {NT_STATUS(0xc00000a5), W_ERROR(0x542)},
+ {NT_STATUS(0xc00000a6), W_ERROR(0x543)},
+ {NT_STATUS(0xc00000a7), W_ERROR(0x544)},
+ {NT_STATUS(0xc00000a8), W_ERROR(0x545)},
+ {NT_STATUS(0xc00000a9), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000ab), W_ERROR(0xe7)},
+ {NT_STATUS(0xc00000ac), W_ERROR(0xe7)},
+ {NT_STATUS(0xc00000ad), W_ERROR(0xe6)},
+ {NT_STATUS(0xc00000ae), W_ERROR(0xe7)},
+ {NT_STATUS(0xc00000af), W_ERROR(0x1)},
+ {NT_STATUS(0xc00000b0), W_ERROR(0xe9)},
+ {NT_STATUS(0xc00000b1), W_ERROR(0xe8)},
+ {NT_STATUS(0xc00000b2), W_ERROR(0x217)},
+ {NT_STATUS(0xc00000b3), W_ERROR(0x218)},
+ {NT_STATUS(0xc00000b4), W_ERROR(0xe6)},
+ {NT_STATUS(0xc00000b5), W_ERROR(0x79)},
+ {NT_STATUS(0xc00000b6), W_ERROR(0x26)},
+ {NT_STATUS(0xc00000ba), W_ERROR(0x5)},
+ {NT_STATUS(0xc00000bb), W_ERROR(0x32)},
+ {NT_STATUS(0xc00000bc), W_ERROR(0x33)},
+ {NT_STATUS(0xc00000bd), W_ERROR(0x34)},
+ {NT_STATUS(0xc00000be), W_ERROR(0x35)},
+ {NT_STATUS(0xc00000bf), W_ERROR(0x36)},
+ {NT_STATUS(0xc00000c0), W_ERROR(0x37)},
+ {NT_STATUS(0xc00000c1), W_ERROR(0x38)},
+ {NT_STATUS(0xc00000c2), W_ERROR(0x39)},
+ {NT_STATUS(0xc00000c3), W_ERROR(0x3a)},
+ {NT_STATUS(0xc00000c4), W_ERROR(0x3b)},
+ {NT_STATUS(0xc00000c5), W_ERROR(0x3c)},
+ {NT_STATUS(0xc00000c6), W_ERROR(0x3d)},
+ {NT_STATUS(0xc00000c7), W_ERROR(0x3e)},
+ {NT_STATUS(0xc00000c8), W_ERROR(0x3f)},
+ {NT_STATUS(0xc00000c9), W_ERROR(0x40)},
+ {NT_STATUS(0xc00000ca), W_ERROR(0x41)},
+ {NT_STATUS(0xc00000cb), W_ERROR(0x42)},
+ {NT_STATUS(0xc00000cc), W_ERROR(0x43)},
+ {NT_STATUS(0xc00000cd), W_ERROR(0x44)},
+ {NT_STATUS(0xc00000ce), W_ERROR(0x45)},
+ {NT_STATUS(0xc00000cf), W_ERROR(0x46)},
+ {NT_STATUS(0xc00000d0), W_ERROR(0x47)},
+ {NT_STATUS(0xc00000d1), W_ERROR(0x48)},
+ {NT_STATUS(0xc00000d2), W_ERROR(0x58)},
+ {NT_STATUS(0xc00000d4), W_ERROR(0x11)},
+ {NT_STATUS(0xc00000d5), W_ERROR(0x5)},
+ {NT_STATUS(0xc00000d6), W_ERROR(0xf0)},
+ {NT_STATUS(0xc00000d7), W_ERROR(0x546)},
+ {NT_STATUS(0xc00000d9), W_ERROR(0xe8)},
+ {NT_STATUS(0xc00000da), W_ERROR(0x547)},
+ {NT_STATUS(0xc00000dc), W_ERROR(0x548)},
+ {NT_STATUS(0xc00000dd), W_ERROR(0x549)},
+ {NT_STATUS(0xc00000de), W_ERROR(0x54a)},
+ {NT_STATUS(0xc00000df), W_ERROR(0x54b)},
+ {NT_STATUS(0xc00000e0), W_ERROR(0x54c)},
+ {NT_STATUS(0xc00000e1), W_ERROR(0x54d)},
+ {NT_STATUS(0xc00000e2), W_ERROR(0x12c)},
+ {NT_STATUS(0xc00000e3), W_ERROR(0x12d)},
+ {NT_STATUS(0xc00000e4), W_ERROR(0x54e)},
+ {NT_STATUS(0xc00000e5), W_ERROR(0x54f)},
+ {NT_STATUS(0xc00000e6), W_ERROR(0x550)},
+ {NT_STATUS(0xc00000e7), W_ERROR(0x551)},
+ {NT_STATUS(0xc00000e8), W_ERROR(0x6f8)},
+ {NT_STATUS(0xc00000ed), W_ERROR(0x552)},
+ {NT_STATUS(0xc00000ee), W_ERROR(0x553)},
+ {NT_STATUS(0xc00000ef), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f0), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f1), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f2), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f3), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f4), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f5), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f6), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f7), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f8), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000f9), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000fa), W_ERROR(0x57)},
+ {NT_STATUS(0xc00000fb), W_ERROR(0x3)},
+ {NT_STATUS(0xc00000fd), W_ERROR(0x3e9)},
+ {NT_STATUS(0xc00000fe), W_ERROR(0x554)},
+ {NT_STATUS(0xc0000100), W_ERROR(0xcb)},
+ {NT_STATUS(0xc0000101), W_ERROR(0x91)},
+ {NT_STATUS(0xc0000102), W_ERROR(0x570)},
+ {NT_STATUS(0xc0000103), W_ERROR(0x10b)},
+ {NT_STATUS(0xc0000104), W_ERROR(0x555)},
+ {NT_STATUS(0xc0000105), W_ERROR(0x556)},
+ {NT_STATUS(0xc0000106), W_ERROR(0xce)},
+ {NT_STATUS(0xc0000107), W_ERROR(0x961)},
+ {NT_STATUS(0xc0000108), W_ERROR(0x964)},
+ {NT_STATUS(0xc000010a), W_ERROR(0x5)},
+ {NT_STATUS(0xc000010b), W_ERROR(0x557)},
+ {NT_STATUS(0xc000010d), W_ERROR(0x558)},
+ {NT_STATUS(0xc000010e), W_ERROR(0x420)},
+ {NT_STATUS(0xc0000117), W_ERROR(0x5a4)},
+ {NT_STATUS(0xc000011b), W_ERROR(0xc1)},
+ {NT_STATUS(0xc000011c), W_ERROR(0x559)},
+ {NT_STATUS(0xc000011d), W_ERROR(0x55a)},
+ {NT_STATUS(0xc000011e), W_ERROR(0x3ee)},
+ {NT_STATUS(0xc000011f), W_ERROR(0x4)},
+ {NT_STATUS(0xc0000120), W_ERROR(0x3e3)},
+ {NT_STATUS(0xc0000121), W_ERROR(0x5)},
+ {NT_STATUS(0xc0000122), W_ERROR(0x4ba)},
+ {NT_STATUS(0xc0000123), W_ERROR(0x5)},
+ {NT_STATUS(0xc0000124), W_ERROR(0x55b)},
+ {NT_STATUS(0xc0000125), W_ERROR(0x55c)},
+ {NT_STATUS(0xc0000126), W_ERROR(0x55d)},
+ {NT_STATUS(0xc0000127), W_ERROR(0x55e)},
+ {NT_STATUS(0xc0000128), W_ERROR(0x6)},
+ {NT_STATUS(0xc000012b), W_ERROR(0x55f)},
+ {NT_STATUS(0xc000012d), W_ERROR(0x5af)},
+ {NT_STATUS(0xc000012e), W_ERROR(0xc1)},
+ {NT_STATUS(0xc000012f), W_ERROR(0xc1)},
+ {NT_STATUS(0xc0000130), W_ERROR(0xc1)},
+ {NT_STATUS(0xc0000131), W_ERROR(0xc1)},
+ {NT_STATUS(0xc0000133), W_ERROR(0x576)},
+ {NT_STATUS(0xc0000135), W_ERROR(0x7e)},
+ {NT_STATUS(0xc0000138), W_ERROR(0xb6)},
+ {NT_STATUS(0xc0000139), W_ERROR(0x7f)},
+ {NT_STATUS(0xc000013b), W_ERROR(0x40)},
+ {NT_STATUS(0xc000013c), W_ERROR(0x40)},
+ {NT_STATUS(0xc000013d), W_ERROR(0x33)},
+ {NT_STATUS(0xc000013e), W_ERROR(0x3b)},
+ {NT_STATUS(0xc000013f), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000140), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000141), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000142), W_ERROR(0x45a)},
+ {NT_STATUS(0xc0000148), W_ERROR(0x7c)},
+ {NT_STATUS(0xc0000149), W_ERROR(0x56)},
+ {NT_STATUS(0xc000014b), W_ERROR(0x6d)},
+ {NT_STATUS(0xc000014c), W_ERROR(0x3f1)},
+ {NT_STATUS(0xc000014d), W_ERROR(0x3f8)},
+ {NT_STATUS(0xc000014f), W_ERROR(0x3ed)},
+ {NT_STATUS(0xc0000150), W_ERROR(0x45e)},
+ {NT_STATUS(0xc0000151), W_ERROR(0x560)},
+ {NT_STATUS(0xc0000152), W_ERROR(0x561)},
+ {NT_STATUS(0xc0000153), W_ERROR(0x562)},
+ {NT_STATUS(0xc0000154), W_ERROR(0x563)},
+ {NT_STATUS(0xc0000155), W_ERROR(0x564)},
+ {NT_STATUS(0xc0000156), W_ERROR(0x565)},
+ {NT_STATUS(0xc0000157), W_ERROR(0x566)},
+ {NT_STATUS(0xc0000158), W_ERROR(0x567)},
+ {NT_STATUS(0xc0000159), W_ERROR(0x3ef)},
+ {NT_STATUS(0xc000015a), W_ERROR(0x568)},
+ {NT_STATUS(0xc000015b), W_ERROR(0x569)},
+ {NT_STATUS(0xc000015c), W_ERROR(0x3f9)},
+ {NT_STATUS(0xc000015d), W_ERROR(0x56a)},
+ {NT_STATUS(0xc000015f), W_ERROR(0x45d)},
+ {NT_STATUS(0xc0000162), W_ERROR(0x459)},
+ {NT_STATUS(0xc0000165), W_ERROR(0x462)},
+ {NT_STATUS(0xc0000166), W_ERROR(0x463)},
+ {NT_STATUS(0xc0000167), W_ERROR(0x464)},
+ {NT_STATUS(0xc0000168), W_ERROR(0x465)},
+ {NT_STATUS(0xc0000169), W_ERROR(0x466)},
+ {NT_STATUS(0xc000016a), W_ERROR(0x467)},
+ {NT_STATUS(0xc000016b), W_ERROR(0x468)},
+ {NT_STATUS(0xc000016c), W_ERROR(0x45f)},
+ {NT_STATUS(0xc000016d), W_ERROR(0x45d)},
+ {NT_STATUS(0xc0000172), W_ERROR(0x451)},
+ {NT_STATUS(0xc0000173), W_ERROR(0x452)},
+ {NT_STATUS(0xc0000174), W_ERROR(0x453)},
+ {NT_STATUS(0xc0000175), W_ERROR(0x454)},
+ {NT_STATUS(0xc0000176), W_ERROR(0x455)},
+ {NT_STATUS(0xc0000177), W_ERROR(0x469)},
+ {NT_STATUS(0xc0000178), W_ERROR(0x458)},
+ {NT_STATUS(0xc000017a), W_ERROR(0x56b)},
+ {NT_STATUS(0xc000017b), W_ERROR(0x56c)},
+ {NT_STATUS(0xc000017c), W_ERROR(0x3fa)},
+ {NT_STATUS(0xc000017d), W_ERROR(0x3fb)},
+ {NT_STATUS(0xc000017e), W_ERROR(0x56d)},
+ {NT_STATUS(0xc000017f), W_ERROR(0x56e)},
+ {NT_STATUS(0xc0000180), W_ERROR(0x3fc)},
+ {NT_STATUS(0xc0000181), W_ERROR(0x3fd)},
+ {NT_STATUS(0xc0000182), W_ERROR(0x57)},
+ {NT_STATUS(0xc0000183), W_ERROR(0x45d)},
+ {NT_STATUS(0xc0000184), W_ERROR(0x16)},
+ {NT_STATUS(0xc0000185), W_ERROR(0x45d)},
+ {NT_STATUS(0xc0000186), W_ERROR(0x45d)},
+ {NT_STATUS(0xc0000188), W_ERROR(0x5de)},
+ {NT_STATUS(0xc0000189), W_ERROR(0x13)},
+ {NT_STATUS(0xc000018a), W_ERROR(0x6fa)},
+ {NT_STATUS(0xc000018b), W_ERROR(0x6fb)},
+ {NT_STATUS(0xc000018c), W_ERROR(0x6fc)},
+ {NT_STATUS(0xc000018d), W_ERROR(0x6fd)},
+ {NT_STATUS(0xc000018e), W_ERROR(0x5dc)},
+ {NT_STATUS(0xc000018f), W_ERROR(0x5dd)},
+ {NT_STATUS(0xc0000190), W_ERROR(0x6fe)},
+ {NT_STATUS(0xc0000192), W_ERROR(0x700)},
+ {NT_STATUS(0xc0000193), W_ERROR(0x701)},
+ {NT_STATUS(0xc0000194), W_ERROR(0x46b)},
+ {NT_STATUS(0xc0000195), W_ERROR(0x4c3)},
+ {NT_STATUS(0xc0000196), W_ERROR(0x4c4)},
+ {NT_STATUS(0xc0000197), W_ERROR(0x5df)},
+ {NT_STATUS(0xc0000198), W_ERROR(0x70f)},
+ {NT_STATUS(0xc0000199), W_ERROR(0x710)},
+ {NT_STATUS(0xc000019a), W_ERROR(0x711)},
+ {NT_STATUS(0xc000019b), W_ERROR(0x712)},
+ {NT_STATUS(0xc0000202), W_ERROR(0x572)},
+ {NT_STATUS(0xc0000203), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000204), W_ERROR(0x717)},
+ {NT_STATUS(0xc0000205), W_ERROR(0x46a)},
+ {NT_STATUS(0xc0000206), W_ERROR(0x6f8)},
+ {NT_STATUS(0xc0000207), W_ERROR(0x4be)},
+ {NT_STATUS(0xc0000208), W_ERROR(0x4be)},
+ {NT_STATUS(0xc0000209), W_ERROR(0x44)},
+ {NT_STATUS(0xc000020a), W_ERROR(0x34)},
+ {NT_STATUS(0xc000020b), W_ERROR(0x40)},
+ {NT_STATUS(0xc000020c), W_ERROR(0x40)},
+ {NT_STATUS(0xc000020d), W_ERROR(0x40)},
+ {NT_STATUS(0xc000020e), W_ERROR(0x44)},
+ {NT_STATUS(0xc000020f), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000210), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000211), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000212), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000213), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000214), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000215), W_ERROR(0x3b)},
+ {NT_STATUS(0xc0000216), W_ERROR(0x32)},
+ {NT_STATUS(0xc0000217), W_ERROR(0x32)},
+ {NT_STATUS(0xc000021c), W_ERROR(0x17e6)},
+ {NT_STATUS(0xc0000220), W_ERROR(0x46c)},
+ {NT_STATUS(0xc0000221), W_ERROR(0xc1)},
+ {NT_STATUS(0xc0000224), W_ERROR(0x773)},
+ {NT_STATUS(0xc0000225), W_ERROR(0x490)},
+ {NT_STATUS(0xc000022a), W_ERROR(0xc000022a)},
+ {NT_STATUS(0xc000022b), W_ERROR(0xc000022b)},
+ {NT_STATUS(0xc000022d), W_ERROR(0x4d5)},
+ {NT_STATUS(0xc0000230), W_ERROR(0x492)},
+ {NT_STATUS(0xc0000233), W_ERROR(0x774)},
+ {NT_STATUS(0xc0000234), W_ERROR(0x775)},
+ {NT_STATUS(0xc0000235), W_ERROR(0x6)},
+ {NT_STATUS(0xc0000236), W_ERROR(0x4c9)},
+ {NT_STATUS(0xc0000237), W_ERROR(0x4ca)},
+ {NT_STATUS(0xc0000238), W_ERROR(0x4cb)},
+ {NT_STATUS(0xc0000239), W_ERROR(0x4cc)},
+ {NT_STATUS(0xc000023a), W_ERROR(0x4cd)},
+ {NT_STATUS(0xc000023b), W_ERROR(0x4ce)},
+ {NT_STATUS(0xc000023c), W_ERROR(0x4cf)},
+ {NT_STATUS(0xc000023d), W_ERROR(0x4d0)},
+ {NT_STATUS(0xc000023e), W_ERROR(0x4d1)},
+ {NT_STATUS(0xc000023f), W_ERROR(0x4d2)},
+ {NT_STATUS(0xc0000240), W_ERROR(0x4d3)},
+ {NT_STATUS(0xc0000241), W_ERROR(0x4d4)},
+ {NT_STATUS(0xc0000243), W_ERROR(0x4c8)},
+ {NT_STATUS(0xc0000246), W_ERROR(0x4d6)},
+ {NT_STATUS(0xc0000247), W_ERROR(0x4d7)},
+ {NT_STATUS(0xc0000248), W_ERROR(0x4d8)},
+ {NT_STATUS(0xc0000249), W_ERROR(0xc1)},
+ {NT_STATUS(0xc0000253), W_ERROR(0x54f)},
+ {NT_STATUS(0xc0000257), W_ERROR(0x4d0)},
+ {NT_STATUS(0xc0000259), W_ERROR(0x573)},
+ {NT_STATUS(0xc000025e), W_ERROR(0x422)},
+ {NT_STATUS(0xc0000262), W_ERROR(0xb6)},
+ {NT_STATUS(0xc0000263), W_ERROR(0x7f)},
+ {NT_STATUS(0xc0000264), W_ERROR(0x120)},
+ {NT_STATUS(0xc0000265), W_ERROR(0x476)},
+ {NT_STATUS(0xc0000267), W_ERROR(0x10fe)},
+ {NT_STATUS(0xc000026c), W_ERROR(0x7d1)},
+ {NT_STATUS(0xc000026d), W_ERROR(0x4b1)},
+ {NT_STATUS(0xc000026e), W_ERROR(0x15)},
+ {NT_STATUS(0xc0000272), W_ERROR(0x491)},
+ {NT_STATUS(0xc0000275), W_ERROR(0x1126)},
+ {NT_STATUS(0xc0000276), W_ERROR(0x1129)},
+ {NT_STATUS(0xc0000277), W_ERROR(0x112a)},
+ {NT_STATUS(0xc0000278), W_ERROR(0x1128)},
+ {NT_STATUS(0xc0000279), W_ERROR(0x780)},
+ {NT_STATUS(0xc0000280), W_ERROR(0x781)},
+ {NT_STATUS(0xc0000281), W_ERROR(0xa1)},
+ {NT_STATUS(0xc0000283), W_ERROR(0x488)},
+ {NT_STATUS(0xc0000284), W_ERROR(0x489)},
+ {NT_STATUS(0xc0000285), W_ERROR(0x48a)},
+ {NT_STATUS(0xc0000286), W_ERROR(0x48b)},
+ {NT_STATUS(0xc0000287), W_ERROR(0x48c)},
+ {NT_STATUS(0xc000028a), W_ERROR(0x5)},
+ {NT_STATUS(0xc000028b), W_ERROR(0x5)},
+ {NT_STATUS(0xc000028d), W_ERROR(0x5)},
+ {NT_STATUS(0xc000028e), W_ERROR(0x5)},
+ {NT_STATUS(0xc000028f), W_ERROR(0x5)},
+ {NT_STATUS(0xc0000290), W_ERROR(0x5)},
+ {NT_STATUS(0xc0000291), W_ERROR(0x1777)},
+ {NT_STATUS(0xc0000292), W_ERROR(0x1778)},
+ {NT_STATUS(0xc0000293), W_ERROR(0x1772)},
+ {NT_STATUS(0xc0000295), W_ERROR(0x1068)},
+ {NT_STATUS(0xc0000296), W_ERROR(0x1069)},
+ {NT_STATUS(0xc0000297), W_ERROR(0x106a)},
+ {NT_STATUS(0xc0000298), W_ERROR(0x106b)},
+ {NT_STATUS(0xc0000299), W_ERROR(0x201a)},
+ {NT_STATUS(0xc000029a), W_ERROR(0x201b)},
+ {NT_STATUS(0xc000029b), W_ERROR(0x201c)},
+ {NT_STATUS(0xc000029c), W_ERROR(0x1)},
+ {NT_STATUS(0xc000029d), W_ERROR(0x10ff)},
+ {NT_STATUS(0xc000029e), W_ERROR(0x1100)},
+ {NT_STATUS(0xc000029f), W_ERROR(0x494)},
+ {NT_STATUS(0xc00002a1), W_ERROR(0x200a)},
+ {NT_STATUS(0xc00002a2), W_ERROR(0x200b)},
+ {NT_STATUS(0xc00002a3), W_ERROR(0x200c)},
+ {NT_STATUS(0xc00002a4), W_ERROR(0x200d)},
+ {NT_STATUS(0xc00002a5), W_ERROR(0x200e)},
+ {NT_STATUS(0xc00002a6), W_ERROR(0x200f)},
+ {NT_STATUS(0xc00002a7), W_ERROR(0x2010)},
+ {NT_STATUS(0xc00002a8), W_ERROR(0x2011)},
+ {NT_STATUS(0xc00002a9), W_ERROR(0x2012)},
+ {NT_STATUS(0xc00002aa), W_ERROR(0x2013)},
+ {NT_STATUS(0xc00002ab), W_ERROR(0x2014)},
+ {NT_STATUS(0xc00002ac), W_ERROR(0x2015)},
+ {NT_STATUS(0xc00002ad), W_ERROR(0x2016)},
+ {NT_STATUS(0xc00002ae), W_ERROR(0x2017)},
+ {NT_STATUS(0xc00002af), W_ERROR(0x2018)},
+ {NT_STATUS(0xc00002b0), W_ERROR(0x2019)},
+ {NT_STATUS(0xc00002b1), W_ERROR(0x211e)},
+ {NT_STATUS(0xc00002b2), W_ERROR(0x1127)},
+ {NT_STATUS(0xc00002b6), W_ERROR(0x651)},
+ {NT_STATUS(0xc00002b7), W_ERROR(0x49a)},
+ {NT_STATUS(0xc00002b8), W_ERROR(0x49b)},
+ {NT_STATUS(0xc00002c1), W_ERROR(0x2024)},
+ {NT_STATUS(0xc00002c3), W_ERROR(0x575)},
+ {NT_STATUS(0xc00002c5), W_ERROR(0x3e6)},
+ {NT_STATUS(0xc00002c6), W_ERROR(0x1075)},
+ {NT_STATUS(0xc00002c7), W_ERROR(0x1076)},
+ {NT_STATUS(0xc00002ca), W_ERROR(0x10e8)},
+ {NT_STATUS(0xc00002cb), W_ERROR(0x2138)},
+ {NT_STATUS(0xc00002cc), W_ERROR(0x4e3)},
+ {NT_STATUS(0xc00002cd), W_ERROR(0x2139)},
+ {NT_STATUS(0xc00002cf), W_ERROR(0x49d)},
+ {NT_STATUS(0xc00002d0), W_ERROR(0x213a)},
+ {NT_STATUS(0xc00002d4), W_ERROR(0x2141)},
+ {NT_STATUS(0xc00002d5), W_ERROR(0x2142)},
+ {NT_STATUS(0xc00002d6), W_ERROR(0x2143)},
+ {NT_STATUS(0xc00002d7), W_ERROR(0x2144)},
+ {NT_STATUS(0xc00002d8), W_ERROR(0x2145)},
+ {NT_STATUS(0xc00002d9), W_ERROR(0x2146)},
+ {NT_STATUS(0xc00002da), W_ERROR(0x2147)},
+ {NT_STATUS(0xc00002db), W_ERROR(0x2148)},
+ {NT_STATUS(0xc00002dc), W_ERROR(0x2149)},
+ {NT_STATUS(0xc00002dd), W_ERROR(0x32)},
+ {NT_STATUS(0xc00002df), W_ERROR(0x2151)},
+ {NT_STATUS(0xc00002e0), W_ERROR(0x2152)},
+ {NT_STATUS(0xc00002e1), W_ERROR(0x2153)},
+ {NT_STATUS(0xc00002e2), W_ERROR(0x2154)},
+ {NT_STATUS(0xc00002e3), W_ERROR(0x215d)},
+ {NT_STATUS(0xc00002e4), W_ERROR(0x2163)},
+ {NT_STATUS(0xc00002e5), W_ERROR(0x2164)},
+ {NT_STATUS(0xc00002e6), W_ERROR(0x2165)},
+ {NT_STATUS(0xc00002e7), W_ERROR(0x216d)},
+ {NT_STATUS(0xc00002fe), W_ERROR(0x45b)},
+ {NT_STATUS(0xc00002ff), W_ERROR(0x4e7)},
+ {NT_STATUS(0xc0000300), W_ERROR(0x4e6)},
+ {NT_STATUS(0x80000001), W_ERROR(0x80000001)},
+ {NT_STATUS(0x80000002), W_ERROR(0x3e6)},
+ {NT_STATUS(0x80000003), W_ERROR(0x80000003)},
+ {NT_STATUS(0x80000004), W_ERROR(0x80000004)},
+ {NT_STATUS(0x80000005), W_ERROR(0xea)},
+ {NT_STATUS(0x80000006), W_ERROR(0x12)},
+ {NT_STATUS(0x8000000b), W_ERROR(0x56f)},
+ {NT_STATUS(0x8000000d), W_ERROR(0x12b)},
+ {NT_STATUS(0x8000000e), W_ERROR(0x1c)},
+ {NT_STATUS(0x8000000f), W_ERROR(0x15)},
+ {NT_STATUS(0x80000010), W_ERROR(0x15)},
+ {NT_STATUS(0x80000011), W_ERROR(0xaa)},
+ {NT_STATUS(0x80000012), W_ERROR(0x103)},
+ {NT_STATUS(0x80000013), W_ERROR(0xfe)},
+ {NT_STATUS(0x80000014), W_ERROR(0xff)},
+ {NT_STATUS(0x80000015), W_ERROR(0xff)},
+ {NT_STATUS(0x80000016), W_ERROR(0x456)},
+ {NT_STATUS(0x8000001a), W_ERROR(0x103)},
+ {NT_STATUS(0x8000001b), W_ERROR(0x44d)},
+ {NT_STATUS(0x8000001c), W_ERROR(0x456)},
+ {NT_STATUS(0x8000001d), W_ERROR(0x457)},
+ {NT_STATUS(0x8000001e), W_ERROR(0x44c)},
+ {NT_STATUS(0x8000001f), W_ERROR(0x44e)},
+ {NT_STATUS(0x80000021), W_ERROR(0x44f)},
+ {NT_STATUS(0x80000022), W_ERROR(0x450)},
+ {NT_STATUS(0x80000025), W_ERROR(0x962)},
+ {NT_STATUS(0x80000288), W_ERROR(0x48d)},
+ {NT_STATUS(0x80000289), W_ERROR(0x48e)},
+ {NT_STATUS_OK, WERR_OK}};
+
/*****************************************************************************
convert a dos eclas/ecode to a NT status32 code
@@ -825,6 +1366,7 @@ convert a dos eclas/ecode to a NT status32 code
NTSTATUS dos_to_ntstatus(int eclass, int ecode)
{
int i;
+ if (eclass == 0 && ecode == 0) 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 +1383,11 @@ convert a NT status code to a dos class/code
void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode)
{
int i;
+ if (NT_STATUS_IS_OK(ntstatus)) {
+ *eclass = 0;
+ *ecode = 0;
+ 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)) {
@@ -852,3 +1399,40 @@ void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode)
*eclass = ERRSRV;
*ecode = ERRerror;
}
+
+
+/*****************************************************************************
+convert a WERROR to a NT status32 code
+ *****************************************************************************/
+NTSTATUS werror_to_ntstatus(WERROR error)
+{
+ int i;
+ if (W_ERROR_IS_OK(error)) return NT_STATUS_OK;
+ for (i=0; NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus); i++) {
+ if (W_ERROR_V(error) ==
+ W_ERROR_V(ntstatus_to_werror_map[i].werror)) {
+ return ntstatus_to_werror_map[i].ntstatus;
+ }
+ }
+
+ /* just guess ... */
+ return NT_STATUS(W_ERROR_V(error) | 0xc0000000);
+}
+
+/*****************************************************************************
+convert a NTSTATUS to a WERROR
+ *****************************************************************************/
+WERROR ntstatus_to_werror(NTSTATUS error)
+{
+ int i;
+ if (NT_STATUS_IS_OK(error)) return WERR_OK;
+ for (i=0; NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus); i++) {
+ if (NT_STATUS_V(error) ==
+ NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus)) {
+ return ntstatus_to_werror_map[i].werror;
+ }
+ }
+
+ /* a lame guess */
+ return W_ERROR(NT_STATUS_V(error) & 0xffff);
+}
diff --git a/source3/libsmb/smberr.c b/source3/libsmb/smberr.c
index e6ecfefb34..00966aed43 100644
--- a/source3/libsmb/smberr.c
+++ b/source3/libsmb/smberr.c
@@ -193,3 +193,14 @@ char *werror_str(WERROR status)
slprintf(msg, sizeof(msg), "WIN32 code 0x%08x", W_ERROR_V(status));
return msg;
}
+
+
+/*****************************************************************************
+map a unix errno to a win32 error
+ *****************************************************************************/
+WERROR map_werror_from_unix(int error)
+{
+ NTSTATUS status = map_nt_error_from_unix(error);
+ return ntstatus_to_werror(status);
+}
+
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 8afd5195af..0c3a71c1d6 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -3388,18 +3388,18 @@ BOOL get_specific_param(NT_PRINTER_INFO_LEVEL printer, uint32 level,
Store a security desc for a printer.
****************************************************************************/
-uint32 nt_printing_setsec(char *printername, SEC_DESC_BUF *secdesc_ctr)
+WERROR nt_printing_setsec(char *printername, SEC_DESC_BUF *secdesc_ctr)
{
SEC_DESC_BUF *new_secdesc_ctr = NULL;
SEC_DESC_BUF *old_secdesc_ctr = NULL;
prs_struct ps;
TALLOC_CTX *mem_ctx = NULL;
fstring key;
- NTSTATUS status;
+ WERROR status;
mem_ctx = talloc_init();
if (mem_ctx == NULL)
- return False;
+ return WERR_NOMEM;
/* The old owner and group sids of the security descriptor are not
present when new ACEs are added or removed by changing printer
@@ -3454,7 +3454,7 @@ uint32 nt_printing_setsec(char *printername, SEC_DESC_BUF *secdesc_ctr)
if (!sec_io_desc_buf("nt_printing_setsec", &new_secdesc_ctr,
&ps, 1)) {
- status = ERRbadfunc;
+ status = WERR_BADFUNC;
goto out;
}
@@ -3464,7 +3464,7 @@ uint32 nt_printing_setsec(char *printername, SEC_DESC_BUF *secdesc_ctr)
status = 0;
} else {
DEBUG(1,("Failed to store secdesc for %s\n", printername));
- status = ERRbadfunc;
+ status = WERR_BADFUNC;
}
/* Free malloc'ed memory */
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 370abd4fdf..8be46488dd 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -603,7 +603,7 @@ static BOOL is_owner(struct current_user *user, int jobid)
/****************************************************************************
delete a print job
****************************************************************************/
-BOOL print_job_delete(struct current_user *user, int jobid, int *errcode)
+BOOL print_job_delete(struct current_user *user, int jobid, WERROR *errcode)
{
int snum = print_job_snum(jobid);
char *printer_name;
@@ -617,7 +617,7 @@ BOOL print_job_delete(struct current_user *user, int jobid, int *errcode)
if (!owner &&
!print_access_check(user, snum, JOB_ACCESS_ADMINISTER)) {
DEBUG(3, ("delete denied by security descriptor\n"));
- *errcode = ERRnoaccess;
+ *errcode = WERR_ACCESS_DENIED;
return False;
}
@@ -641,7 +641,7 @@ BOOL print_job_delete(struct current_user *user, int jobid, int *errcode)
/****************************************************************************
pause a job
****************************************************************************/
-BOOL print_job_pause(struct current_user *user, int jobid, int *errcode)
+BOOL print_job_pause(struct current_user *user, int jobid, WERROR *errcode)
{
struct printjob *pjob = print_job_find(jobid);
int snum, ret = -1;
@@ -685,7 +685,7 @@ BOOL print_job_pause(struct current_user *user, int jobid, int *errcode)
/****************************************************************************
resume a job
****************************************************************************/
-BOOL print_job_resume(struct current_user *user, int jobid, int *errcode)
+BOOL print_job_resume(struct current_user *user, int jobid, WERROR *errcode)
{
struct printjob *pjob = print_job_find(jobid);
char *printer_name;
@@ -1184,20 +1184,20 @@ int print_queue_snum(char *qname)
/****************************************************************************
pause a queue
****************************************************************************/
-BOOL print_queue_pause(struct current_user *user, int snum, int *errcode)
+BOOL print_queue_pause(struct current_user *user, int snum, WERROR *errcode)
{
char *printer_name;
int ret;
if (!print_access_check(user, snum, PRINTER_ACCESS_ADMINISTER)) {
- *errcode = ERRnoaccess;
+ *errcode = WERR_ACCESS_DENIED;
return False;
}
ret = (*(current_printif->queue_pause))(snum);
if (ret != 0) {
- *errcode = ERRinvalidparam;
+ *errcode = WERR_INVALID_PARAM;
return False;
}
@@ -1216,20 +1216,20 @@ BOOL print_queue_pause(struct current_user *user, int snum, int *errcode)
/****************************************************************************
resume a queue
****************************************************************************/
-BOOL print_queue_resume(struct current_user *user, int snum, int *errcode)
+BOOL print_queue_resume(struct current_user *user, int snum, WERROR *errcode)
{
char *printer_name;
int ret;
if (!print_access_check(user, snum, PRINTER_ACCESS_ADMINISTER)) {
- *errcode = ERRnoaccess;
+ *errcode = WERR_ACCESS_DENIED;
return False;
}
ret = (*(current_printif->queue_resume))(snum);
if (ret != 0) {
- *errcode = ERRinvalidparam;
+ *errcode = WERR_INVALID_PARAM;
return False;
}
@@ -1248,7 +1248,7 @@ BOOL print_queue_resume(struct current_user *user, int snum, int *errcode)
/****************************************************************************
purge a queue - implemented by deleting all jobs that we can delete
****************************************************************************/
-BOOL print_queue_purge(struct current_user *user, int snum, int *errcode)
+BOOL print_queue_purge(struct current_user *user, int snum, WERROR *errcode)
{
print_queue_struct *queue;
print_status_struct status;
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 140eed5c05..80c809047c 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4000,7 +4000,7 @@ WERROR _spoolss_startdocprinter(pipes_struct *p, SPOOL_Q_STARTDOCPRINTER *q_u, S
NT error code. */
if (Printer->jobid == -1) {
- return map_nt_error_from_unix(errno);
+ return map_werror_from_unix(errno);
}
Printer->document_started=True;
@@ -4045,7 +4045,7 @@ NTSTATUS _spoolss_writeprinter(pipes_struct *p, SPOOL_Q_WRITEPRINTER *q_u, SPOOL
r_u->buffer_written = q_u->buffer_size2;
- return 0x0;
+ return NT_STATUS_OK;
}
/********************************************************************
@@ -4053,38 +4053,39 @@ NTSTATUS _spoolss_writeprinter(pipes_struct *p, SPOOL_Q_WRITEPRINTER *q_u, SPOOL
* called from the spoolss dispatcher
*
********************************************************************/
-static NTSTATUS control_printer(POLICY_HND *handle, uint32 command,
+static WERROR control_printer(POLICY_HND *handle, uint32 command,
pipes_struct *p)
{
struct current_user user;
- int snum, errcode = ERRbadfunc;
+ int snum;
+ WERROR errcode = WERR_BADFUNC;
Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
get_current_user(&user, p);
if (!Printer) {
DEBUG(0,("control_printer: Invalid handle (%s)\n", OUR_HANDLE(handle)));
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
if (!get_printer_snum(p, handle, &snum))
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
switch (command) {
case PRINTER_CONTROL_PAUSE:
if (print_queue_pause(&user, snum, &errcode)) {
- errcode = 0;
+ errcode = WERR_OK;
}
break;
case PRINTER_CONTROL_RESUME:
case PRINTER_CONTROL_UNPAUSE:
if (print_queue_resume(&user, snum, &errcode)) {
- errcode = 0;
+ errcode = WERR_OK;
}
break;
case PRINTER_CONTROL_PURGE:
if (print_queue_purge(&user, snum, &errcode)) {
- errcode = 0;
+ errcode = WERR_OK;
}
break;
default:
@@ -4098,7 +4099,7 @@ static NTSTATUS control_printer(POLICY_HND *handle, uint32 command,
* api_spoolss_abortprinter
********************************************************************/
-NTSTATUS _spoolss_abortprinter(pipes_struct *p, SPOOL_Q_ABORTPRINTER *q_u, SPOOL_R_ABORTPRINTER *r_u)
+WERROR _spoolss_abortprinter(pipes_struct *p, SPOOL_Q_ABORTPRINTER *q_u, SPOOL_R_ABORTPRINTER *r_u)
{
POLICY_HND *handle = &q_u->handle;
@@ -4109,13 +4110,13 @@ NTSTATUS _spoolss_abortprinter(pipes_struct *p, SPOOL_Q_ABORTPRINTER *q_u, SPOOL
* called by spoolss_api_setprinter
* when updating a printer description
********************************************************************/
-static NTSTATUS update_printer_sec(POLICY_HND *handle, uint32 level,
+static WERROR update_printer_sec(POLICY_HND *handle, uint32 level,
const SPOOL_PRINTER_INFO_LEVEL *info,
pipes_struct *p, SEC_DESC_BUF *secdesc_ctr)
{
SEC_DESC_BUF *new_secdesc_ctr = NULL, *old_secdesc_ctr = NULL;
struct current_user user;
- uint32 result;
+ WERROR result;
int snum;
Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
@@ -4124,7 +4125,7 @@ static NTSTATUS update_printer_sec(POLICY_HND *handle, uint32 level,
DEBUG(0,("update_printer_sec: Invalid handle (%s)\n",
OUR_HANDLE(handle)));
- result = NT_STATUS_INVALID_HANDLE;
+ result = WERR_BADFID;
goto done;
}
@@ -4174,7 +4175,7 @@ static NTSTATUS update_printer_sec(POLICY_HND *handle, uint32 level,
new_secdesc_ctr = sec_desc_merge(p->mem_ctx, secdesc_ctr, old_secdesc_ctr);
if (sec_desc_equal(new_secdesc_ctr->sec, old_secdesc_ctr->sec)) {
- result = NT_STATUS_OK;
+ result = WERR_OK;
goto done;
}
@@ -4188,7 +4189,7 @@ static NTSTATUS update_printer_sec(POLICY_HND *handle, uint32 level,
information. */
if (!print_access_check(&user, snum, PRINTER_ACCESS_ADMINISTER)) {
- result = NT_STATUS_ACCESS_DENIED;
+ result = WERR_ACCESS_DENIED;
goto done;
}
@@ -4521,18 +4522,18 @@ static BOOL nt_printer_info_level_equal(NT_PRINTER_INFO_LEVEL *p1,
* when updating a printer description
********************************************************************/
-static NTSTATUS update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
+static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
const SPOOL_PRINTER_INFO_LEVEL *info,
DEVICEMODE *devmode)
{
int snum;
NT_PRINTER_INFO_LEVEL *printer = NULL, *old_printer = NULL;
Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
- uint32 result;
+ WERROR result;
DEBUG(8,("update_printer\n"));
- result = NT_STATUS_OK;
+ result = WERR_OK;
if (level!=2) {
DEBUG(0,("Send a mail to samba@samba.org\n"));
@@ -4542,18 +4543,18 @@ static NTSTATUS update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level
}
if (!Printer) {
- result = NT_STATUS_INVALID_HANDLE;
+ result = WERR_BADFID;
goto done;
}
if (!get_printer_snum(p, handle, &snum)) {
- result = NT_STATUS_INVALID_HANDLE;
+ result = WERR_BADFID;
goto done;
}
- if((get_a_printer(&printer, 2, lp_servicename(snum)) != 0) ||
- (get_a_printer(&old_printer, 2, lp_servicename(snum)) != 0)) {
- result = NT_STATUS_INVALID_HANDLE;
+ if (!W_ERROR_IS_OK(get_a_printer(&printer, 2, lp_servicename(snum))) ||
+ (!W_ERROR_IS_OK(get_a_printer(&old_printer, 2, lp_servicename(snum))))) {
+ result = WERR_BADFID;
goto done;
}
@@ -4582,7 +4583,7 @@ static NTSTATUS update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level
/* Do sanity check on the requested changes for Samba */
if (!check_printer_ok(printer->info_2, snum)) {
- result = ERRinvalidparam;
+ result = WERR_INVALID_PARAM;
goto done;
}
@@ -4592,7 +4593,7 @@ static NTSTATUS update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level
if (nt_printer_info_level_equal(printer, old_printer)) {
DEBUG(3, ("printer info has not changed\n"));
- result = NT_STATUS_OK;
+ result = WERR_OK;
goto done;
}
@@ -4601,7 +4602,7 @@ static NTSTATUS update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level
if (!print_access_check(NULL, snum, PRINTER_ACCESS_ADMINISTER)) {
DEBUG(3, ("printer property change denied by security "
"descriptor\n"));
- result = NT_STATUS_ACCESS_DENIED;
+ result = WERR_ACCESS_DENIED;
goto done;
}
@@ -4609,7 +4610,7 @@ static NTSTATUS update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level
if (*lp_addprinter_cmd() )
if ( !add_printer_hook(printer) ) {
- result = NT_STATUS_ACCESS_DENIED;
+ result = WERR_ACCESS_DENIED;
goto done;
}
@@ -4617,7 +4618,7 @@ static NTSTATUS update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level
if (add_a_printer(*printer, 2)!=0) {
/* I don't really know what to return here !!! */
- result = NT_STATUS_ACCESS_DENIED;
+ result = WERR_ACCESS_DENIED;
goto done;
}
@@ -4633,7 +4634,7 @@ static NTSTATUS update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SETPRINTER *r_u)
+WERROR _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SETPRINTER *r_u)
{
POLICY_HND *handle = &q_u->handle;
uint32 level = q_u->level;
@@ -4646,7 +4647,7 @@ NTSTATUS _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_S
if (!Printer) {
DEBUG(0,("_spoolss_setprinter: Invalid handle (%s)\n", OUR_HANDLE(handle)));
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
/* check the level */
@@ -4694,16 +4695,16 @@ NTSTATUS _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u)
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_addjob(pipes_struct *p, SPOOL_Q_ADDJOB *q_u, SPOOL_R_ADDJOB *r_u)
+WERROR _spoolss_addjob(pipes_struct *p, SPOOL_Q_ADDJOB *q_u, SPOOL_R_ADDJOB *r_u)
{
/* that's an [in out] buffer (despite appearences to the contrary) */
spoolss_move_buffer(q_u->buffer, &r_u->buffer);
r_u->needed = 0;
- return ERRinvalidparam; /* this is what a NT server
- returns for AddJob. AddJob
- must fail on non-local
- printers */
+ return WERR_INVALID_PARAM; /* this is what a NT server
+ returns for AddJob. AddJob
+ must fail on non-local
+ printers */
}
/****************************************************************************
@@ -4786,7 +4787,7 @@ static BOOL fill_job_info_2(JOB_INFO_2 *job_info, print_queue_struct *queue,
/****************************************************************************
Enumjobs at level 1.
****************************************************************************/
-static NTSTATUS enumjobs_level1(print_queue_struct *queue, int snum,
+static WERROR enumjobs_level1(print_queue_struct *queue, int snum,
NEW_BUFFER *buffer, uint32 offered,
uint32 *needed, uint32 *returned)
{
@@ -4825,14 +4826,14 @@ static NTSTATUS enumjobs_level1(print_queue_struct *queue, int snum,
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
Enumjobs at level 2.
****************************************************************************/
-static NTSTATUS enumjobs_level2(print_queue_struct *queue, int snum,
+static WERROR enumjobs_level2(print_queue_struct *queue, int snum,
NEW_BUFFER *buffer, uint32 offered,
uint32 *needed, uint32 *returned)
{
@@ -4880,15 +4881,15 @@ static NTSTATUS enumjobs_level2(print_queue_struct *queue, int snum,
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
Enumjobs.
****************************************************************************/
-NTSTATUS _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJOBS *r_u)
+WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJOBS *r_u)
{
POLICY_HND *handle = &q_u->handle;
/* uint32 firstjob = q_u->firstjob; - notused. */
@@ -4915,14 +4916,14 @@ NTSTATUS _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUM
*returned=0;
if (!get_printer_snum(p, handle, &snum))
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
*returned = print_queue_status(snum, &queue, &prt_status);
DEBUGADD(4,("count:[%d], status:[%d], [%s]\n", *returned, prt_status.status, prt_status.message));
if (*returned == 0) {
safe_free(queue);
- return NT_STATUS_OK;
+ return WERR_OK;
}
switch (level) {
@@ -4940,15 +4941,15 @@ NTSTATUS _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUM
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_schedulejob( pipes_struct *p, SPOOL_Q_SCHEDULEJOB *q_u, SPOOL_R_SCHEDULEJOB *r_u)
+WERROR _spoolss_schedulejob( pipes_struct *p, SPOOL_Q_SCHEDULEJOB *q_u, SPOOL_R_SCHEDULEJOB *r_u)
{
- return 0x0;
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r_u)
+WERROR _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r_u)
{
POLICY_HND *handle = &q_u->handle;
uint32 jobid = q_u->jobid;
@@ -4958,12 +4959,13 @@ NTSTATUS _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r
struct current_user user;
print_status_struct prt_status;
- int snum, errcode = ERRbadfunc;
+ int snum;
+ WERROR errcode = WERR_BADFUNC;
memset(&prt_status, 0, sizeof(prt_status));
if (!get_printer_snum(p, handle, &snum)) {
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
if (!print_job_exists(jobid)) {
@@ -5000,13 +5002,12 @@ NTSTATUS _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r
/****************************************************************************
Enumerates all printer drivers at level 1.
****************************************************************************/
-static NTSTATUS enumprinterdrivers_level1(fstring servername, fstring architecture, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprinterdrivers_level1(fstring servername, fstring architecture, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
int i;
int ndrivers;
uint32 version;
fstring *list = NULL;
-
NT_PRINTER_DRIVER_INFO_LEVEL driver;
DRIVER_INFO_1 *tdi1, *driver_info_1=NULL;
@@ -5071,20 +5072,19 @@ static NTSTATUS enumprinterdrivers_level1(fstring servername, fstring architectu
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
Enumerates all printer drivers at level 2.
****************************************************************************/
-static NTSTATUS enumprinterdrivers_level2(fstring servername, fstring architecture, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprinterdrivers_level2(fstring servername, fstring architecture, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
int i;
int ndrivers;
uint32 version;
fstring *list = NULL;
-
NT_PRINTER_DRIVER_INFO_LEVEL driver;
DRIVER_INFO_2 *tdi2, *driver_info_2=NULL;
@@ -5150,20 +5150,19 @@ static NTSTATUS enumprinterdrivers_level2(fstring servername, fstring architectu
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
Enumerates all printer drivers at level 3.
****************************************************************************/
-static NTSTATUS enumprinterdrivers_level3(fstring servername, fstring architecture, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprinterdrivers_level3(fstring servername, fstring architecture, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
int i;
int ndrivers;
uint32 version;
fstring *list = NULL;
-
NT_PRINTER_DRIVER_INFO_LEVEL driver;
DRIVER_INFO_3 *tdi3, *driver_info_3=NULL;
@@ -5232,15 +5231,15 @@ static NTSTATUS enumprinterdrivers_level3(fstring servername, fstring architectu
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
Enumerates all printer drivers.
****************************************************************************/
-NTSTATUS _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, SPOOL_R_ENUMPRINTERDRIVERS *r_u)
+WERROR _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, SPOOL_R_ENUMPRINTERDRIVERS *r_u)
{
/* UNISTR2 *name = &q_u->name; - notused. */
UNISTR2 *environment = &q_u->environment;
@@ -5297,7 +5296,7 @@ static void fill_form_1(FORM_1 *form, nt_forms_struct *list)
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMFORMS *r_u)
+WERROR _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMFORMS *r_u)
{
/* POLICY_HND *handle = &q_u->handle; - notused. */
uint32 level = q_u->level;
@@ -5385,7 +5384,7 @@ NTSTATUS _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENU
return WERR_INSUFFICIENT_BUFFER;
}
else
- return NT_STATUS_OK;
+ return WERR_OK;
default:
safe_free(list);
@@ -5398,7 +5397,7 @@ NTSTATUS _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENU
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM *r_u)
+WERROR _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM *r_u)
{
/* POLICY_HND *handle = &q_u->handle; - notused. */
uint32 level = q_u->level;
@@ -5431,7 +5430,7 @@ NTSTATUS _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM
DEBUGADD(5,("Number of forms [%d]\n", numofforms));
if (numofforms == 0)
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
switch (level) {
@@ -5473,7 +5472,7 @@ NTSTATUS _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM
DEBUGADD(6,("adding form %s [%d] to buffer\n", form_name, i));
smb_io_form_1("", buffer, &form_1, 0);
- return NT_STATUS_OK;
+ return WERR_OK;
default:
safe_free(list);
@@ -5503,7 +5502,7 @@ static void fill_port_2(PORT_INFO_2 *port, char *name)
/****************************************************************************
enumports level 1.
****************************************************************************/
-static NTSTATUS enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
PORT_INFO_1 *ports=NULL;
int i=0;
@@ -5525,7 +5524,7 @@ static NTSTATUS enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *ne
if (fd != -1)
close(fd);
/* Is this the best error to return here? */
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
numlines = 0;
@@ -5584,15 +5583,15 @@ static NTSTATUS enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *ne
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
enumports level 2.
****************************************************************************/
-static NTSTATUS enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
PORT_INFO_2 *ports=NULL;
int i=0;
@@ -5623,7 +5622,7 @@ static NTSTATUS enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *ne
if (fd != -1)
close(fd);
/* Is this the best error to return here? */
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
numlines = 0;
@@ -5683,15 +5682,15 @@ static NTSTATUS enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *ne
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
enumports.
****************************************************************************/
-NTSTATUS _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_ENUMPORTS *r_u)
+WERROR _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_ENUMPORTS *r_u)
{
/* UNISTR2 *name = &q_u->name; - notused. */
uint32 level = q_u->level;
@@ -5721,7 +5720,7 @@ NTSTATUS _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_EN
/****************************************************************************
****************************************************************************/
-static NTSTATUS spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_srv_name,
+static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_srv_name,
const SPOOL_PRINTER_INFO_LEVEL *info,
uint32 unk0, uint32 unk1, uint32 unk2, uint32 unk3,
uint32 user_switch, const SPOOL_USER_CTR *user,
@@ -5744,7 +5743,7 @@ static NTSTATUS spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *un
if (*lp_addprinter_cmd() )
if ( !add_printer_hook(printer) ) {
free_a_printer(&printer,2);
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
slprintf(name, sizeof(name)-1, "\\\\%s\\%s", global_myname,
@@ -5752,13 +5751,13 @@ static NTSTATUS spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *un
if ((snum = print_queue_snum(printer->info_2->sharename)) == -1) {
free_a_printer(&printer,2);
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
/* you must be a printer admin to add a new printer */
if (!print_access_check(NULL, snum, PRINTER_ACCESS_ADMINISTER)) {
free_a_printer(&printer,2);
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
/*
@@ -5767,7 +5766,7 @@ static NTSTATUS spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *un
if (!check_printer_ok(printer->info_2, snum)) {
free_a_printer(&printer,2);
- return ERRinvalidparam;
+ return WERR_INVALID_PARAM;
}
/*
@@ -5780,27 +5779,27 @@ static NTSTATUS spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *un
/* write the ASCII on disk */
if (add_a_printer(*printer, 2) != 0) {
free_a_printer(&printer,2);
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
if (!open_printer_hnd(p, handle, name)) {
/* Handle open failed - remove addition. */
del_a_printer(printer->info_2->sharename);
free_a_printer(&printer,2);
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
free_a_printer(&printer,2);
srv_spoolss_sendnotify(p, handle);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_addprinterex( pipes_struct *p, SPOOL_Q_ADDPRINTEREX *q_u, SPOOL_R_ADDPRINTEREX *r_u)
+WERROR _spoolss_addprinterex( pipes_struct *p, SPOOL_Q_ADDPRINTEREX *q_u, SPOOL_R_ADDPRINTEREX *r_u)
{
UNISTR2 *uni_srv_name = &q_u->server_name;
uint32 level = q_u->level;
@@ -5830,13 +5829,12 @@ NTSTATUS _spoolss_addprinterex( pipes_struct *p, SPOOL_Q_ADDPRINTEREX *q_u, SPOO
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_addprinterdriver(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVER *q_u, SPOOL_R_ADDPRINTERDRIVER *r_u)
+WERROR _spoolss_addprinterdriver(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVER *q_u, SPOOL_R_ADDPRINTERDRIVER *r_u)
{
/* UNISTR2 *server_name = &q_u->server_name; - notused. */
uint32 level = q_u->level;
SPOOL_PRINTER_DRIVER_INFO_LEVEL *info = &q_u->info;
-
- uint32 err = NT_STATUS_OK;
+ WERROR err = WERR_OK;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
struct current_user user;
@@ -5856,12 +5854,12 @@ NTSTATUS _spoolss_addprinterdriver(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVER *q_
DEBUG(5,("Moving driver to final destination\n"));
if(!move_driver_to_download_area(driver, level, &user, &err)) {
if (err == 0)
- err = NT_STATUS_ACCESS_DENIED;
+ err = WERR_ACCESS_DENIED;
goto done;
}
if (add_a_printer_driver(driver, level)!=0) {
- err = NT_STATUS_ACCESS_DENIED;
+ err = WERR_ACCESS_DENIED;
goto done;
}
@@ -5879,7 +5877,7 @@ static void fill_driverdir_1(DRIVER_DIRECTORY_1 *info, char *name)
/****************************************************************************
****************************************************************************/
-static NTSTATUS getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environment, NEW_BUFFER *buffer, uint32 offered, uint32 *needed)
+static WERROR getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environment, NEW_BUFFER *buffer, uint32 offered, uint32 *needed)
{
pstring path;
pstring long_archi;
@@ -5913,14 +5911,14 @@ static NTSTATUS getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environm
if (*needed > offered)
return WERR_INSUFFICIENT_BUFFER;
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_getprinterdriverdirectory(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, SPOOL_R_GETPRINTERDRIVERDIR *r_u)
+WERROR _spoolss_getprinterdriverdirectory(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, SPOOL_R_GETPRINTERDRIVERDIR *r_u)
{
UNISTR2 *name = &q_u->name;
UNISTR2 *uni_environment = &q_u->environment;
@@ -5948,7 +5946,7 @@ NTSTATUS _spoolss_getprinterdriverdirectory(pipes_struct *p, SPOOL_Q_GETPRINTERD
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, SPOOL_R_ENUMPRINTERDATA *r_u)
+WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, SPOOL_R_ENUMPRINTERDATA *r_u)
{
POLICY_HND *handle = &q_u->handle;
uint32 idx = q_u->index;
@@ -5991,14 +5989,14 @@ NTSTATUS _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u,
if (!Printer) {
DEBUG(0,("_spoolss_enumprinterdata: Invalid handle (%s).\n", OUR_HANDLE(handle)));
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
if (!get_printer_snum(p,handle, &snum))
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
if (get_a_printer(&printer, 2, lp_servicename(snum)) != 0)
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
/*
* The NT machine wants to know the biggest size of value and data
@@ -6021,7 +6019,7 @@ NTSTATUS _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u,
if (!get_specific_param_by_index(*printer, 2, idx, value, &data, &type, &data_len)) {
safe_free(data);
free_a_printer(&printer, 2);
- return ERRnomoreitems;
+ return WERR_NO_MORE_ITEMS;
}
#endif
@@ -6052,7 +6050,7 @@ NTSTATUS _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u,
if (param_index == 0) {
/* No parameters found. */
free_a_printer(&printer, 2);
- return ERRnomoreitems;
+ return WERR_NO_MORE_ITEMS;
}
/* the value is an UNICODE string but realvaluesize is the length in bytes including the leading 0 */
@@ -6062,7 +6060,7 @@ NTSTATUS _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u,
DEBUG(6,("final values: [%d], [%d]\n", *out_value_len, *out_data_len));
free_a_printer(&printer, 2);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/*
@@ -6073,7 +6071,7 @@ NTSTATUS _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u,
if (!get_specific_param_by_index(*printer, 2, idx, value, &data, &type, &data_len)) {
safe_free(data);
free_a_printer(&printer, 2);
- return ERRnomoreitems;
+ return WERR_NO_MORE_ITEMS;
}
free_a_printer(&printer, 2);
@@ -6109,13 +6107,13 @@ NTSTATUS _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u,
safe_free(data);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SPOOL_R_SETPRINTERDATA *r_u)
+WERROR _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SPOOL_R_SETPRINTERDATA *r_u)
{
POLICY_HND *handle = &q_u->handle;
UNISTR2 *value = &q_u->value;
@@ -6128,18 +6126,18 @@ NTSTATUS _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u,
NT_PRINTER_INFO_LEVEL *printer = NULL;
NT_PRINTER_PARAM *param = NULL, old_param;
int snum=0;
- NTSTATUS status = 0x0;
+ WERROR status = WERR_OK;
Printer_entry *Printer=find_printer_index_by_hnd(p, handle);
DEBUG(5,("spoolss_setprinterdata\n"));
if (!Printer) {
DEBUG(0,("_spoolss_setprinterdata: Invalid handle (%s).\n", OUR_HANDLE(handle)));
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
if (!get_printer_snum(p,handle, &snum))
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
status = get_a_printer(&printer, 2, lp_servicename(snum));
if (status != 0x0)
@@ -6150,7 +6148,7 @@ NTSTATUS _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u,
/* Check if we are making any changes or not. Return true if
nothing is actually changing. */
- ZERO_STRUCT(old_param);
+ ZERO_STRUCT(old_param);
if (get_specific_param(*printer, 2, param->value, &old_param.data,
&old_param.type, (uint32 *)&old_param.data_len)) {
@@ -6161,7 +6159,7 @@ NTSTATUS _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u,
old_param.data_len) == 0) {
DEBUG(3, ("setprinterdata hasn't changed\n"));
- status = NT_STATUS_OK;
+ status = WERR_OK;
goto done;
}
}
@@ -6171,7 +6169,7 @@ NTSTATUS _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u,
if (!print_access_check(NULL, snum, PRINTER_ACCESS_ADMINISTER)) {
DEBUG(3, ("security descriptor change denied by existing "
"security descriptor\n"));
- status = NT_STATUS_ACCESS_DENIED;
+ status = WERR_ACCESS_DENIED;
goto done;
}
@@ -6205,7 +6203,7 @@ NTSTATUS _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u,
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *q_u, SPOOL_R_DELETEPRINTERDATA *r_u)
+WERROR _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *q_u, SPOOL_R_DELETEPRINTERDATA *r_u)
{
POLICY_HND *handle = &q_u->handle;
UNISTR2 *value = &q_u->valuename;
@@ -6213,23 +6211,23 @@ NTSTATUS _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *
NT_PRINTER_INFO_LEVEL *printer = NULL;
NT_PRINTER_PARAM param;
int snum=0;
- NTSTATUS status = 0x0;
+ WERROR status = WERR_OK;
Printer_entry *Printer=find_printer_index_by_hnd(p, handle);
DEBUG(5,("spoolss_deleteprinterdata\n"));
if (!Printer) {
DEBUG(0,("_spoolss_deleteprinterdata: Invalid handle (%s).\n", OUR_HANDLE(handle)));
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
if (!get_printer_snum(p, handle, &snum))
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
if (!print_access_check(NULL, snum, PRINTER_ACCESS_ADMINISTER)) {
DEBUG(3, ("_spoolss_deleteprinterdata: printer properties "
"change denied by existing security descriptor\n"));
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
status = get_a_printer(&printer, 2, lp_servicename(snum));
@@ -6240,7 +6238,7 @@ NTSTATUS _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *
unistr2_to_ascii(param.value, value, sizeof(param.value)-1);
if(!unlink_specific_param_if_exist(printer->info_2, &param))
- status = ERRinvalidparam;
+ status = WERR_INVALID_PARAM;
else
status = mod_a_printer(*printer, 2);
@@ -6251,7 +6249,7 @@ NTSTATUS _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_addform( pipes_struct *p, SPOOL_Q_ADDFORM *q_u, SPOOL_R_ADDFORM *r_u)
+WERROR _spoolss_addform( pipes_struct *p, SPOOL_Q_ADDFORM *q_u, SPOOL_R_ADDFORM *r_u)
{
POLICY_HND *handle = &q_u->handle;
/* uint32 level = q_u->level; - notused. */
@@ -6266,12 +6264,12 @@ NTSTATUS _spoolss_addform( pipes_struct *p, SPOOL_Q_ADDFORM *q_u, SPOOL_R_ADDFOR
if (!Printer) {
DEBUG(0,("_spoolss_addform: Invalid handle (%s).\n", OUR_HANDLE(handle)));
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
/* can't add if builtin */
if (get_a_builtin_ntform(&form->name,&tmpForm)) {
- return ERRinvalidparam;
+ return WERR_INVALID_PARAM;
}
count=get_ntforms(&list);
@@ -6281,19 +6279,19 @@ NTSTATUS _spoolss_addform( pipes_struct *p, SPOOL_Q_ADDFORM *q_u, SPOOL_R_ADDFOR
safe_free(list);
- return 0x0;
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_deleteform( pipes_struct *p, SPOOL_Q_DELETEFORM *q_u, SPOOL_R_DELETEFORM *r_u)
+WERROR _spoolss_deleteform( pipes_struct *p, SPOOL_Q_DELETEFORM *q_u, SPOOL_R_DELETEFORM *r_u)
{
POLICY_HND *handle = &q_u->handle;
UNISTR2 *form_name = &q_u->name;
nt_forms_struct tmpForm;
int count=0;
- uint32 ret = 0;
+ WERROR ret = 0;
nt_forms_struct *list=NULL;
Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
@@ -6301,17 +6299,17 @@ NTSTATUS _spoolss_deleteform( pipes_struct *p, SPOOL_Q_DELETEFORM *q_u, SPOOL_R_
if (!Printer) {
DEBUG(0,("_spoolss_deleteform: Invalid handle (%s).\n", OUR_HANDLE(handle)));
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
/* can't delete if builtin */
if (get_a_builtin_ntform(form_name,&tmpForm)) {
- return ERRinvalidparam;
+ return WERR_INVALID_PARAM;
}
count = get_ntforms(&list);
if(!delete_a_form(&list, form_name, &count, &ret))
- return ERRinvalidparam;
+ return WERR_INVALID_PARAM;
safe_free(list);
@@ -6321,7 +6319,7 @@ NTSTATUS _spoolss_deleteform( pipes_struct *p, SPOOL_Q_DELETEFORM *q_u, SPOOL_R_
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM *r_u)
+WERROR _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM *r_u)
{
POLICY_HND *handle = &q_u->handle;
/* UNISTR2 *uni_name = &q_u->name; - notused. */
@@ -6337,11 +6335,11 @@ NTSTATUS _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM
if (!Printer) {
DEBUG(0,("_spoolss_setform: Invalid handle (%s).\n", OUR_HANDLE(handle)));
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
}
/* can't set if builtin */
if (get_a_builtin_ntform(&form->name,&tmpForm)) {
- return ERRinvalidparam;
+ return WERR_INVALID_PARAM;
}
count=get_ntforms(&list);
@@ -6350,13 +6348,13 @@ NTSTATUS _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM
safe_free(list);
- return 0x0;
+ return WERR_OK;
}
/****************************************************************************
enumprintprocessors level 1.
****************************************************************************/
-static NTSTATUS enumprintprocessors_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprintprocessors_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
PRINTPROCESSOR_1 *info_1=NULL;
@@ -6380,21 +6378,21 @@ static NTSTATUS enumprintprocessors_level_1(NEW_BUFFER *buffer, uint32 offered,
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_enumprintprocessors(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, SPOOL_R_ENUMPRINTPROCESSORS *r_u)
+WERROR _spoolss_enumprintprocessors(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, SPOOL_R_ENUMPRINTPROCESSORS *r_u)
{
/* UNISTR2 *name = &q_u->name; - notused. */
/* UNISTR2 *environment = &q_u->environment; - notused. */
uint32 level = q_u->level;
- NEW_BUFFER *buffer = NULL;
+ NEW_BUFFER *buffer = NULL;
uint32 offered = q_u->offered;
- uint32 *needed = &r_u->needed;
+ uint32 *needed = &r_u->needed;
uint32 *returned = &r_u->returned;
/* that's an [in out] buffer */
@@ -6424,7 +6422,7 @@ NTSTATUS _spoolss_enumprintprocessors(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCESSO
/****************************************************************************
enumprintprocdatatypes level 1.
****************************************************************************/
-static NTSTATUS enumprintprocdatatypes_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprintprocdatatypes_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
PRINTPROCDATATYPE_1 *info_1=NULL;
@@ -6448,14 +6446,14 @@ static NTSTATUS enumprintprocdatatypes_level_1(NEW_BUFFER *buffer, uint32 offere
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_enumprintprocdatatypes(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u)
+WERROR _spoolss_enumprintprocdatatypes(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u)
{
/* UNISTR2 *name = &q_u->name; - notused. */
/* UNISTR2 *processor = &q_u->processor; - notused. */
@@ -6486,7 +6484,7 @@ NTSTATUS _spoolss_enumprintprocdatatypes(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCD
enumprintmonitors level 1.
****************************************************************************/
-static NTSTATUS enumprintmonitors_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprintmonitors_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
PRINTMONITOR_1 *info_1=NULL;
@@ -6510,14 +6508,14 @@ static NTSTATUS enumprintmonitors_level_1(NEW_BUFFER *buffer, uint32 offered, ui
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
enumprintmonitors level 2.
****************************************************************************/
-static NTSTATUS enumprintmonitors_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprintmonitors_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
PRINTMONITOR_2 *info_2=NULL;
@@ -6543,20 +6541,20 @@ static NTSTATUS enumprintmonitors_level_2(NEW_BUFFER *buffer, uint32 offered, ui
*returned=0;
return WERR_INSUFFICIENT_BUFFER;
}
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_enumprintmonitors(pipes_struct *p, SPOOL_Q_ENUMPRINTMONITORS *q_u, SPOOL_R_ENUMPRINTMONITORS *r_u)
+WERROR _spoolss_enumprintmonitors(pipes_struct *p, SPOOL_Q_ENUMPRINTMONITORS *q_u, SPOOL_R_ENUMPRINTMONITORS *r_u)
{
/* UNISTR2 *name = &q_u->name; - notused. */
uint32 level = q_u->level;
- NEW_BUFFER *buffer = NULL;
+ NEW_BUFFER *buffer = NULL;
uint32 offered = q_u->offered;
- uint32 *needed = &r_u->needed;
+ uint32 *needed = &r_u->needed;
uint32 *returned = &r_u->returned;
/* that's an [in out] buffer */
@@ -6587,7 +6585,7 @@ NTSTATUS _spoolss_enumprintmonitors(pipes_struct *p, SPOOL_Q_ENUMPRINTMONITORS *
/****************************************************************************
****************************************************************************/
-static NTSTATUS getjob_level_1(print_queue_struct *queue, int count, int snum, uint32 jobid, NEW_BUFFER *buffer, uint32 offered, uint32 *needed)
+static WERROR getjob_level_1(print_queue_struct *queue, int count, int snum, uint32 jobid, NEW_BUFFER *buffer, uint32 offered, uint32 *needed)
{
int i=0;
BOOL found=False;
@@ -6609,7 +6607,7 @@ static NTSTATUS getjob_level_1(print_queue_struct *queue, int count, int snum, u
safe_free(queue);
safe_free(info_1);
/* I shoud reply something else ... I can't find the good one */
- return NT_STATUS_OK;
+ return WERR_OK;
}
fill_job_info_1(info_1, &(queue[i-1]), i, snum);
@@ -6629,14 +6627,14 @@ static NTSTATUS getjob_level_1(print_queue_struct *queue, int count, int snum, u
if (*needed > offered)
return WERR_INSUFFICIENT_BUFFER;
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-static NTSTATUS getjob_level_2(print_queue_struct *queue, int count, int snum, uint32 jobid, NEW_BUFFER *buffer, uint32 offered, uint32 *needed)
+static WERROR getjob_level_2(print_queue_struct *queue, int count, int snum, uint32 jobid, NEW_BUFFER *buffer, uint32 offered, uint32 *needed)
{
int i=0;
BOOL found=False;
@@ -6661,7 +6659,7 @@ static NTSTATUS getjob_level_2(print_queue_struct *queue, int count, int snum, u
safe_free(queue);
safe_free(info_2);
/* I shoud reply something else ... I can't find the good one */
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (get_a_printer(&ntprinter, 2, lp_servicename(snum)) !=0) {
@@ -6688,14 +6686,14 @@ static NTSTATUS getjob_level_2(print_queue_struct *queue, int count, int snum, u
if (*needed > offered)
return WERR_INSUFFICIENT_BUFFER;
- else
- return NT_STATUS_OK;
+
+ return WERR_OK;
}
/****************************************************************************
****************************************************************************/
-NTSTATUS _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_u)
+WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_u)
{
POLICY_HND *handle = &q_u->handle;
uint32 jobid = q_u->jobid;
@@ -6720,7 +6718,7 @@ NTSTATUS _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *
*needed=0;
if (!get_printer_snum(p, handle, &snum))
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID;
count = print_queue_status(snum, &queue, &prt_status);