diff options
-rw-r--r-- | source4/torture/rap/rap.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c index e553f9687d..e1191bb731 100644 --- a/source4/torture/rap/rap.c +++ b/source4/torture/rap/rap.c @@ -681,6 +681,91 @@ NTSTATUS smbcli_rap_netprintqenum(struct smbcli_tree *tree, return result; } +NTSTATUS smbcli_rap_netprintqgetinfo(struct smbcli_tree *tree, + struct smb_iconv_convenience *iconv_convenience, + TALLOC_CTX *mem_ctx, + struct rap_NetPrintQGetInfo *r) +{ + struct rap_call *call; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + + if (!(call = new_rap_cli_call(mem_ctx, iconv_convenience, RAP_WPrintQGetInfo))) { + return NT_STATUS_NO_MEMORY; + } + + rap_cli_push_string(call, r->in.PrintQueueName); + rap_cli_push_word(call, r->in.level); + rap_cli_push_rcvbuf(call, r->in.bufsize); + rap_cli_expect_word(call); + + switch(r->in.level) { + case 0: + rap_cli_expect_format(call, "B13"); + break; + case 1: + rap_cli_expect_format(call, "B13BWWWzzzzzWW"); + break; + case 2: + rap_cli_expect_format(call, "B13BWWWzzzzzWN"); + break; + case 3: + rap_cli_expect_format(call, "zWWWWzzzzWWzzl"); + break; + case 4: + rap_cli_expect_format(call, "zWWWWzzzzWNzzl"); + break; + case 5: + rap_cli_expect_format(call, "z"); + break; + default: + result = NT_STATUS_INVALID_PARAMETER; + goto done; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(rap_NetPrintQGetInfo, r); + } + + result = rap_cli_do_call(tree, iconv_convenience, call); + + if (!NT_STATUS_IS_OK(result)) + goto done; + + result = NT_STATUS_INVALID_PARAMETER; + + NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status)); + NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert)); + NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available)); + + switch(r->in.level) { + case 0: + result = rap_pull_rap_PrintQueue0(mem_ctx, call->ndr_pull_data, r->out.convert, &r->out.info.info0); + break; + case 1: + result = rap_pull_rap_PrintQueue1(mem_ctx, call->ndr_pull_data, r->out.convert, &r->out.info.info1); + break; + case 3: + result = rap_pull_rap_PrintQueue3(mem_ctx, call->ndr_pull_data, r->out.convert, &r->out.info.info3); + break; + case 5: + result = rap_pull_rap_PrintQueue5(mem_ctx, call->ndr_pull_data, r->out.convert, &r->out.info.info5); + break; + } + + if (!NT_STATUS_IS_OK(result)) { + goto done; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(rap_NetPrintQGetInfo, r); + } + + done: + talloc_free(call); + return result; +} + + static bool test_netservergetinfo(struct torture_context *tctx, struct smbcli_state *cli) { |