1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

s4-smbtorture: add smbcli_rap_netprintqenum.

Guenther
This commit is contained in:
Günther Deschner 2010-04-28 12:50:58 +02:00
parent 42003e5661
commit 1764bcecf2

View File

@ -23,7 +23,7 @@
#include "libcli/libcli.h"
#include "torture/smbtorture.h"
#include "torture/util.h"
#include "../librpc/gen_ndr/rap.h"
#include "../librpc/gen_ndr/ndr_rap.h"
#include "librpc/ndr/libndr.h"
#include "param/param.h"
#include "torture/rap/proto.h"
@ -502,6 +502,114 @@ NTSTATUS smbcli_rap_netservergetinfo(struct smbcli_tree *tree,
return result;
}
NTSTATUS smbcli_rap_netprintqenum(struct smbcli_tree *tree,
struct smb_iconv_convenience *iconv_convenience,
TALLOC_CTX *mem_ctx,
struct rap_NetPrintQEnum *r)
{
struct rap_call *call;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
int i;
if (!(call = new_rap_cli_call(mem_ctx, iconv_convenience, RAP_WPrintQEnum))) {
return NT_STATUS_NO_MEMORY;
}
rap_cli_push_word(call, r->in.level);
rap_cli_push_rcvbuf(call, r->in.bufsize);
rap_cli_expect_multiple_entries(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;
}
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.count));
NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
r->out.info = talloc_array(mem_ctx, union rap_printq_info, r->out.count);
if (r->out.info == NULL) {
result = NT_STATUS_NO_MEMORY;
goto done;
}
for (i=0; i<r->out.count; i++) {
switch(r->in.level) {
case 0:
NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
r->out.info[i].info0.PrintQName, 13));
break;
case 1:
NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
r->out.info[i].info1.PrintQName, 13));
NDR_GOTO(ndr_pull_uint8(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.Pad1));
NDR_GOTO(ndr_pull_uint16(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.Priority));
NDR_GOTO(ndr_pull_uint16(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.StartTime));
NDR_GOTO(ndr_pull_uint16(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.UntilTime));
RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.SeparatorPageFilename));
RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.PrintProcessorDllName));
RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.PrintDestinationsName));
RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.PrintParameterString));
RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.CommentString));
NDR_GOTO(ndr_pull_rap_PrintQStatusCode(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.PrintQStatus));
NDR_GOTO(ndr_pull_uint16(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.PrintJobCount));
break;
}
}
result = NT_STATUS_OK;
done:
talloc_free(call);
return result;
}
static bool test_netservergetinfo(struct torture_context *tctx,
struct smbcli_state *cli)
{