Needed to add the SHARED attribute bit when creating a printer
authorGerald Carter <jerry@samba.org>
Thu, 10 Aug 2000 04:10:29 +0000 (04:10 +0000)
committerGerald Carter <jerry@samba.org>
Thu, 10 Aug 2000 04:10:29 +0000 (04:10 +0000)
on a Samba host.  Also needed to add an option to pass the share
name (printer name) on the command line.

And fixed the checking of the return code for spoolss_r_addprinterex()

jerry
(This used to be commit 880e81161640cd38540b06d982c592cbada51d40)

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

index 7417e0c0fc6f96ea0f312dc51bc5adca736b30ee..ed5c66ebfc3220e33fe8d5aff3c07add3f29d781 100644 (file)
@@ -839,10 +839,13 @@ uint32 spoolss_addprinterdriver(const char *srv_name, uint32 level, PRINTER_DRIV
        {
                ZERO_STRUCT(r_o);
 
-               if(!spoolss_io_r_addprinterdriver("", &r_o, &rbuf, 0)) 
+               if(spoolss_io_r_addprinterdriver("", &r_o, &rbuf, 0)) 
                {
-                        /* report error code */
-                        DEBUG(5,("SPOOLSS_ADDPRINTEREX: %s\n", get_nt_error_msg(r_o.status)));
+                       if (r_o.status != NT_STATUS_NO_PROBLEMO)
+                       {
+                               /* report error code */
+                               DEBUG(0,("SPOOLSS_ADDPRINTERDRIVER: %s\n", get_nt_error_msg(r_o.status)));
+                       }
                }
         }
 
index 2844df8dd8e83421a928c029d2b11083ba579c79..6cec9ae1cd29d08256bf121b5d637522f2d44227 100644 (file)
@@ -543,7 +543,8 @@ uint32 cmd_spoolss_addprinterex(struct client_info *info, int argc, char *argv[]
         fstring        srv_name, 
                        printer_name, 
                        driver_name,
-                       port_name;
+                       port_name,
+                       share_name;
        POLICY_HND hnd;
        PRINTER_INFO_2  print_info_2;
        PORT_INFO_1     *port_info_1 = NULL;
@@ -561,15 +562,16 @@ uint32 cmd_spoolss_addprinterex(struct client_info *info, int argc, char *argv[]
         strupper(srv_name);
 
        /* check (and copy) the command line arguments */
-        if (argc < 3) {
-                report(out_hnd, "spooladdprinterex <name> <driver> <port>\n");
+        if (argc < 4) {
+                report(out_hnd, "spooladdprinterex <name> <shared name> <driver> <port>\n");
                 return NT_STATUS_INVALID_PARAMETER;
         }
        else
        {
                fstrcpy(printer_name, argv[1]);
-               fstrcpy(driver_name, argv[2]);
-               fstrcpy(port_name, argv[3]);
+               fstrcpy(share_name, argv[2]);
+               fstrcpy(driver_name, argv[3]);
+               fstrcpy(port_name, argv[4]);
        }
        
        /* Verify that the specified port is ok; spoolss_enum_ports() should 
@@ -637,7 +639,7 @@ uint32 cmd_spoolss_addprinterex(struct client_info *info, int argc, char *argv[]
        ZERO_STRUCTP(&print_info_2);
        /* init_unistr( &print_info_2.servername,       srv_name); */
        init_unistr( &print_info_2.printername, printer_name);
-       /* init_unistr( &print_info_2.sharename,        share_name); */
+       init_unistr( &print_info_2.sharename,   share_name);
        init_unistr( &print_info_2.portname,    port_name);
        init_unistr( &print_info_2.drivername,  driver_name);
        init_unistr( &print_info_2.comment,     "Created by rpcclient");
@@ -648,7 +650,7 @@ uint32 cmd_spoolss_addprinterex(struct client_info *info, int argc, char *argv[]
        /* init_unistr( &print_info_2.parameters,       ""); */
        print_info_2.devmode = NULL;
        print_info_2.secdesc = NULL;
-       print_info_2.attributes         = 0;
+       print_info_2.attributes         = PRINTER_ATTRIBUTE_SHARED;
        print_info_2.priority           = 0;
        print_info_2.defaultpriority    = 0;
        print_info_2.starttime          = 0;