s3-spoolss: use rpccli_spoolss_AddForm in net and rpcclient.
authorGünther Deschner <gd@samba.org>
Sat, 7 Feb 2009 23:03:00 +0000 (00:03 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 9 Feb 2009 09:42:04 +0000 (10:42 +0100)
Guenther

source3/rpcclient/cmd_spoolss.c
source3/utils/net_rpc_printer.c

index a7a7fef6ec861379dbaaeda05b26eddb83380a2e..623c0388e1a593c273fd529d398b1d9fb91768df 100644 (file)
@@ -1642,10 +1642,12 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
 {
        POLICY_HND handle;
        WERROR werror;
+       NTSTATUS status;
        char *servername = NULL, *printername = NULL;
-       FORM form;
        bool got_handle = False;
-       
+       union spoolss_AddFormInfo info;
+       struct spoolss_AddFormInfo1 info1;
+
        /* Parse the command arguments */
 
        if (argc != 3) {
@@ -1676,19 +1678,25 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
 
        /* Dummy up some values for the form data */
 
-       form.flags = FORM_USER;
-       form.size_x = form.size_y = 100;
-       form.left = 0;
-       form.top = 10;
-       form.right = 20;
-       form.bottom = 30;
+       info1.flags             = FORM_USER;
+       info1.form_name         = argv[2];
+       info1.size.width        = 100;
+       info1.size.height       = 100;
+       info1.area.left         = 0;
+       info1.area.top          = 10;
+       info1.area.right        = 20;
+       info1.area.bottom       = 30;
 
-       init_unistr2(&form.name, argv[2], UNI_STR_TERMINATE);
+       info.info1 = &info1;
 
        /* Add the form */
 
 
-       werror = rpccli_spoolss_addform(cli, mem_ctx, &handle, 1, &form);
+       status = rpccli_spoolss_AddForm(cli, mem_ctx,
+                                       &handle,
+                                       1,
+                                       info,
+                                       &werror);
 
  done:
        if (got_handle)
index 60e823e5e0be770ee7e56863d99c881c1f096648..ad9be057985bae477db8edc4aebfbd2d76f75624 100644 (file)
@@ -1668,8 +1668,10 @@ NTSTATUS rpc_printer_migrate_forms_internals(struct net_context *c,
 
                for (f = 0; f < num_forms; f++) {
 
-                       FORM form;
+                       union spoolss_AddFormInfo info;
+                       struct spoolss_AddFormInfo1 info1;
                        fstring form_name;
+                       NTSTATUS status;
 
                        /* only migrate FORM_PRINTER types, according to jerry
                           FORM_BUILTIN-types are hard-coded in samba */
@@ -1685,20 +1687,24 @@ NTSTATUS rpc_printer_migrate_forms_internals(struct net_context *c,
                                        f, form_name, forms[f].flag);
 
                        /* is there a more elegant way to do that ? */
-                       form.flags      = FORM_PRINTER;
-                       form.size_x     = forms[f].width;
-                       form.size_y     = forms[f].length;
-                       form.left       = forms[f].left;
-                       form.top        = forms[f].top;
-                       form.right      = forms[f].right;
-                       form.bottom     = forms[f].bottom;
+                       info1.flags             = FORM_PRINTER;
+                       info1.size.width        = forms[f].width;
+                       info1.size.height       = forms[f].length;
+                       info1.area.left         = forms[f].left;
+                       info1.area.top          = forms[f].top;
+                       info1.area.right        = forms[f].right;
+                       info1.area.bottom       = forms[f].bottom;
+                       info1.form_name         = form_name;
 
-                       init_unistr2(&form.name, form_name, UNI_STR_TERMINATE);
+                       info.info1 = &info1;
 
                        /* FIXME: there might be something wrong with samba's
                           builtin-forms */
-                       result = rpccli_spoolss_addform(pipe_hnd_dst, mem_ctx,
-                               &hnd_dst, 1, &form);
+                       status = rpccli_spoolss_AddForm(pipe_hnd_dst, mem_ctx,
+                                                       &hnd_dst,
+                                                       1,
+                                                       info,
+                                                       &result);
                        if (!W_ERROR_IS_OK(result)) {
                                d_printf("\tAddForm form %d: [%s] refused.\n",
                                        f, form_name);