summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-08 19:51:20 +0100
committerGünther Deschner <gd@samba.org>2009-02-09 10:42:54 +0100
commit373a4d829d4f3591b10044af38ebf2097d21e533 (patch)
tree8986a3ced9fe7b86b86874014ead0c9ebf737187
parent894d05bc41c683a47590cd237194e2b3b7ec0e67 (diff)
downloadsamba-373a4d829d4f3591b10044af38ebf2097d21e533.tar.gz
samba-373a4d829d4f3591b10044af38ebf2097d21e533.tar.bz2
samba-373a4d829d4f3591b10044af38ebf2097d21e533.zip
s3-rpcclient: use rpccli_spoolss_GetForm.
Guenther
-rw-r--r--source3/rpcclient/cmd_spoolss.c54
1 files changed, 47 insertions, 7 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 38acfa35a7..64d87e012c 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -1822,15 +1822,34 @@ static void display_form(FORM_1 *form)
/****************************************************************************
****************************************************************************/
+static void display_form_info1(struct spoolss_FormInfo1 *r)
+{
+ printf("%s\n" \
+ "\tflag: %s (%d)\n" \
+ "\twidth: %d, length: %d\n" \
+ "\tleft: %d, right: %d, top: %d, bottom: %d\n\n",
+ r->form_name, get_form_flag(r->flags), r->flags,
+ r->size.width, r->size.height,
+ r->area.left, r->area.right,
+ r->area.top, r->area.bottom);
+}
+
+/****************************************************************************
+****************************************************************************/
+
static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
POLICY_HND handle;
WERROR werror;
+ NTSTATUS status;
char *servername = NULL, *printername = NULL;
- FORM_1 form;
bool got_handle = False;
-
+ DATA_BLOB buffer;
+ uint32_t offered = 0;
+ union spoolss_FormInfo info;
+ uint32_t needed;
+
/* Parse the command arguments */
if (argc != 3) {
@@ -1860,13 +1879,34 @@ static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
/* Get the form */
- werror = rpccli_spoolss_getform(cli, mem_ctx, &handle, argv[2], 1, &form);
-
- if (!W_ERROR_IS_OK(werror))
- goto done;
+ status = rpccli_spoolss_GetForm(cli, mem_ctx,
+ &handle,
+ argv[2],
+ 1,
+ NULL,
+ offered,
+ &info,
+ &needed,
+ &werror);
+ if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
+ buffer = data_blob_talloc(mem_ctx, NULL, needed);
+ offered = needed;
+ status = rpccli_spoolss_GetForm(cli, mem_ctx,
+ &handle,
+ argv[2],
+ 1,
+ &buffer,
+ offered,
+ &info,
+ &needed,
+ &werror);
+ }
- display_form(&form);
+ if (!NT_STATUS_IS_OK(status)) {
+ return werror;
+ }
+ display_form_info1(&info.info1);
done:
if (got_handle)
rpccli_spoolss_ClosePrinter(cli, mem_ctx, &handle, NULL);