s4-smbtorture: move test_ReplyOpenPrinter from RPC-SPOOLSS to RPC-SPOOLSS-NOTIFY.
[ab/samba.git/.git] / source4 / torture / rpc / spoolss.c
index ad8158d9562c6d11676e1a42abe8a9c2403c7c41..6c78cf3cc2e0b063ec774cad0d2ea6015b2dd889 100644 (file)
@@ -575,7 +575,7 @@ static bool test_EnumPrintProcDataTypes(struct torture_context *tctx,
        NTSTATUS status;
        struct spoolss_EnumPrintProcDataTypes r;
        uint16_t levels[] = { 1 };
-       int i, j;
+       int i;
 
        for (i=0;i<ARRAY_SIZE(levels);i++) {
                int level = levels[i];
@@ -1337,13 +1337,15 @@ static bool test_GetPrinterData(struct torture_context *tctx,
        NTSTATUS status;
        struct spoolss_GetPrinterData r;
        uint32_t needed;
-       enum spoolss_PrinterDataType type;
+       enum winreg_Type type;
+       union spoolss_PrinterData data;
 
        r.in.handle = handle;
        r.in.value_name = value_name;
        r.in.offered = 0;
        r.out.needed = &needed;
        r.out.type = &type;
+       r.out.data = &data;
 
        torture_comment(tctx, "Testing GetPrinterData\n");
 
@@ -1370,7 +1372,7 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx,
 {
        NTSTATUS status;
        struct spoolss_GetPrinterDataEx r;
-       uint32_t type;
+       enum winreg_Type type;
        uint32_t needed;
 
        r.in.handle = handle;
@@ -1417,16 +1419,15 @@ static bool test_EnumPrinterData(struct torture_context *tctx, struct dcerpc_pip
        do {
                uint32_t value_size = 0;
                uint32_t data_size = 0;
-               uint32_t printerdata_type = 0;
-               DATA_BLOB data = data_blob(NULL,0);
+               enum winreg_Type type = 0;
 
                r.in.value_offered = value_size;
                r.out.value_needed = &value_size;
                r.in.data_offered = data_size;
                r.out.data_needed = &data_size;
 
-               r.out.printerdata_type = &printerdata_type;
-               r.out.buffer = &data;
+               r.out.type = &type;
+               r.out.data = talloc_zero_array(tctx, uint8_t, 0);
 
                torture_comment(tctx, "Testing EnumPrinterData\n");
 
@@ -1435,7 +1436,9 @@ static bool test_EnumPrinterData(struct torture_context *tctx, struct dcerpc_pip
                torture_assert_ntstatus_ok(tctx, status, "EnumPrinterData failed");
 
                r.in.value_offered = value_size;
+               r.out.value_name = talloc_zero_array(tctx, const char, value_size);
                r.in.data_offered = data_size;
+               r.out.data = talloc_zero_array(tctx, uint8_t, data_size);
 
                status = dcerpc_spoolss_EnumPrinterData(p, tctx, &r);
 
@@ -1460,6 +1463,7 @@ static bool test_EnumPrinterDataEx(struct torture_context *tctx,
 {
        NTSTATUS status;
        struct spoolss_EnumPrinterDataEx r;
+       struct spoolss_PrinterEnumValues *info;
        uint32_t needed;
        uint32_t count;
 
@@ -1468,6 +1472,7 @@ static bool test_EnumPrinterDataEx(struct torture_context *tctx,
        r.in.offered = 0;
        r.out.needed = &needed;
        r.out.count = &count;
+       r.out.info = &info;
 
        torture_comment(tctx, "Testing EnumPrinterDataEx\n");
 
@@ -1475,7 +1480,6 @@ static bool test_EnumPrinterDataEx(struct torture_context *tctx,
        torture_assert_ntstatus_ok(tctx, status, "EnumPrinterDataEx failed");
 
        r.in.offered = needed;
-       r.out.buffer = talloc_array(tctx, uint8_t, needed);
 
        status = dcerpc_spoolss_EnumPrinterDataEx(p, tctx, &r);
 
@@ -1515,7 +1519,7 @@ static bool test_SetPrinterData(struct torture_context *tctx,
        
        r.in.handle = handle;
        r.in.value_name = value_name;
-       r.in.type = SPOOLSS_PRINTER_DATA_TYPE_STRING;
+       r.in.type = REG_SZ;
        r.in.data.string = "dog";
 
        torture_comment(tctx, "Testing SetPrinterData\n");
@@ -1812,10 +1816,17 @@ static bool test_EnumPrinters_old(struct torture_context *tctx, struct dcerpc_pi
 
                for (j=0;j<count;j++) {
                        if (r.in.level == 1) {
-                               /* the names appear to be comma-separated name lists? */
-                               char *name = talloc_strdup(tctx, info[j].info1.name);
-                               char *comma = strchr(name, ',');
-                               if (comma) *comma = 0;
+                               char *unc = talloc_strdup(tctx, info[j].info1.name);
+                               char *slash, *name;
+                               name = unc;
+                               if (unc[0] == '\\' && unc[1] == '\\') {
+                                       unc +=2;
+                               }
+                               slash = strchr(unc, '\\');
+                               if (slash) {
+                                       slash++;
+                                       name = slash;
+                               }
                                if (!test_OpenPrinter(tctx, p, name)) {
                                        ret = false;
                                }
@@ -1930,41 +1941,6 @@ static bool test_EnumPrinterDrivers_old(struct torture_context *tctx,
        return true;
 }
 
-/** Test that makes sure that calling ReplyOpenPrinter()
- * on Samba 4 will cause an irpc broadcast call.
- */
-static bool test_ReplyOpenPrinter(struct torture_context *tctx, 
-                                 struct dcerpc_pipe *pipe)
-{
-       struct spoolss_ReplyOpenPrinter r;
-       struct spoolss_ReplyClosePrinter s;
-       struct policy_handle h;
-
-       r.in.server_name = "earth";
-       r.in.printer_local = 2;
-       r.in.type = REG_DWORD;
-       r.in.bufsize = 0;
-       r.in.buffer = NULL;
-       r.out.handle = &h;
-
-       torture_assert_ntstatus_ok(tctx, 
-                       dcerpc_spoolss_ReplyOpenPrinter(pipe, tctx, &r),
-                       "spoolss_ReplyOpenPrinter call failed");
-
-       torture_assert_werr_ok(tctx, r.out.result, "error return code");
-
-       s.in.handle = &h;
-       s.out.handle = &h;
-
-       torture_assert_ntstatus_ok(tctx,
-                       dcerpc_spoolss_ReplyClosePrinter(pipe, tctx, &s),
-                       "spoolss_ReplyClosePrinter call failed");
-
-       torture_assert_werr_ok(tctx, r.out.result, "error return code");
-
-       return true;
-}
-
 bool torture_rpc_spoolss(struct torture_context *torture)
 {
        NTSTATUS status;
@@ -2018,7 +1994,6 @@ bool torture_rpc_spoolss(struct torture_context *torture)
        ret &= test_EnumPorts_old(torture, p);
        ret &= test_EnumPrinters_old(torture, p);
        ret &= test_EnumPrinterDrivers_old(torture, p);
-       ret &= test_ReplyOpenPrinter(torture, p);
 
        return ret;
 }