r2073: Adding getprinter level 7 to rpcclient.
authorGünther Deschner <gd@samba.org>
Wed, 25 Aug 2004 21:26:37 +0000 (21:26 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:52:30 +0000 (10:52 -0500)
Is there any other rpc-call to get the guid of a published printer?

Guenther
(This used to be commit 944ad569c7a88e1d2f14311eed10f80ea9861963)

source3/include/rpc_spoolss.h
source3/rpc_client/cli_spoolss.c
source3/rpcclient/cmd_spoolss.c

index d9fc0c6a6ab9bd5af2e721c8ad0facea3a5de73e..7f82c2634f50468a71a0b424b2580775dc1f4626 100755 (executable)
@@ -1025,6 +1025,7 @@ typedef struct printer_info_ctr_info
        PRINTER_INFO_3 *printers_3;
        PRINTER_INFO_4 *printers_4;
        PRINTER_INFO_5 *printers_5;
+       PRINTER_INFO_7 *printers_7;
 }
 PRINTER_INFO_CTR;
 
index 8f5f2413deec38d4daa829568fc433970912ddd7..5303f83bf9c2a163da85f0bb02534f6b7947b789 100644 (file)
@@ -130,6 +130,27 @@ static void decode_printer_info_3(TALLOC_CTX *mem_ctx, NEW_BUFFER *buffer,
         *info=inf;
 }
 
+/**********************************************************************
+**********************************************************************/
+static void decode_printer_info_7(TALLOC_CTX *mem_ctx, NEW_BUFFER *buffer,
+                               uint32 returned, PRINTER_INFO_7 **info)
+{
+       uint32 i;
+       PRINTER_INFO_7  *inf;
+
+       inf=(PRINTER_INFO_7 *)talloc(mem_ctx, returned*sizeof(PRINTER_INFO_7));
+       memset(inf, 0, returned*sizeof(PRINTER_INFO_7));
+
+       prs_set_offset(&buffer->prs,0);
+
+       for (i=0; i<returned; i++) {
+               smb_io_printer_info_7("", buffer, &inf[i], 0);
+       }
+
+       *info=inf;
+}
+
+
 /**********************************************************************
 **********************************************************************/
 static void decode_port_info_1(TALLOC_CTX *mem_ctx, NEW_BUFFER *buffer, 
@@ -626,6 +647,9 @@ WERROR cli_spoolss_getprinter(struct cli_state *cli, TALLOC_CTX *mem_ctx,
                case 3:
                        decode_printer_info_3(mem_ctx, r.buffer, 1, &ctr->printers_3);
                        break;
+               case 7:
+                       decode_printer_info_7(mem_ctx, r.buffer, 1, &ctr->printers_7);
+                       break;
                }                       
        }
        
index 66ad96a9d301b0460a804f14e59c4a454a30e6db..0e2dd22240a3d66145571fbc68225d32b526948d 100644 (file)
@@ -297,6 +297,18 @@ static void display_print_info_3(PRINTER_INFO_3 *i3)
        printf("\n");
 }
 
+/****************************************************************************
+printer info level 7 display function
+****************************************************************************/
+static void display_print_info_7(PRINTER_INFO_7 *i7)
+{
+       fstring guid = "";
+       rpcstr_pull(guid, i7->guid.buffer,sizeof(guid), -1, STR_TERMINATE);
+       printf("\tguid:[%s]\n", guid);
+       printf("\taction:[0x%x]\n", i7->action);
+}
+
+
 /* Enumerate printers */
 
 static WERROR cmd_spoolss_enum_printers(struct cli_state *cli, 
@@ -687,6 +699,9 @@ static WERROR cmd_spoolss_getprinter(struct cli_state *cli,
        case 3:
                display_print_info_3(ctr.printers_3);
                break;
+       case 7:
+               display_print_info_7(ctr.printers_7);
+               break;
        default:
                printf("unknown info level %d\n", info_level);
                break;