svn commit: samba r19027 - in branches/SAMBA_4_0/source/torture/rpc: .

vlendec at samba.org vlendec at samba.org
Mon Oct 2 08:35:23 GMT 2006


Author: vlendec
Date: 2006-10-02 08:35:19 +0000 (Mon, 02 Oct 2006)
New Revision: 19027

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19027

Log:
Modify RPC-SAMBA3-SPOOLSS so that it can be activated in the build farm
Modified:
   branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c	2006-10-02 06:32:58 UTC (rev 19026)
+++ branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c	2006-10-02 08:35:19 UTC (rev 19027)
@@ -2229,6 +2229,53 @@
 	return NT_STATUS_OK;
 }
 
+static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe,
+			 int level)
+{
+	struct spoolss_EnumPrinters r;
+	NTSTATUS status;
+	DATA_BLOB blob;
+
+	r.in.flags = PRINTER_ENUM_LOCAL;
+	r.in.server = "\\\\localhost";
+	r.in.level = 1;
+	r.in.buffer = NULL;
+	r.in.offered = 0;
+
+	status = dcerpc_spoolss_EnumPrinters(pipe, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("(%s) dcerpc_spoolss_EnumPrinters failed: %s\n",
+			 __location__, nt_errstr(status));
+		return False;
+	}
+
+	if (!W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
+		d_printf("(%s) EnumPrinters unexpected return code %s, should "
+			 "be WERR_INSUFFICIENT_BUFFER\n", __location__,
+			 win_errstr(r.out.result));
+		return False;
+	}
+
+	blob = data_blob_talloc(mem_ctx, NULL, r.out.needed);
+	if (blob.data == NULL) {
+		d_printf("(%s) data_blob_talloc failed\n", __location__);
+		return False;
+	}
+
+	r.in.buffer = &blob;
+	r.in.offered = r.out.needed;
+
+	status = dcerpc_spoolss_EnumPrinters(pipe, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
+		d_printf("(%s) dcerpc_spoolss_EnumPrinters failed: %s, "
+			 "%s\n", __location__, nt_errstr(status),
+			 win_errstr(r.out.result));
+		return False;
+	}
+
+	return True;
+}
+
 static NTSTATUS getprinterinfo(TALLOC_CTX *ctx, struct dcerpc_pipe *pipe,
 			       struct policy_handle *handle, int level,
 			       union spoolss_PrinterInfo **res)
@@ -2352,9 +2399,7 @@
 		struct spoolss_OpenPrinterEx r;
 
 		ZERO_STRUCT(r);
-		r.in.printername = talloc_asprintf(
-			mem_ctx, "\\\\%s",
-			lp_parm_string(-1, "torture", "host"));
+		r.in.printername = "\\\\localhost";
 		r.in.datatype = NULL;
 		r.in.access_mask = 0;
 		r.in.level = 1;
@@ -2368,6 +2413,13 @@
 			talloc_free(mem_ctx);
 			return False;
 		}
+		if (!W_ERROR_IS_OK(r.out.result)) {
+			d_printf("(%s) dcerpc_spoolss_OpenPrinterEx failed: "
+				 "%s\n", __location__,
+				 win_errstr(r.out.result));
+			talloc_free(mem_ctx);
+			return False;
+		}
 	}
 
 	{
@@ -2383,6 +2435,13 @@
 			talloc_free(mem_ctx);
 			return False;
 		}
+		if (!W_ERROR_IS_OK(r.out.result)) {
+			d_printf("(%s) dcerpc_spoolss_ClosePrinter failed: "
+				 "%s\n", __location__,
+				 win_errstr(r.out.result));
+			talloc_free(mem_ctx);
+			return False;
+		}
 	}
 
 	{
@@ -2390,8 +2449,7 @@
 
 		ZERO_STRUCT(r);
 		r.in.printername = talloc_asprintf(
-			mem_ctx, "\\\\%s\\%s", dcerpc_server_name(p),
-			printers[0]);
+			mem_ctx, "\\\\localhost\\%s", printers[0]);
 		r.in.datatype = NULL;
 		r.in.access_mask = 0;
 		r.in.level = 1;
@@ -2405,6 +2463,13 @@
 			talloc_free(mem_ctx);
 			return False;
 		}
+		if (!W_ERROR_IS_OK(r.out.result)) {
+			d_printf("(%s) dcerpc_spoolss_OpenPrinterEx failed: "
+				 "%s\n", __location__,
+				 win_errstr(r.out.result));
+			talloc_free(mem_ctx);
+			return False;
+		}
 	}
 
 	{
@@ -2441,6 +2506,12 @@
 		}
 	}
 
+	if (!enumprinters(mem_ctx, p, 1)) {
+		d_printf("(%s) enumprinters failed\n", __location__);
+		talloc_free(mem_ctx);
+		return False;
+	}
+
 	talloc_free(mem_ctx);
 
 	return ret;



More information about the samba-cvs mailing list