s3-rpcclient: allow to add access_mask in cmd_spoolss_open_printer_ex().
authorGünther Deschner <gd@samba.org>
Fri, 4 Jun 2010 14:55:07 +0000 (16:55 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 4 Jun 2010 22:35:09 +0000 (00:35 +0200)
Guenther

source3/rpcclient/cmd_spoolss.c

index d5a7ce7a7af8e340a903ae8b7711a30675b76788..39c581c65ca0e8dc1a97b804851f2a0cb739a92d 100644 (file)
@@ -105,20 +105,22 @@ static WERROR cmd_spoolss_open_printer_ex(struct rpc_pipe_client *cli,
 {
        WERROR          werror;
        struct policy_handle    hnd;
+       uint32_t access_mask = PRINTER_ALL_ACCESS;
 
-       if (argc != 2) {
-               printf("Usage: %s <printername>\n", argv[0]);
+       if (argc < 2) {
+               printf("Usage: %s <printername> [access_mask]\n", argv[0]);
                return WERR_OK;
        }
 
-       if (!cli)
-            return WERR_GENERAL_FAILURE;
+       if (argc >= 3) {
+               sscanf(argv[2], "%x", &access_mask);
+       }
 
        /* Open the printer handle */
 
        werror = rpccli_spoolss_openprinter_ex(cli, mem_ctx,
                                               argv[1],
-                                              PRINTER_ALL_ACCESS,
+                                              access_mask,
                                               &hnd);
        if (W_ERROR_IS_OK(werror)) {
                printf("Printer %s opened successfully\n", argv[1]);