Merge branch 'master' of ssh://git.samba.org/data/git/samba
authorJelmer Vernooij <jelmer@samba.org>
Mon, 9 Feb 2009 18:44:50 +0000 (19:44 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 9 Feb 2009 18:44:50 +0000 (19:44 +0100)
source3/include/proto.h
source3/include/rpc_spoolss.h
source3/libads/ldap_printer.c
source3/rpc_client/cli_spoolss_notify.c
source3/rpc_parse/parse_spoolss.c
source3/rpc_server/srv_spoolss.c
source3/rpc_server/srv_spoolss_nt.c
source3/rpcclient/cmd_spoolss.c
source3/utils/net_rpc_printer.c
source4/wrepl_server/wrepl_in_connection.c

index 5009e6dcdb2345cd4c20ee9e2cac9c59cb5a2dde..537eb98ffc52acf76b6c582f25da3fc52e351176 100644 (file)
@@ -5507,10 +5507,6 @@ WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli, TALLOC_CTX *me
 WERROR rpccli_spoolss_reply_open_printer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
                                      const char *printer, uint32 printerlocal, uint32 type, 
                                      POLICY_HND *handle);
-WERROR rpccli_spoolss_reply_close_printer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
-                                      POLICY_HND *handle);
-WERROR rpccli_spoolss_routerreplyprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                     POLICY_HND *pol, uint32 condition, uint32 change_id);
 WERROR rpccli_spoolss_rrpcn(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
                         POLICY_HND *pol, uint32 notify_data_len,
                         SPOOL_NOTIFY_INFO_DATA *notify_data,
@@ -5985,8 +5981,6 @@ bool spoolss_io_q_getprinterdriverdir(const char *desc, SPOOL_Q_GETPRINTERDRIVER
 bool spoolss_io_r_getprinterdriverdir(const char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth);
 bool spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth);
 bool spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth);
-bool spoolss_io_q_addprintprocessor(const char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_addprintprocessor(const char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth);
 bool spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth);
 bool spoolss_io_q_enumprintprocdatatypes(const char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth);
 bool spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth);
@@ -6023,13 +6017,6 @@ bool make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u,
                               const fstring string, uint32 printer, uint32 type);
 bool spoolss_io_q_replyopenprinter(const char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth);
 bool spoolss_io_r_replyopenprinter(const char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth);
-bool make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER *q_u, POLICY_HND *hnd, 
-                                       uint32 condition, uint32 change_id);
-bool spoolss_io_q_routerreplyprinter (const char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_routerreplyprinter (const char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth);
-bool make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HND *hnd);
-bool spoolss_io_q_replycloseprinter(const char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_replycloseprinter(const char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth);
 bool make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd,
                                uint32 change_low, uint32 change_high,
                                SPOOL_NOTIFY_INFO *info);
index feabd3fff7ad85fe34ec30a85b84490ad44b1dac..15814d43481609eb26c658a69d7f98421940fedd 100644 (file)
@@ -1395,23 +1395,6 @@ typedef struct spool_r_getprinterdriverdirectory
 }
 SPOOL_R_GETPRINTERDRIVERDIR;
 
-typedef struct spool_q_addprintprocessor
-{
-       uint32 server_ptr;
-       UNISTR2 server;
-       UNISTR2 environment;
-       UNISTR2 path;
-       UNISTR2 name;
-}
-SPOOL_Q_ADDPRINTPROCESSOR;
-
-typedef struct spool_r_addprintprocessor
-{
-       WERROR status;
-}
-SPOOL_R_ADDPRINTPROCESSOR;
-
-
 typedef struct spool_q_enumprintprocessors
 {
        uint32 name_ptr;
@@ -1619,35 +1602,6 @@ typedef struct spool_r_replyopenprinter
 }
 SPOOL_R_REPLYOPENPRINTER;
 
-typedef struct spool_q_routerreplyprinter
-{
-       POLICY_HND handle;
-       uint32 condition;
-       uint32 unknown1;        /* 0x00000001 */
-       uint32 change_id;
-       uint8  unknown2[5];     /* 0x0000000001 */
-}
-SPOOL_Q_ROUTERREPLYPRINTER;
-
-typedef struct spool_r_routerreplyprinter
-{
-       WERROR status;
-}
-SPOOL_R_ROUTERREPLYPRINTER;
-
-typedef struct spool_q_replycloseprinter
-{
-       POLICY_HND handle;
-}
-SPOOL_Q_REPLYCLOSEPRINTER;
-
-typedef struct spool_r_replycloseprinter
-{
-       POLICY_HND handle;
-       WERROR status;
-}
-SPOOL_R_REPLYCLOSEPRINTER;
-
 typedef struct spool_q_rrpcn
 {
        POLICY_HND handle;
index 023acaa638b1e386f6257c5a14f2f15f30c288ff..c9c43f0e108dcf809cea0e2ac211cd91b73b0950 100644 (file)
@@ -310,20 +310,19 @@ WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
                                          const char *printer)
 {
        WERROR result;
-       char *printername, *servername;
+       char *printername;
        REGVAL_CTR *dsdriver_ctr, *dsspooler_ctr;
        uint32 i;
        POLICY_HND pol;
 
-       if ((asprintf(&servername, "\\\\%s", cli->desthost) == -1)
-           || (asprintf(&printername, "%s\\%s", servername, printer) == -1)) {
+       if ((asprintf(&printername, "%s\\%s", cli->srv_name_slash, printer) == -1)) {
                DEBUG(3, ("Insufficient memory\n"));
                return WERR_NOMEM;
        }
        
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, 
                                             "", MAXIMUM_ALLOWED_ACCESS, 
-                                            servername, cli->auth->user_name,
+                                            cli->srv_name_slash, cli->auth->user_name,
                                             &pol);
        if (!W_ERROR_IS_OK(result)) {
                DEBUG(3, ("Unable to open printer %s, error is %s.\n",
index 5440f7624841f869f88e98cb71953d0d373b632f..11152752e91e483b89583c97785d1441a64bfd42 100644 (file)
@@ -65,69 +65,6 @@ WERROR rpccli_spoolss_reply_open_printer(struct rpc_pipe_client *cli, TALLOC_CTX
        return result;
 }
 
-/* Close a back-channel notification connection */
-
-WERROR rpccli_spoolss_reply_close_printer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
-                                      POLICY_HND *handle)
-{
-       prs_struct qbuf, rbuf;
-       SPOOL_Q_REPLYCLOSEPRINTER q;
-       SPOOL_R_REPLYCLOSEPRINTER r;
-       WERROR result = W_ERROR(ERRgeneral);
-
-       /* Initialise input parameters */
-
-       make_spoolss_q_reply_closeprinter(&q, handle);
-
-       /* Marshall data and send request */
-
-       CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_REPLYCLOSEPRINTER,
-               q, r,
-               qbuf, rbuf,
-               spoolss_io_q_replycloseprinter,
-               spoolss_io_r_replycloseprinter,
-               WERR_GENERAL_FAILURE );
-
-       /* Return result */
-
-       result = r.status;
-       return result;
-}
-
-/*********************************************************************
- This SPOOLSS_ROUTERREPLYPRINTER function is used to send a change 
- notification event when the registration **did not** use 
- SPOOL_NOTIFY_OPTION_TYPE structure to specify the events to monitor.
- Also see cli_spolss_reply_rrpcn()
- *********************************************************************/
-WERROR rpccli_spoolss_routerreplyprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                     POLICY_HND *pol, uint32 condition, uint32 change_id)
-{
-       prs_struct qbuf, rbuf;
-       SPOOL_Q_ROUTERREPLYPRINTER q;
-        SPOOL_R_ROUTERREPLYPRINTER r;
-       WERROR result = W_ERROR(ERRgeneral);
-
-       /* Initialise input parameters */
-
-       make_spoolss_q_routerreplyprinter(&q, pol, condition, change_id);
-
-       /* Marshall data and send request */
-
-       CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ROUTERREPLYPRINTER,
-               q, r,
-               qbuf, rbuf,
-               spoolss_io_q_routerreplyprinter,
-               spoolss_io_r_routerreplyprinter,
-               WERR_GENERAL_FAILURE );
-
-       /* Return output parameters */
-
-       result = r.status;
-       return result;  
-}
-
 /*********************************************************************
  This SPOOLSS_REPLY_RRPCN function is used to send a change 
  notification event when the registration **did** use 
index 84b764eeabe242f6a21ea033500be73eb9ffe096..d0afb990817eeb130b57990ab123610c4ba094c2 100644 (file)
@@ -5013,57 +5013,6 @@ bool spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESS
 /*******************************************************************
 ********************************************************************/  
 
-bool spoolss_io_q_addprintprocessor(const char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_q_addprintprocessor");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_uint32("server_ptr", ps, depth, &q_u->server_ptr))
-               return False;
-       if (!smb_io_unistr2("server", &q_u->server, q_u->server_ptr, ps, depth))
-               return False;
-               
-       if (!prs_align(ps))
-               return False;
-       if (!smb_io_unistr2("environment", &q_u->environment, True, ps, depth))
-               return False;
-               
-       if (!prs_align(ps))
-               return False;
-       if (!smb_io_unistr2("path", &q_u->path, True, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-       if (!smb_io_unistr2("name", &q_u->name, True, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/  
-
-bool spoolss_io_r_addprintprocessor(const char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth)
-{              
-       prs_debug(ps, depth, desc, "spoolss_io_r_addprintproicessor");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;            
-}
-
-/*******************************************************************
-********************************************************************/  
-
 bool spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth)
 {              
        prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocdatatypes");
@@ -5627,126 +5576,6 @@ bool spoolss_io_r_replyopenprinter(const char *desc, SPOOL_R_REPLYOPENPRINTER *r
        return True;            
 }
 
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-bool make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER *q_u, POLICY_HND *hnd, 
-                                       uint32 condition, uint32 change_id)
-{
-
-       memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
-       q_u->condition = condition;
-       q_u->change_id = change_id;
-
-       /* magic values */
-       q_u->unknown1 = 0x1;
-       memset(q_u->unknown2, 0x0, 5);
-       q_u->unknown2[0] = 0x1;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_Q_ROUTERREPLYPRINTER structure.
-********************************************************************/
-bool spoolss_io_q_routerreplyprinter (const char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth)
-{
-
-       prs_debug(ps, depth, desc, "spoolss_io_q_routerreplyprinter");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
-               return False;
-
-       if (!prs_uint32("condition", ps, depth, &q_u->condition))
-               return False;
-
-       if (!prs_uint32("unknown1", ps, depth, &q_u->unknown1))
-               return False;
-
-       if (!prs_uint32("change_id", ps, depth, &q_u->change_id))
-               return False;
-
-       if (!prs_uint8s(False, "dev_private",  ps, depth, q_u->unknown2, 5))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_R_ROUTERREPLYPRINTER structure.
-********************************************************************/
-bool spoolss_io_r_routerreplyprinter (const char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_r_routerreplyprinter");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HND *hnd)
-{      
-       if (q_u == NULL)
-               return False;
-
-       memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
-       return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_Q_REPLYCLOSEPRINTER structure.
-********************************************************************/  
-
-bool spoolss_io_q_replycloseprinter(const char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_q_replycloseprinter");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_R_REPLYCLOSEPRINTER structure.
-********************************************************************/  
-
-bool spoolss_io_r_replycloseprinter(const char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth)
-{              
-       prs_debug(ps, depth, desc, "spoolss_io_r_replycloseprinter");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth))
-               return False;
-
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;            
-}
-
 #if 0  /* JERRY - not currently used but could be :-) */
 
 /*******************************************************************
index bf11bc69149daab71d50c87ba94dc94be53c2fba..cf5b4fb3f89ae2094a8cc80409c8815b0704a125 100644 (file)
@@ -898,31 +898,7 @@ static bool api_spoolss_enumprintprocessors(pipes_struct *p)
 
 static bool api_spoolss_addprintprocessor(pipes_struct *p)
 {
-       SPOOL_Q_ADDPRINTPROCESSOR q_u;
-       SPOOL_R_ADDPRINTPROCESSOR r_u;
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-       
-       if(!spoolss_io_q_addprintprocessor("", &q_u, data, 0)) {
-               DEBUG(0,("spoolss_io_q_addprintprocessor: unable to unmarshall SPOOL_Q_ADDPRINTPROCESSOR.\n"));
-               return False;
-       }
-       
-       /* for now, just indicate success and ignore the add.  We'll
-          automatically set the winprint processor for printer
-          entries later.  Used to debug the LexMark Optra S 1855 PCL
-          driver --jerry */
-       r_u.status = WERR_OK;
-
-       if(!spoolss_io_r_addprintprocessor("", &r_u, rdata, 0)) {
-               DEBUG(0,("spoolss_io_r_addprintprocessor: unable to marshall SPOOL_R_ADDPRINTPROCESSOR.\n"));
-               return False;
-       }
-       
-       return True;
+       return proxy_spoolss_call(p, NDR_SPOOLSS_ADDPRINTPROCESSOR);
 }
 
 /****************************************************************************
index 31ab2ca43dd8b522903aeb6d79f61ed7f62111d7..ec1a9a81da9a2f78ff5d036fac031d0038564c31 100644 (file)
@@ -150,6 +150,7 @@ static void free_spool_notify_option(SPOOL_NOTIFY_OPTION **pp)
 static void srv_spoolss_replycloseprinter(int snum, POLICY_HND *handle)
 {
        WERROR result;
+       NTSTATUS status;
 
        /*
         * Tell the specific printing tdb we no longer want messages for this printer
@@ -165,11 +166,10 @@ static void srv_spoolss_replycloseprinter(int snum, POLICY_HND *handle)
                return;
        }
 
-       result = rpccli_spoolss_reply_close_printer(notify_cli_pipe,
-                               talloc_tos(),
-                               handle);
-
-       if (!W_ERROR_IS_OK(result))
+       status = rpccli_spoolss_ReplyClosePrinter(notify_cli_pipe, talloc_tos(),
+                                                 handle,
+                                                 &result);
+       if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result))
                DEBUG(0,("srv_spoolss_replycloseprinter: reply_close_printer failed [%s].\n",
                        win_errstr(result)));
 
@@ -9978,6 +9978,22 @@ WERROR _spoolss_xcvdataport(pipes_struct *p, SPOOL_Q_XCVDATAPORT *q_u, SPOOL_R_X
 
        return WERR_INVALID_PRINT_MONITOR;
 }
+
+/****************************************************************
+ _spoolss_AddPrintProcessor
+****************************************************************/
+
+WERROR _spoolss_AddPrintProcessor(pipes_struct *p,
+                                 struct spoolss_AddPrintProcessor *r)
+{
+       /* for now, just indicate success and ignore the add.  We'll
+          automatically set the winprint processor for printer
+          entries later.  Used to debug the LexMark Optra S 1855 PCL
+          driver --jerry */
+
+       return WERR_OK;
+}
+
 /****************************************************************
  _spoolss_EnumPrinters
 ****************************************************************/
@@ -10110,17 +10126,6 @@ WERROR _spoolss_GetPrinterDriverDirectory(pipes_struct *p,
        return WERR_NOT_SUPPORTED;
 }
 
-/****************************************************************
- _spoolss_AddPrintProcessor
-****************************************************************/
-
-WERROR _spoolss_AddPrintProcessor(pipes_struct *p,
-                                 struct spoolss_AddPrintProcessor *r)
-{
-       p->rng_fault_state = true;
-       return WERR_NOT_SUPPORTED;
-}
-
 /****************************************************************
  _spoolss_EnumPrintProcessors
 ****************************************************************/
index 4b35f5790032e0fbf68e7c6b42d990bc904936b9..aba961a22d20aa13fdbf1de777a0e5302ddda348 100644 (file)
@@ -98,7 +98,6 @@ static WERROR cmd_spoolss_open_printer_ex(struct rpc_pipe_client *cli,
 {
        WERROR          werror;
        fstring         printername;
-       fstring         servername, user;
        POLICY_HND      hnd;
 
        if (argc != 2) {
@@ -109,16 +108,14 @@ static WERROR cmd_spoolss_open_printer_ex(struct rpc_pipe_client *cli,
        if (!cli)
             return WERR_GENERAL_FAILURE;
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       fstrcpy(user, cli->auth->user_name);
        fstrcpy(printername, argv[1]);
 
        /* Open the printer handle */
 
        werror = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
                                             "", PRINTER_ALL_ACCESS,
-                                            servername, user, &hnd);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &hnd);
 
        if (W_ERROR_IS_OK(werror)) {
                printf("Printer %s opened successfully\n", printername);
@@ -473,8 +470,6 @@ static WERROR cmd_spoolss_setprinter(struct rpc_pipe_client *cli,
        bool            opened_hnd = False;
        PRINTER_INFO_CTR ctr;
        fstring         printername,
-                       servername,
-                       user,
                        comment;
 
        if (argc == 1 || argc > 3) {
@@ -488,15 +483,12 @@ static WERROR cmd_spoolss_setprinter(struct rpc_pipe_client *cli,
                fstrcpy(comment, argv[2]);
        }
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       slprintf(printername, sizeof(servername)-1, "%s\\%s", servername, argv[1]);
-       fstrcpy(user, cli->auth->user_name);
+       slprintf(printername, sizeof(printername)-1, "%s\\%s", cli->srv_name_slash, argv[1]);
 
        /* get a printer handle */
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
-                               PRINTER_ALL_ACCESS, servername,
-                               user, &pol);
+                               PRINTER_ALL_ACCESS, cli->srv_name_slash,
+                               cli->auth->user_name, &pol);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -539,8 +531,6 @@ static WERROR cmd_spoolss_setprintername(struct rpc_pipe_client *cli,
        bool            opened_hnd = False;
        PRINTER_INFO_CTR ctr;
        fstring         printername,
-                       servername,
-                       user,
                        new_printername;
 
        if (argc == 1 || argc > 3) {
@@ -554,15 +544,12 @@ static WERROR cmd_spoolss_setprintername(struct rpc_pipe_client *cli,
                fstrcpy(new_printername, argv[2]);
        }
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       slprintf(printername, sizeof(printername)-1, "%s\\%s", servername, argv[1]);
-       fstrcpy(user, cli->auth->user_name);
+       slprintf(printername, sizeof(printername)-1, "%s\\%s", cli->srv_name_slash, argv[1]);
 
        /* get a printer handle */
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
-                               PRINTER_ALL_ACCESS, servername,
-                               user, &pol);
+                               PRINTER_ALL_ACCESS, cli->srv_name_slash,
+                               cli->auth->user_name, &pol);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -603,9 +590,7 @@ static WERROR cmd_spoolss_getprinter(struct rpc_pipe_client *cli,
        uint32          info_level = 1;
        bool            opened_hnd = False;
        PRINTER_INFO_CTR ctr;
-       fstring         printername,
-                       servername,
-                       user;
+       fstring         printername;
 
        if (argc == 1 || argc > 3) {
                printf("Usage: %s <printername> [level]\n", argv[0]);
@@ -617,16 +602,14 @@ static WERROR cmd_spoolss_getprinter(struct rpc_pipe_client *cli,
                info_level = atoi(argv[2]);
        }
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       slprintf(printername, sizeof(printername)-1, "%s\\%s", servername, argv[1]);
-       fstrcpy(user, cli->auth->user_name);
+       slprintf(printername, sizeof(printername)-1, "%s\\%s", cli->srv_name_slash, argv[1]);
 
        /* get a printer handle */
 
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
                                             "", MAXIMUM_ALLOWED_ACCESS,
-                                            servername, user, &pol);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &pol);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -741,9 +724,7 @@ static WERROR cmd_spoolss_getprinterdata(struct rpc_pipe_client *cli,
        POLICY_HND      pol;
        WERROR          result;
        bool            opened_hnd = False;
-       fstring         printername,
-                       servername,
-                       user;
+       fstring         printername;
        const char *valuename;
        REGISTRY_VALUE value;
 
@@ -756,20 +737,18 @@ static WERROR cmd_spoolss_getprinterdata(struct rpc_pipe_client *cli,
 
        /* Open a printer handle */
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
        if (strncmp(argv[1], ".", sizeof(".")) == 0)
-               fstrcpy(printername, servername);
+               fstrcpy(printername, cli->srv_name_slash);
        else
-               slprintf(printername, sizeof(servername)-1, "%s\\%s",
-                         servername, argv[1]);
-       fstrcpy(user, cli->auth->user_name);
+               slprintf(printername, sizeof(printername)-1, "%s\\%s",
+                         cli->srv_name_slash, argv[1]);
 
        /* get a printer handle */
 
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
                                             "", MAXIMUM_ALLOWED_ACCESS,
-                                            servername, user, &pol);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &pol);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -806,9 +785,7 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli,
        POLICY_HND      pol;
        WERROR          result;
        bool            opened_hnd = False;
-       fstring         printername,
-                       servername,
-                       user;
+       fstring         printername;
        const char *valuename, *keyname;
        REGISTRY_VALUE value;
 
@@ -823,20 +800,18 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli,
 
        /* Open a printer handle */
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
        if (strncmp(argv[1], ".", sizeof(".")) == 0)
-               fstrcpy(printername, servername);
+               fstrcpy(printername, cli->srv_name_slash);
        else
                slprintf(printername, sizeof(printername)-1, "%s\\%s",
-                         servername, argv[1]);
-       fstrcpy(user, cli->auth->user_name);
+                         cli->srv_name_slash, argv[1]);
 
        /* get a printer handle */
 
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
                                             "", MAXIMUM_ALLOWED_ACCESS,
-                                            servername, user, &pol);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &pol);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -986,9 +961,7 @@ static WERROR cmd_spoolss_getdriver(struct rpc_pipe_client *cli,
        uint32          info_level = 3;
        bool            opened_hnd = False;
        PRINTER_DRIVER_CTR      ctr;
-       fstring         printername,
-                       servername,
-                       user;
+       fstring         printername;
        uint32          i;
        bool            success = False;
 
@@ -999,10 +972,7 @@ static WERROR cmd_spoolss_getdriver(struct rpc_pipe_client *cli,
        }
 
        /* get the arguments need to open the printer handle */
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       fstrcpy(user, cli->auth->user_name);
-       slprintf(printername, sizeof(servername)-1, "%s\\%s", servername, argv[1]);
+       slprintf(printername, sizeof(printername)-1, "%s\\%s", cli->srv_name_slash, argv[1]);
        if (argc == 3)
                info_level = atoi(argv[2]);
 
@@ -1010,7 +980,8 @@ static WERROR cmd_spoolss_getdriver(struct rpc_pipe_client *cli,
 
        werror = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
                                             PRINTER_ACCESS_USE,
-                                            servername, user, &pol);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &pol);
 
        if (!W_ERROR_IS_OK(werror)) {
                printf("Error opening printer handle for %s!\n", printername);
@@ -1374,7 +1345,6 @@ static WERROR cmd_spoolss_addprinterex(struct rpc_pipe_client *cli,
        uint32                  level = 2;
        PRINTER_INFO_CTR        ctr;
        PRINTER_INFO_2          info2;
-       fstring                 servername;
 
        /* parse the command arguments */
        if (argc != 5)
@@ -1383,9 +1353,6 @@ static WERROR cmd_spoolss_addprinterex(struct rpc_pipe_client *cli,
                return WERR_OK;
         }
 
-        slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-        strupper_m(servername);
-
        /* Fill in the DRIVER_INFO_2 struct */
        ZERO_STRUCT(info2);
 
@@ -1434,9 +1401,7 @@ static WERROR cmd_spoolss_setdriver(struct rpc_pipe_client *cli,
        bool                    opened_hnd = False;
        PRINTER_INFO_CTR        ctr;
        PRINTER_INFO_2          info2;
-       fstring                 servername,
-                               printername,
-                               user;
+       fstring                 printername;
 
        /* parse the command arguments */
        if (argc != 3)
@@ -1445,16 +1410,14 @@ static WERROR cmd_spoolss_setdriver(struct rpc_pipe_client *cli,
                return WERR_OK;
         }
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       slprintf(printername, sizeof(printername)-1, "%s\\%s", servername, argv[1]);
-       fstrcpy(user, cli->auth->user_name);
+       slprintf(printername, sizeof(printername)-1, "%s\\%s", cli->srv_name_slash, argv[1]);
 
        /* Get a printer handle */
 
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
                                             PRINTER_ALL_ACCESS,
-                                            servername, user, &pol);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &pol);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -1573,7 +1536,6 @@ static WERROR cmd_spoolss_deletedriver(struct rpc_pipe_client *cli,
 {
        WERROR result = WERR_OK;
        NTSTATUS status;
-       fstring                 servername;
        int                     i;
 
        /* parse the command arguments */
@@ -1582,14 +1544,11 @@ static WERROR cmd_spoolss_deletedriver(struct rpc_pipe_client *cli,
                return WERR_OK;
         }
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-
        /* delete the driver for all architectures */
        for (i=0; archi_table[i].long_archi; i++) {
                /* make the call to remove the driver */
                status = rpccli_spoolss_DeletePrinterDriver(cli, mem_ctx,
-                                                           servername,
+                                                           cli->srv_name_slash,
                                                            archi_table[i].long_archi,
                                                            argv[1],
                                                            &result);
@@ -1619,7 +1578,7 @@ static WERROR cmd_spoolss_getprintprocdir(struct rpc_pipe_client *cli,
                                            int argc, const char **argv)
 {
        WERROR result;
-       char *servername = NULL, *environment = NULL;
+       char *environment = NULL;
        fstring procdir;
 
        /* parse the command arguments */
@@ -1628,23 +1587,17 @@ static WERROR cmd_spoolss_getprintprocdir(struct rpc_pipe_client *cli,
                return WERR_OK;
         }
 
-       if (asprintf(&servername, "\\\\%s", cli->desthost) < 0)
-               return WERR_NOMEM;
-       strupper_m(servername);
-
        if (asprintf(&environment, "%s", (argc == 2) ? argv[1] :
                     PRINTER_DRIVER_ARCHITECTURE) < 0) {
-               SAFE_FREE(servername);
                return WERR_NOMEM;
        }
 
        result = rpccli_spoolss_getprintprocessordirectory(
-               cli, mem_ctx, servername, environment, procdir);
+               cli, mem_ctx, cli->srv_name_slash, environment, procdir);
 
        if (W_ERROR_IS_OK(result))
                printf("%s\n", procdir);
 
-       SAFE_FREE(servername);
        SAFE_FREE(environment);
 
        return result;
@@ -1659,7 +1612,7 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        POLICY_HND handle;
        WERROR werror;
        NTSTATUS status;
-       char *servername = NULL, *printername = NULL;
+       char *printername = NULL;
        bool got_handle = False;
        union spoolss_AddFormInfo info;
        struct spoolss_AddFormInfo1 info1;
@@ -1673,18 +1626,13 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
 
        /* Get a printer handle */
 
-       if (asprintf(&servername, "\\\\%s", cli->desthost) == -1) {
-               return WERR_NOMEM;
-       }
-       strupper_m(servername);
-       if (asprintf(&printername, "%s\\%s", servername, argv[1]) == -1) {
-               SAFE_FREE(servername);
+       if (asprintf(&printername, "%s\\%s", cli->srv_name_slash, argv[1]) == -1) {
                return WERR_NOMEM;
        }
 
        werror = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
                                             PRINTER_ALL_ACCESS,
-                                            servername, cli->auth->user_name,
+                                            cli->srv_name_slash, cli->auth->user_name,
                                             &handle);
 
        if (!W_ERROR_IS_OK(werror))
@@ -1718,7 +1666,6 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        if (got_handle)
                rpccli_spoolss_ClosePrinter(cli, mem_ctx, &handle, NULL);
 
-       SAFE_FREE(servername);
        SAFE_FREE(printername);
 
        return werror;
@@ -1733,7 +1680,7 @@ static WERROR cmd_spoolss_setform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        POLICY_HND handle;
        WERROR werror;
        NTSTATUS status;
-       char *servername = NULL, *printername = NULL;
+       char *printername = NULL;
        bool got_handle = False;
        union spoolss_AddFormInfo info;
        struct spoolss_AddFormInfo1 info1;
@@ -1747,18 +1694,13 @@ static WERROR cmd_spoolss_setform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
 
        /* Get a printer handle */
 
-       if (asprintf(&servername, "\\\\%s", cli->desthost)) {
-               return WERR_NOMEM;
-       }
-       strupper_m(servername);
-       if (asprintf(&printername, "%s\\%s", servername, argv[1]) == -1) {
-               SAFE_FREE(servername);
+       if (asprintf(&printername, "%s\\%s", cli->srv_name_slash, argv[1]) == -1) {
                return WERR_NOMEM;
        }
 
        werror = rpccli_spoolss_open_printer_ex(
                cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
-               servername, cli->auth->user_name, &handle);
+               cli->srv_name_slash, cli->auth->user_name, &handle);
 
        if (!W_ERROR_IS_OK(werror))
                goto done;
@@ -1791,7 +1733,6 @@ static WERROR cmd_spoolss_setform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        if (got_handle)
                rpccli_spoolss_ClosePrinter(cli, mem_ctx, &handle, NULL);
 
-       SAFE_FREE(servername);
        SAFE_FREE(printername);
 
        return werror;
@@ -1859,7 +1800,7 @@ static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        POLICY_HND handle;
        WERROR werror;
        NTSTATUS status;
-       char *servername = NULL, *printername = NULL;
+       char *printername = NULL;
        bool got_handle = False;
        DATA_BLOB buffer;
        uint32_t offered = 0;
@@ -1875,18 +1816,13 @@ static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
 
        /* Get a printer handle */
 
-       if (asprintf(&servername, "\\\\%s", cli->desthost) == -1) {
-               return WERR_NOMEM;
-       }
-       strupper_m(servername);
-       if (asprintf(&printername, "%s\\%s", servername, argv[1]) == -1) {
-               SAFE_FREE(servername);
+       if (asprintf(&printername, "%s\\%s", cli->srv_name_slash, argv[1]) == -1) {
                return WERR_NOMEM;
        }
 
        werror = rpccli_spoolss_open_printer_ex(
                cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
-               servername, cli->auth->user_name, &handle);
+               cli->srv_name_slash, cli->auth->user_name, &handle);
 
        if (!W_ERROR_IS_OK(werror))
                goto done;
@@ -1927,7 +1863,6 @@ static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        if (got_handle)
                rpccli_spoolss_ClosePrinter(cli, mem_ctx, &handle, NULL);
 
-       SAFE_FREE(servername);
        SAFE_FREE(printername);
 
        return werror;
@@ -1943,7 +1878,7 @@ static WERROR cmd_spoolss_deleteform(struct rpc_pipe_client *cli,
        POLICY_HND handle;
        WERROR werror;
        NTSTATUS status;
-       char *servername = NULL, *printername = NULL;
+       char *printername = NULL;
        bool got_handle = False;
 
        /* Parse the command arguments */
@@ -1955,18 +1890,13 @@ static WERROR cmd_spoolss_deleteform(struct rpc_pipe_client *cli,
 
        /* Get a printer handle */
 
-       if (asprintf(&servername, "\\\\%s", cli->desthost) == -1) {
-               return WERR_NOMEM;
-       }
-       strupper_m(servername);
-       if (asprintf(&printername, "%s\\%s", servername, argv[1]) == -1) {
-               SAFE_FREE(servername);
+       if (asprintf(&printername, "%s\\%s", cli->srv_name_slash, argv[1]) == -1) {
                return WERR_NOMEM;
        }
 
        werror = rpccli_spoolss_open_printer_ex(
                cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
-               servername, cli->auth->user_name, &handle);
+               cli->srv_name_slash, cli->auth->user_name, &handle);
 
        if (!W_ERROR_IS_OK(werror))
                goto done;
@@ -1987,7 +1917,6 @@ static WERROR cmd_spoolss_deleteform(struct rpc_pipe_client *cli,
        if (got_handle)
                rpccli_spoolss_ClosePrinter(cli, mem_ctx, &handle, NULL);
 
-       SAFE_FREE(servername);
        SAFE_FREE(printername);
 
        return werror;
@@ -2002,7 +1931,7 @@ static WERROR cmd_spoolss_enum_forms(struct rpc_pipe_client *cli,
 {
        POLICY_HND handle;
        WERROR werror;
-       char *servername = NULL, *printername = NULL;
+       char *printername = NULL;
        bool got_handle = False;
        uint32 num_forms, level = 1, i;
        FORM_1 *forms;
@@ -2016,18 +1945,13 @@ static WERROR cmd_spoolss_enum_forms(struct rpc_pipe_client *cli,
 
        /* Get a printer handle */
 
-       if (asprintf(&servername, "\\\\%s", cli->desthost) == -1) {
-               return WERR_NOMEM;
-       }
-       strupper_m(servername);
-       if (asprintf(&printername, "%s\\%s", servername, argv[1]) == -1) {
-               SAFE_FREE(servername);
+       if (asprintf(&printername, "%s\\%s", cli->srv_name_slash, argv[1]) == -1) {
                return WERR_NOMEM;
        }
 
        werror = rpccli_spoolss_open_printer_ex(
                cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
-               servername, cli->auth->user_name, &handle);
+               cli->srv_name_slash, cli->auth->user_name, &handle);
 
        if (!W_ERROR_IS_OK(werror))
                goto done;
@@ -2053,7 +1977,6 @@ static WERROR cmd_spoolss_enum_forms(struct rpc_pipe_client *cli,
        if (got_handle)
                rpccli_spoolss_ClosePrinter(cli, mem_ctx, &handle, NULL);
 
-       SAFE_FREE(servername);
        SAFE_FREE(printername);
 
        return werror;
@@ -2067,7 +1990,7 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli,
                                            int argc, const char **argv)
 {
        WERROR result;
-       fstring servername, printername, user;
+       fstring printername;
        POLICY_HND pol;
        bool opened_hnd = False;
        PRINTER_INFO_CTR ctr;
@@ -2084,10 +2007,7 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli,
                goto done;
        }
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       slprintf(printername, sizeof(servername)-1, "%s\\%s", servername, argv[1]);
-       fstrcpy(user, cli->auth->user_name);
+       slprintf(printername, sizeof(printername)-1, "%s\\%s", cli->srv_name_slash, argv[1]);
 
        value.type = REG_NONE;
 
@@ -2115,8 +2035,9 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli,
 
        /* get a printer handle */
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
-                                            MAXIMUM_ALLOWED_ACCESS, servername,
-                                            user, &pol);
+                                            MAXIMUM_ALLOWED_ACCESS,
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &pol);
        if (!W_ERROR_IS_OK(result))
                goto done;
 
@@ -2280,7 +2201,6 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli,
        uint32 level = 1, num_jobs, i;
        bool got_hnd = False;
        char *printername = NULL;
-       fstring servername, user;
        POLICY_HND hnd;
        JOB_INFO_CTR ctr;
 
@@ -2294,9 +2214,6 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli,
 
        /* Open printer handle */
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       fstrcpy(user, cli->auth->user_name);
        printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost);
        if (!printername) {
                return WERR_NOMEM;
@@ -2309,7 +2226,8 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli,
 
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
                                             "", MAXIMUM_ALLOWED_ACCESS,
-                                            servername, user, &hnd);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &hnd);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -2356,7 +2274,6 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli,
        uint32 i=0, val_needed, data_needed;
        bool got_hnd = False;
        char *printername = NULL;
-       fstring servername, user;
        POLICY_HND hnd;
 
        if (argc != 2) {
@@ -2366,9 +2283,6 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli,
 
        /* Open printer handle */
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       fstrcpy(user, cli->auth->user_name);
        printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost);
        if (!printername) {
                return WERR_NOMEM;
@@ -2381,7 +2295,8 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli,
 
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
                                             "", MAXIMUM_ALLOWED_ACCESS,
-                                            servername, user, &hnd);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &hnd);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -2422,7 +2337,6 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
        uint32 i;
        bool got_hnd = False;
        char *printername = NULL;
-       fstring servername, user;
        const char *keyname = NULL;
        POLICY_HND hnd;
        REGVAL_CTR *ctr = NULL;
@@ -2436,10 +2350,6 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
 
        /* Open printer handle */
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       fstrcpy(user, cli->auth->user_name);
-
        printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost);
        if (!printername) {
                return WERR_NOMEM;
@@ -2452,7 +2362,8 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
 
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
                                             "", MAXIMUM_ALLOWED_ACCESS,
-                                            servername, user, &hnd);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &hnd);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -2492,7 +2403,6 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli,
        WERROR result;
        bool got_hnd = False;
        char *printername = NULL;
-       fstring servername, user;
        const char *keyname = NULL;
        POLICY_HND hnd;
        uint16 *keylist = NULL, *curkey;
@@ -2509,10 +2419,6 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli,
 
        /* Open printer handle */
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-       fstrcpy(user, cli->auth->user_name);
-
        printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost);
        if (!printername) {
                return WERR_NOMEM;
@@ -2526,7 +2432,8 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli,
 
        result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
                                             "", MAXIMUM_ALLOWED_ACCESS,
-                                            servername, user, &hnd);
+                                            cli->srv_name_slash,
+                                            cli->auth->user_name, &hnd);
 
        if (!W_ERROR_IS_OK(result))
                goto done;
@@ -2583,16 +2490,13 @@ static WERROR cmd_spoolss_rffpcnex(struct rpc_pipe_client *cli,
 
        /* Open printer */
 
-       slprintf(servername, sizeof(servername) - 1, "\\\\%s", cli->desthost);
-       strupper_m(servername);
-
        slprintf(printername, sizeof(printername) - 1, "\\\\%s\\%s",
                 cli->desthost, argv[1]);
        strupper_m(printername);
 
        result = rpccli_spoolss_open_printer_ex(
                cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
-               servername, cli->auth->user_name, &hnd);
+               cli->srv_name_slash, cli->auth->user_name, &hnd);
 
        if (!W_ERROR_IS_OK(result)) {
                printf("Error opening %s\n", argv[1]);
@@ -2633,7 +2537,7 @@ static WERROR cmd_spoolss_rffpcnex(struct rpc_pipe_client *cli,
        strupper_m(servername);
 
        result = rpccli_spoolss_rffpcnex(
-               cli, mem_ctx, &hnd, 0, 0, servername, 123, &option);
+               cli, mem_ctx, &hnd, 0, 0, cli->srv_name_slash, 123, &option);
 
        if (!W_ERROR_IS_OK(result)) {
                printf("Error rffpcnex %s\n", argv[1]);
index ad9be057985bae477db8edc4aebfbd2d76f75624..e74524beb71a2c27f8d9a0f282c9f5a67afb539b 100644 (file)
@@ -726,38 +726,35 @@ static bool net_spoolss_open_printer_ex(struct rpc_pipe_client *pipe_hnd,
                                        POLICY_HND *hnd)
 {
        WERROR result;
-       fstring servername, printername2;
+       fstring printername2;
 
-       slprintf(servername, sizeof(servername)-1, "\\\\%s",
-                pipe_hnd->desthost);
-
-       fstrcpy(printername2, servername);
+       fstrcpy(printername2, pipe_hnd->srv_name_slash);
        fstrcat(printername2, "\\");
        fstrcat(printername2, printername);
 
        DEBUG(10,("connecting to: %s as %s for %s and access: %x\n",
-               servername, username, printername2, access_required));
+               pipe_hnd->srv_name_slash, username, printername2, access_required));
 
        /* open printer */
        result = rpccli_spoolss_open_printer_ex(pipe_hnd, mem_ctx, printername2,
                        "", access_required,
-                       servername, username, hnd);
+                       pipe_hnd->csrv_name_slash, username, hnd);
 
        /* be more verbose */
        if (W_ERROR_V(result) == W_ERROR_V(WERR_ACCESS_DENIED)) {
                d_fprintf(stderr, "no access to printer [%s] on [%s] for user [%s] granted\n",
-                       printername2, servername, username);
+                       printername2, pipe_hnd->csrv_name_slash, username);
                return false;
        }
 
        if (!W_ERROR_IS_OK(result)) {
                d_fprintf(stderr, "cannot open printer %s on server %s: %s\n",
-                       printername2, servername, win_errstr(result));
+                       printername2, pipe_hnd->csrv_name_slash, win_errstr(result));
                return false;
        }
 
        DEBUG(2,("got printer handle for printer: %s, server: %s\n",
-               printername2, servername));
+               printername2, pipe_hnd->csrv_name_slash));
 
        return true;
 }
index e6a69b829a608cd32c0434ec23e15f394b2c24f9..7c9c2b77bf4bf616eed52377d397b62c7c649a69 100644 (file)
@@ -236,8 +236,8 @@ NTSTATUS wreplsrv_in_connection_merge(struct wreplsrv_partner *partner,
        NT_STATUS_NOT_OK_RETURN(status);
 
        /*
-        * make the wreplsrv_in_connection structure a child of the 
-        * stream_connection, to match the hierachie of wreplsrv_accept
+        * make the wreplsrv_in_connection structure a child of the
+        * stream_connection, to match the hierarchy of wreplsrv_accept
         */
        wrepl_in->conn          = conn;
        talloc_steal(conn, wrepl_in);