summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-01-19 00:27:50 +0100
committerGünther Deschner <gd@samba.org>2010-01-19 14:14:30 +0100
commitf5bba4034b362d354409932f0b0cef0e4d44a08d (patch)
tree9a3802f3e04f3575e9258e083f349f1bd0e06a07 /source4/torture
parent2b68215a226aab978e5f01470e8b4afbb291134b (diff)
downloadsamba-f5bba4034b362d354409932f0b0cef0e4d44a08d.tar.gz
samba-f5bba4034b362d354409932f0b0cef0e4d44a08d.tar.bz2
samba-f5bba4034b362d354409932f0b0cef0e4d44a08d.zip
s4-smbtorture: support spoolss_ReplyClosePrinter server call in RPC-SPOOLSS-NOTIFY.
A handle obtained with spoolss_ReplyOpenPrinter will be closed with spoolss_ReplyClosePrinter when we call spoolss_ClosePrinter on the remote side. Guenther
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/spoolss_notify.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index 3d37781cb5..c6ff706374 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -95,6 +95,22 @@ static WERROR _spoolss_ReplyOpenPrinter(struct dcesrv_call_state *dce_call,
return WERR_OK;
}
+static WERROR _spoolss_ReplyClosePrinter(struct dcesrv_call_state *dce_call,
+ TALLOC_CTX *mem_ctx,
+ struct spoolss_ReplyClosePrinter *r)
+{
+ DEBUG(1,("_spoolss_ReplyClosePrinter\n"));
+
+ NDR_PRINT_IN_DEBUG(spoolss_ReplyClosePrinter, r);
+
+ ZERO_STRUCTP(r->out.handle);
+ r->out.result = WERR_OK;
+
+ NDR_PRINT_OUT_DEBUG(spoolss_ReplyClosePrinter, r);
+
+ return WERR_OK;
+}
+
static NTSTATUS spoolss__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
{
uint16_t opnum = dce_call->pkt.u.request.opnum;
@@ -112,6 +128,11 @@ static NTSTATUS spoolss__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_
r2->out.result = _spoolss_ReplyOpenPrinter(dce_call, mem_ctx, r2);
break;
}
+ case 60: {
+ struct spoolss_ReplyClosePrinter *r2 = (struct spoolss_ReplyClosePrinter *)r;
+ r2->out.result = _spoolss_ReplyClosePrinter(dce_call, mem_ctx, r2);
+ break;
+ }
default:
dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
@@ -210,6 +231,7 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
struct dcesrv_endpoint *e;
struct spoolss_NotifyOption t1;
struct spoolss_ClosePrinter cp;
+ struct received_packet *rp;
struct policy_handle handle;
const char *address;
@@ -313,9 +335,21 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
status = dcerpc_spoolss_ClosePrinter(p, tctx, &cp);
torture_assert_ntstatus_ok(tctx, status, "ClosePrinter failed");
- /* We should've had an incoming packet 58 (ReplyOpenPrinter) */
+ /* We should've had an incoming packet 58 (ReplyOpenPrinter) or 60
+ * (ReplyClosePrinter) */
+
torture_assert(tctx, received_packets != NULL, "no packets received");
- torture_assert_int_equal(tctx, received_packets->opnum, 58, "invalid opnum");
+
+ for (rp = received_packets; rp; rp = rp->next) {
+ switch (rp->opnum) {
+ case 58:
+ case 60:
+ continue;
+ default:
+ torture_fail(tctx,
+ talloc_asprintf(tctx, "unexpected packet opnum %d received", rp->opnum));
+ }
+ }
/* Shut down DCE/RPC server */
talloc_free(dce_ctx);