working on fix for BUG #294. Not done yet, but this at least clears
authorGerald Carter <jerry@samba.org>
Tue, 19 Aug 2003 16:56:53 +0000 (16:56 +0000)
committerGerald Carter <jerry@samba.org>
Tue, 19 Aug 2003 16:56:53 +0000 (16:56 +0000)
up some of the false positives in "rpcclient -c getdriver".
Also make sure that we ask for version2 and 3 drivers on x86.
(This used to be commit 5be51515680da910b623f486108d91f9ea914bd2)

source3/rpc_client/cli_spoolss.c
source3/rpcclient/cmd_spoolss.c

index f983f63cd726dc45d5174804888ced6a8814a512..8f5f2413deec38d4daa829568fc433970912ddd7 100644 (file)
@@ -720,7 +720,7 @@ WERROR cli_spoolss_getprinterdriver(struct cli_state *cli,
                                    TALLOC_CTX *mem_ctx, 
                                    uint32 offered, uint32 *needed,
                                    POLICY_HND *pol, uint32 level, 
-                                   const char *env, PRINTER_DRIVER_CTR *ctr)
+                                   const char *env, int version, PRINTER_DRIVER_CTR *ctr)
 {
        prs_struct qbuf, rbuf;
        SPOOL_Q_GETPRINTERDRIVER2 q;
@@ -742,7 +742,7 @@ WERROR cli_spoolss_getprinterdriver(struct cli_state *cli,
        prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
        prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
 
-       make_spoolss_q_getprinterdriver2(&q, pol, env, level, 2, 2,
+       make_spoolss_q_getprinterdriver2(&q, pol, env, level, version, 2,
                                         &buffer, offered);
 
        /* Marshall data and send request */
index d2e62ac3a3d1fd70863b07a92ac154ae0530d249..61e100c03bb7a12b7650573212120d7294b131cb 100644 (file)
@@ -35,6 +35,7 @@ static const struct table_node archi_table[]= {
 
        {"Windows 4.0",          "WIN40",       0 },
        {"Windows NT x86",       "W32X86",      2 },
+       {"Windows NT x86",       "W32X86",      3 },
        {"Windows NT R4000",     "W32MIPS",     2 },
        {"Windows NT Alpha_AXP", "W32ALPHA",    2 },
        {"Windows NT PowerPC",   "W32PPC",      2 },
@@ -936,6 +937,7 @@ static WERROR cmd_spoolss_getdriver(struct cli_state *cli,
                        servername, 
                        user;
        uint32          i;
+       BOOL            success = False;
 
        if ((argc == 1) || (argc > 3)) 
        {
@@ -971,15 +973,22 @@ static WERROR cmd_spoolss_getdriver(struct cli_state *cli,
 
                werror = cli_spoolss_getprinterdriver(
                        cli, mem_ctx, 0, &needed, &pol, info_level, 
-                       archi_table[i].long_archi, &ctr);
+                       archi_table[i].long_archi, archi_table[i].version,
+                       &ctr);
 
-               if (W_ERROR_V(werror) == ERRinsufficientbuffer)
+               if (W_ERROR_V(werror) == ERRinsufficientbuffer) {
                        werror = cli_spoolss_getprinterdriver(
                                cli, mem_ctx, needed, NULL, &pol, info_level, 
-                               archi_table[i].long_archi, &ctr);
+                               archi_table[i].long_archi, archi_table[i].version, 
+                               &ctr);
+               }
 
                if (!W_ERROR_IS_OK(werror))
                        continue;
+               
+               /* need at least one success */
+               
+               success = True;
                        
                printf ("\n[%s]\n", archi_table[i].long_archi);
 
@@ -1004,6 +1013,9 @@ static WERROR cmd_spoolss_getdriver(struct cli_state *cli,
        if (opened_hnd)
                cli_spoolss_close_printer (cli, mem_ctx, &pol);
        
+       if ( success )
+               werror = WERR_OK;
+               
        return werror;
 }