s4-smbtorture: avoid potential loop while adding a new printer in RPC-SPOOLSS-PRINTER.
authorGünther Deschner <gd@samba.org>
Wed, 17 Feb 2010 19:45:26 +0000 (20:45 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 18 Feb 2010 00:48:36 +0000 (01:48 +0100)
Guenther

source4/torture/rpc/spoolss.c

index 0c9c076fda35f0884fb49249bd29533f00bdba08..82469e9ef39cd513d2799a6e08464fbbe922976d 100644 (file)
@@ -4030,6 +4030,7 @@ static bool test_AddPrinter_normal(struct torture_context *tctx,
        struct spoolss_UserLevelCtr userlevel_ctr;
        struct policy_handle handle;
        bool found = false;
+       bool existing_printer_deleted = false;
 
        ZERO_STRUCT(devmode_ctr);
        ZERO_STRUCT(secdesc_ctr);
@@ -4078,6 +4079,10 @@ static bool test_AddPrinter_normal(struct torture_context *tctx,
        if (W_ERROR_EQUAL(result, WERR_PRINTER_ALREADY_EXISTS)) {
                struct policy_handle printer_handle;
 
+               if (existing_printer_deleted) {
+                       torture_fail(tctx, "already deleted printer still existing?");
+               }
+
                torture_assert(tctx, call_OpenPrinterEx(tctx, p, printername, NULL, &printer_handle),
                        "failed to open printer handle");
 
@@ -4087,6 +4092,8 @@ static bool test_AddPrinter_normal(struct torture_context *tctx,
                torture_assert(tctx, test_ClosePrinter(tctx, p, &printer_handle),
                        "failed to close server handle");
 
+               existing_printer_deleted = true;
+
                goto again;
        }