s3: fix net and rpcclient after setprinterdataex changes.
authorGünther Deschner <gd@samba.org>
Mon, 7 Dec 2009 10:54:26 +0000 (11:54 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 7 Dec 2009 13:42:13 +0000 (14:42 +0100)
Guenther

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

index e24fb99e6fdc0a5b20b3bca2e6dddbaa70a2e6ed..5393ba75a9963fbf7be95688f098cb81fd1f5771 100644 (file)
@@ -864,10 +864,9 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli,
        NTSTATUS        status;
        fstring         printername;
        const char *valuename, *keyname;
-       struct regval_blob value;
 
        enum winreg_Type type;
-       uint8_t *buffer = NULL;
+       union spoolss_PrinterData data;
        uint32_t offered = 0;
        uint32_t needed;
 
@@ -903,21 +902,20 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli,
                                                 &pol,
                                                 keyname,
                                                 valuename,
-                                                &type,
-                                                buffer,
                                                 offered,
+                                                &type,
+                                                &data,
                                                 &needed,
                                                 &result);
        if (W_ERROR_EQUAL(result, WERR_MORE_DATA)) {
                offered = needed;
-               buffer = talloc_array(mem_ctx, uint8_t, needed);
                status = rpccli_spoolss_GetPrinterDataEx(cli, mem_ctx,
                                                         &pol,
                                                         keyname,
                                                         valuename,
-                                                        &type,
-                                                        buffer,
                                                         offered,
+                                                        &type,
+                                                        &data,
                                                         &needed,
                                                         &result);
        }
@@ -926,22 +924,13 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli,
                goto done;
        }
 
-       if (!W_ERROR_IS_OK(result)) {
-               goto done;
-       }
-
-
        if (!W_ERROR_IS_OK(result))
                goto done;
 
        /* Display printer data */
 
-       fstrcpy(value.valuename, valuename);
-       value.type = type;
-       value.size = needed;
-       value.data_p = buffer;
+       display_printer_data(valuename, type, &data);
 
-       display_reg_value(value);
 
  done:
        if (is_valid_policy_hnd(&pol))
index 6ad8224c869c663820153c9aff32d9b72ea01eb3..d1d38e8e00f46dd0c43ff6834939fbbc28641303 100644 (file)
@@ -910,6 +910,15 @@ static bool net_spoolss_setprinterdataex(struct rpc_pipe_client *pipe_hnd,
 {
        WERROR result;
        NTSTATUS status;
+       union spoolss_PrinterData data;
+       DATA_BLOB blob;
+
+       blob = data_blob_const(value->data_p, value->size);
+
+       result = pull_spoolss_PrinterData(mem_ctx, &blob, &data, value->type);
+       if (!W_ERROR_IS_OK(result)) {
+               return false;
+       }
 
        /* setprinterdataex call */
        status = rpccli_spoolss_SetPrinterDataEx(pipe_hnd, mem_ctx,
@@ -917,8 +926,8 @@ static bool net_spoolss_setprinterdataex(struct rpc_pipe_client *pipe_hnd,
                                                 keyname,
                                                 value->valuename,
                                                 value->type,
-                                                value->data_p,
-                                                value->size,
+                                                data,
+                                                0,
                                                 &result);
 
        if (!W_ERROR_IS_OK(result)) {