s3-rpcclient: Use spoolss_init_spoolss_UserLevel1 in winspool cmds
authorGünther Deschner <gd@samba.org>
Fri, 31 Aug 2018 16:22:04 +0000 (18:22 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 7 Sep 2018 23:43:27 +0000 (01:43 +0200)
Use spoolss initialization function to set client version information for
iremotewinspool printer operations

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/rpcclient/cmd_iremotewinspool.c

index c6148ec02c740a0ef090a33df764f126a17eedb7..7f0cecfaf016e6a48dd92187d01bc26690c2e70e 100644 (file)
@@ -24,6 +24,7 @@
 #include "libsmb/libsmb.h"
 #include "auth/gensec/gensec.h"
 #include "auth/credentials/credentials.h"
+#include "rpc_client/init_spoolss.h"
 
 /****************************************************************************
 ****************************************************************************/
@@ -33,6 +34,7 @@ static WERROR cmd_iremotewinspool_async_open_printer(struct rpc_pipe_client *cli
                                                     int argc, const char **argv)
 {
        NTSTATUS status;
+       WERROR werror;
        struct policy_handle hnd;
        struct spoolss_DevmodeContainer devmode_ctr;
        struct spoolss_UserLevelCtr client_info_ctr;
@@ -59,13 +61,13 @@ static WERROR cmd_iremotewinspool_async_open_printer(struct rpc_pipe_client *cli
 
        ZERO_STRUCT(devmode_ctr);
 
-       level1.size     = 40;
-       level1.client   = talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name());
-       W_ERROR_HAVE_NO_MEMORY(level1.client);
-       level1.user     = cli_credentials_get_username(creds);
-       level1.build    = 1381;
-       level1.major    = 3;
-       level1.minor    = 0;
+        werror = spoolss_init_spoolss_UserLevel1(mem_ctx,
+                                                cli_credentials_get_username(creds),
+                                                &level1);
+       if (!W_ERROR_IS_OK(werror)) {
+               return werror;
+       }
+
        level1.processor = PROCESSOR_ARCHITECTURE_AMD64;
 
        client_info_ctr.level = 1;