The branch, v3-6-test has been updated
       via  3f8b53e s3:printing: use dcerpc_spoolss_X() functions
       via  281bb10 s3:srv_spoolss: use dcerpc_spoolss_X() functions
       via  fc01d4a s3:smbd: use dcerpc_spoolss_X() functions
       via  5ccc142 s3:net: use dcerpc_spoolss_X() functions
       via  7042891 s3:libads: use dcerpc_spoolss_X() functions
      from  a554efc s3:docs: document "winbind max domain connections"

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 3f8b53e6bb2d3fbb5bd802a461373b0403789320
Author: Stefan Metzmacher <me...@samba.org>
Date:   Sat Jan 15 12:06:09 2011 +0100

    s3:printing: use dcerpc_spoolss_X() functions
    
    metze
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    
    Autobuild-User: Andreas Schneider <a...@samba.org>
    Autobuild-Date: Fri Jan 21 13:14:49 CET 2011 on sn-devel-104
    (cherry picked from commit 7a2fa9fc1cf5b26419c9cd915e85030c7f14e764)

commit 281bb107a70da21744362bd95936fc384cc5674c
Author: Stefan Metzmacher <me...@samba.org>
Date:   Sat Jan 15 11:55:39 2011 +0100

    s3:srv_spoolss: use dcerpc_spoolss_X() functions
    
    metze
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    (cherry picked from commit 1f8332526102e879c8a8f847d6b43efaf69d03ba)

commit fc01d4ab45706aae9b086c63537eb2994953d064
Author: Stefan Metzmacher <me...@samba.org>
Date:   Sat Jan 15 11:53:11 2011 +0100

    s3:smbd: use dcerpc_spoolss_X() functions
    
    metze
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    (cherry picked from commit e830e37c9c0ef6597e92e31915b2f41310ac1cad)

commit 5ccc1421236fd86995073fcc502b5babd36ebe15
Author: Stefan Metzmacher <me...@samba.org>
Date:   Sat Jan 15 11:50:59 2011 +0100

    s3:net: use dcerpc_spoolss_X() functions
    
    metze
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    (cherry picked from commit 81443447a116460911a9235a8f9a60e3c8dea502)

commit 7042891e1c5ce5727670c3bc01c057727edc0bae
Author: Stefan Metzmacher <me...@samba.org>
Date:   Sat Jan 15 11:44:23 2011 +0100

    s3:libads: use dcerpc_spoolss_X() functions
    
    metze
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    (cherry picked from commit a34aa148ca9789ddd7f1f09d548e7c2668876151)

-----------------------------------------------------------------------

Summary of changes:
 source3/libads/ldap_printer.c          |    6 +-
 source3/printing/nt_printing_migrate.c |  107 +++++++++++++-------
 source3/printing/printspoolss.c        |   24 ++--
 source3/rpc_server/srv_spoolss_nt.c    |   37 +++++--
 source3/smbd/lanman.c                  |   72 ++++++++-----
 source3/smbd/reply.c                   |   10 +-
 source3/utils/net_printing.c           |   44 +++++++--
 source3/utils/net_rpc_printer.c        |  175 ++++++++++++++++++++++----------
 8 files changed, 320 insertions(+), 155 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c
index e4a7d34..e4bfbce 100644
--- a/source3/libads/ldap_printer.c
+++ b/source3/libads/ldap_printer.c
@@ -19,7 +19,7 @@
 
 #include "includes.h"
 #include "ads.h"
-#include "../librpc/gen_ndr/cli_spoolss.h"
+#include "../librpc/gen_ndr/ndr_spoolss_c.h"
 #include "rpc_client/cli_spoolss.h"
 #include "registry.h"
 #include "registry/reg_objects.h"
@@ -315,12 +315,14 @@ WERROR get_remote_printer_publishing_data(struct 
rpc_pipe_client *cli,
                                          ADS_MODLIST *mods,
                                          const char *printer)
 {
+       struct dcerpc_binding_handle *b = cli->binding_handle;
        WERROR result;
        char *printername;
        struct spoolss_PrinterEnumValues *info;
        uint32_t count;
        uint32 i;
        struct policy_handle pol;
+       WERROR werr;
 
        if ((asprintf(&printername, "%s\\%s", cli->srv_name_slash, printer) == 
-1)) {
                DEBUG(3, ("Insufficient memory\n"));
@@ -392,7 +394,7 @@ WERROR get_remote_printer_publishing_data(struct 
rpc_pipe_client *cli,
 
        ads_mod_str(mem_ctx, mods, SPOOL_REG_PRINTERNAME, printer);
 
-       rpccli_spoolss_ClosePrinter(cli, mem_ctx, &pol, NULL);
+       dcerpc_spoolss_ClosePrinter(b, mem_ctx, &pol, &werr);
        SAFE_FREE(printername);
 
        return result;
diff --git a/source3/printing/nt_printing_migrate.c 
b/source3/printing/nt_printing_migrate.c
index c646676..61fb9a6 100644
--- a/source3/printing/nt_printing_migrate.c
+++ b/source3/printing/nt_printing_migrate.c
@@ -22,7 +22,7 @@
 #include "printing/nt_printing_migrate.h"
 
 #include "librpc/gen_ndr/ndr_ntprinting.h"
-#include "librpc/gen_ndr/cli_spoolss.h"
+#include "librpc/gen_ndr/ndr_spoolss_c.h"
 #include "rpc_client/cli_spoolss.h"
 #include "librpc/gen_ndr/ndr_security.h"
 #include "rpc_server/rpc_ncacn_np.h"
@@ -38,6 +38,7 @@ static NTSTATUS migrate_form(TALLOC_CTX *mem_ctx,
                         unsigned char *data,
                         size_t length)
 {
+       struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
        struct spoolss_DevmodeContainer devmode_ctr;
        struct policy_handle hnd;
        enum ndr_err_code ndr_err;
@@ -76,7 +77,7 @@ static NTSTATUS migrate_form(TALLOC_CTX *mem_ctx,
 
        ZERO_STRUCT(devmode_ctr);
 
-       status = rpccli_spoolss_OpenPrinter(pipe_hnd,
+       status = dcerpc_spoolss_OpenPrinter(b,
                                            mem_ctx,
                                            srv_name_slash,
                                            NULL,
@@ -85,13 +86,16 @@ static NTSTATUS migrate_form(TALLOC_CTX *mem_ctx,
                                            &hnd,
                                            &result);
        if (!NT_STATUS_IS_OK(status)) {
-               if (!W_ERROR_IS_OK(result)) {
-                       status = werror_to_ntstatus(result);
-               }
-               DEBUG(2, ("OpenPrinter(%s) failed: %s\n",
+               DEBUG(2, ("dcerpc_spoolss_OpenPrinter(%s) failed: %s\n",
                          srv_name_slash, nt_errstr(status)));
                return status;
        }
+       if (!W_ERROR_IS_OK(result)) {
+               DEBUG(2, ("OpenPrinter(%s) failed: %s\n",
+                         srv_name_slash, win_errstr(result)));
+               status = werror_to_ntstatus(result);
+               return status;
+       }
 
        f1.form_name = key_name;
        f1.flags = r.flag;
@@ -106,18 +110,22 @@ static NTSTATUS migrate_form(TALLOC_CTX *mem_ctx,
 
        f.info1 = &f1;
 
-       status = rpccli_spoolss_AddForm(pipe_hnd,
+       status = dcerpc_spoolss_AddForm(b,
                                        mem_ctx,
                                        &hnd,
                                        1,
                                        f,
                                        &result);
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(2, ("AddForm(%s) refused -- %s.\n",
+               DEBUG(2, ("dcerpc_spoolss_AddForm(%s) refused -- %s.\n",
                          f.info1->form_name, nt_errstr(status)));
+       } else if (!W_ERROR_IS_OK(result)) {
+               DEBUG(2, ("AddForm(%s) refused -- %s.\n",
+                         f.info1->form_name, win_errstr(result)));
+               status = werror_to_ntstatus(result);
        }
 
-       rpccli_spoolss_ClosePrinter(pipe_hnd, mem_ctx, &hnd, NULL);
+       dcerpc_spoolss_ClosePrinter(b, mem_ctx, &hnd, &result);
 
        return status;
 }
@@ -128,6 +136,7 @@ static NTSTATUS migrate_driver(TALLOC_CTX *mem_ctx,
                               unsigned char *data,
                               size_t length)
 {
+       struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
        const char *srv_name_slash;
        enum ndr_err_code ndr_err;
        struct ntprinting_driver r;
@@ -176,17 +185,18 @@ static NTSTATUS migrate_driver(TALLOC_CTX *mem_ctx,
        d.level = 3;
        d.info.info3 = &d3;
 
-       status = rpccli_spoolss_AddPrinterDriver(pipe_hnd,
+       status = dcerpc_spoolss_AddPrinterDriver(b,
                                                 mem_ctx,
                                                 srv_name_slash,
                                                 &d,
                                                 &result);
        if (!NT_STATUS_IS_OK(status)) {
-               if (!W_ERROR_IS_OK(result)) {
-                       status = werror_to_ntstatus(result);
-               }
-               DEBUG(2, ("AddPrinterDriver(%s) refused -- %s.\n",
+               DEBUG(2, ("dcerpc_spoolss_AddPrinterDriver(%s) refused -- 
%s.\n",
                          d3.driver_name, nt_errstr(status)));
+       } else if (!W_ERROR_IS_OK(result)) {
+               DEBUG(2, ("AddPrinterDriver(%s) refused -- %s.\n",
+                         d3.driver_name, win_errstr(result)));
+               status = werror_to_ntstatus(result);
        }
 
        return status;
@@ -198,6 +208,7 @@ static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
                                unsigned char *data,
                                size_t length)
 {
+       struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
        struct policy_handle hnd;
        enum ndr_err_code ndr_err;
        struct ntprinting_printer r;
@@ -231,7 +242,7 @@ static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
 
        ZERO_STRUCT(devmode_ctr);
 
-       status = rpccli_spoolss_OpenPrinter(pipe_hnd,
+       status = dcerpc_spoolss_OpenPrinter(b,
                                            mem_ctx,
                                            key_name,
                                            NULL,
@@ -240,11 +251,14 @@ static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
                                            &hnd,
                                            &result);
        if (!NT_STATUS_IS_OK(status)) {
-               if (!W_ERROR_IS_OK(result)) {
-                       status = werror_to_ntstatus(result);
-               }
+               DEBUG(2, ("dcerpc_spoolss_OpenPrinter(%s) failed: %s\n",
+                         key_name, nt_errstr(status)));
+               return status;
+       }
+       if (!W_ERROR_IS_OK(result)) {
                DEBUG(2, ("OpenPrinter(%s) failed: %s\n",
                          key_name, win_errstr(result)));
+               status = werror_to_ntstatus(result);
                return status;
        }
 
@@ -320,7 +334,7 @@ static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
        info_ctr.info.info2 = &info2;
        info_ctr.level = 2;
 
-       status = rpccli_spoolss_SetPrinter(pipe_hnd,
+       status = dcerpc_spoolss_SetPrinter(b,
                                           mem_ctx,
                                           &hnd,
                                           &info_ctr,
@@ -329,10 +343,16 @@ static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
                                           0, /* command */
                                           &result);
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(2, ("SetPrinter(%s) level 2 refused -- %s.\n",
+               DEBUG(2, ("dcerpc_spoolss_SetPrinter(%s) level 2 refused -- 
%s.\n",
                          key_name, nt_errstr(status)));
                goto done;
        }
+       if (!W_ERROR_IS_OK(result)) {
+               DEBUG(2, ("SetPrinter(%s) level 2 refused -- %s.\n",
+                         key_name, win_errstr(result)));
+               status = werror_to_ntstatus(result);
+               goto done;
+       }
 
        /* migrate printerdata */
        for (j = 0; j < r.count; j++) {
@@ -352,7 +372,7 @@ static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
                        valuename++;
                }
 
-               status = rpccli_spoolss_SetPrinterDataEx(pipe_hnd,
+               status = dcerpc_spoolss_SetPrinterDataEx(b,
                                                         mem_ctx,
                                                         &hnd,
                                                         keyname,
@@ -362,16 +382,25 @@ static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
                                                         
r.printer_data[j].data.length,
                                                         &result);
                if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(2, ("SetPrinterDataEx: printer [%s], keyname 
[%s], "
+                       DEBUG(2, ("dcerpc_spoolss_SetPrinterDataEx: "
+                                 "printer [%s], keyname [%s], "
                                  "valuename [%s] refused -- %s.\n",
                                  key_name, keyname, valuename,
                                  nt_errstr(status)));
                        break;
                }
+               if (!W_ERROR_IS_OK(result)) {
+                       DEBUG(2, ("SetPrinterDataEx: printer [%s], keyname 
[%s], "
+                                 "valuename [%s] refused -- %s.\n",
+                                 key_name, keyname, valuename,
+                                 win_errstr(result)));
+                       status = werror_to_ntstatus(result);
+                       break;
+               }
        }
 
  done:
-       rpccli_spoolss_ClosePrinter(pipe_hnd, mem_ctx, &hnd, NULL);
+       dcerpc_spoolss_ClosePrinter(b, mem_ctx, &hnd, &result);
 
        return status;
 }
@@ -382,6 +411,7 @@ static NTSTATUS migrate_secdesc(TALLOC_CTX *mem_ctx,
                                unsigned char *data,
                                size_t length)
 {
+       struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
        struct policy_handle hnd;
        enum ndr_err_code ndr_err;
        struct sec_desc_buf secdesc_ctr;
@@ -412,7 +442,7 @@ static NTSTATUS migrate_secdesc(TALLOC_CTX *mem_ctx,
 
        ZERO_STRUCT(devmode_ctr);
 
-       status = rpccli_spoolss_OpenPrinter(pipe_hnd,
+       status = dcerpc_spoolss_OpenPrinter(b,
                                            mem_ctx,
                                            key_name,
                                            NULL,
@@ -421,17 +451,20 @@ static NTSTATUS migrate_secdesc(TALLOC_CTX *mem_ctx,
                                            &hnd,
                                            &result);
        if (!NT_STATUS_IS_OK(status)) {
-               if (W_ERROR_EQUAL(WERR_INVALID_PRINTER_NAME, result)) {
-                       DEBUG(3, ("Ignoring missing printer %s\n", key_name));
-                       return NT_STATUS_OK;
-               }
-               if (!W_ERROR_IS_OK(result)) {
-                       status = werror_to_ntstatus(result);
-               }
-               DEBUG(2, ("OpenPrinter(%s) failed: %s\n",
+               DEBUG(2, ("dcerpc_spoolss_OpenPrinter(%s) failed: %s\n",
                          key_name, nt_errstr(status)));
                return status;
        }
+       if (W_ERROR_EQUAL(WERR_INVALID_PRINTER_NAME, result)) {
+               DEBUG(3, ("Ignoring missing printer %s\n", key_name));
+               return NT_STATUS_OK;
+       }
+       if (!W_ERROR_IS_OK(result)) {
+               DEBUG(2, ("OpenPrinter(%s) failed: %s\n",
+                         key_name, win_errstr(result)));
+               status = werror_to_ntstatus(result);
+               return status;
+       }
 
        ZERO_STRUCT(devmode_ctr);
 
@@ -440,7 +473,7 @@ static NTSTATUS migrate_secdesc(TALLOC_CTX *mem_ctx,
        info_ctr.info.info3 = &info3;
        info_ctr.level = 3;
 
-       status = rpccli_spoolss_SetPrinter(pipe_hnd,
+       status = dcerpc_spoolss_SetPrinter(b,
                                           mem_ctx,
                                           &hnd,
                                           &info_ctr,
@@ -449,11 +482,15 @@ static NTSTATUS migrate_secdesc(TALLOC_CTX *mem_ctx,
                                           0, /* command */
                                           &result);
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(2, ("SetPrinter(%s) level 3 refused -- %s.\n",
+               DEBUG(2, ("dcerpc_spoolss_SetPrinter(%s) level 3 refused -- 
%s.\n",
                          key_name, nt_errstr(status)));
+       } else if (!W_ERROR_IS_OK(result)) {
+               DEBUG(2, ("SetPrinter(%s) level 3 refused -- %s.\n",
+                         key_name, win_errstr(result)));
+               status = werror_to_ntstatus(result);
        }
 
-       rpccli_spoolss_ClosePrinter(pipe_hnd, mem_ctx, &hnd, NULL);
+       dcerpc_spoolss_ClosePrinter(b, mem_ctx, &hnd, &result);
 
        return status;
 }
diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c
index 8effb6e..9b06ece 100644
--- a/source3/printing/printspoolss.c
+++ b/source3/printing/printspoolss.c
@@ -19,7 +19,7 @@
 
 #include "includes.h"
 #include "printing.h"
-#include "../librpc/gen_ndr/cli_spoolss.h"
+#include "../librpc/gen_ndr/ndr_spoolss_c.h"
 #include "rpc_server/rpc_ncacn_np.h"
 #include "smbd/globals.h"
 #include "../libcli/security/security.h"
@@ -43,7 +43,7 @@ NTSTATUS print_spool_open(files_struct *fsp,
        NTSTATUS status;
        TALLOC_CTX *tmp_ctx;
        struct print_file_data *pf;
-       struct rpc_pipe_client *cli;
+       struct dcerpc_binding_handle *b = NULL;
        struct spoolss_DevmodeContainer devmode_ctr;
        union spoolss_DocumentInfo info;
        int fd = -1;
@@ -132,11 +132,11 @@ NTSTATUS print_spool_open(files_struct *fsp,
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
-       cli = fsp->conn->spoolss_pipe;
+       b = fsp->conn->spoolss_pipe->binding_handle;
 
        ZERO_STRUCT(devmode_ctr);
 
-       status = rpccli_spoolss_OpenPrinter(cli, pf, pf->svcname,
+       status = dcerpc_spoolss_OpenPrinter(b, pf, pf->svcname,
                                            "RAW", devmode_ctr,
                                            SEC_FLAG_MAXIMUM_ALLOWED,
                                            &pf->handle, &werr);
@@ -157,7 +157,7 @@ NTSTATUS print_spool_open(files_struct *fsp,
        info.info1->output_file = pf->filename;
        info.info1->datatype = "RAW";
 
-       status = rpccli_spoolss_StartDocPrinter(cli, tmp_ctx, &pf->handle,
+       status = dcerpc_spoolss_StartDocPrinter(b, tmp_ctx, &pf->handle,
                                                1, info, &pf->jobid, &werr);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
@@ -272,9 +272,9 @@ int print_spool_write(files_struct *fsp,
 
 void print_spool_end(files_struct *fsp, enum file_close_type close_type)
 {
-       struct rpc_pipe_client *cli;
        NTSTATUS status;
        WERROR werr;
+       struct dcerpc_binding_handle *b = NULL;
 
        status = rpc_pipe_open_interface(fsp->conn,
                                         &ndr_table_spoolss.syntax_id,
@@ -288,13 +288,13 @@ void print_spool_end(files_struct *fsp, enum 
file_close_type close_type)
                          nt_errstr(status)));
                return;
        }
-       cli = fsp->conn->spoolss_pipe;
+       b = fsp->conn->spoolss_pipe->binding_handle;
 
        switch (close_type) {
        case NORMAL_CLOSE:
        case SHUTDOWN_CLOSE:
                /* this also automatically calls spoolss_EndDocPrinter */
-               status = rpccli_spoolss_ClosePrinter(cli, fsp->print_file,
+               status = dcerpc_spoolss_ClosePrinter(b, fsp->print_file,
                                                &fsp->print_file->handle,
                                                &werr);
                if (!NT_STATUS_IS_OK(status) ||
@@ -313,9 +313,9 @@ void print_spool_end(files_struct *fsp, enum 
file_close_type close_type)
 void print_spool_terminate(struct connection_struct *conn,
                           struct print_file_data *print_file)
 {
-       struct rpc_pipe_client *cli;
        NTSTATUS status;
        WERROR werr;
+       struct dcerpc_binding_handle *b = NULL;
 
        rap_jobid_delete(print_file->svcname, print_file->jobid);
 
@@ -331,9 +331,9 @@ void print_spool_terminate(struct connection_struct *conn,
                          nt_errstr(status)));
                return;
        }
-       cli = conn->spoolss_pipe;
+       b = conn->spoolss_pipe->binding_handle;
 
-       status = rpccli_spoolss_SetJob(cli, print_file,
+       status = dcerpc_spoolss_SetJob(b, print_file,
                                        &print_file->handle,
                                        print_file->jobid,
                                        NULL, SPOOLSS_JOB_CONTROL_DELETE,
@@ -344,7 +344,7 @@ void print_spool_terminate(struct connection_struct *conn,
                          print_file->jobid, nt_errstr(status)));
                return;
        }
-       status = rpccli_spoolss_ClosePrinter(cli, print_file,
+       status = dcerpc_spoolss_ClosePrinter(b, print_file,
                                             &print_file->handle,
                                             &werr);
        if (!NT_STATUS_IS_OK(status) ||
diff --git a/source3/rpc_server/srv_spoolss_nt.c 
b/source3/rpc_server/srv_spoolss_nt.c
index 6f28ece..defffb6 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -31,7 +31,7 @@
 #include "nt_printing.h"
 #include "srv_spoolss_util.h"
 #include "../librpc/gen_ndr/srv_spoolss.h"
-#include "../librpc/gen_ndr/cli_spoolss.h"
+#include "../librpc/gen_ndr/ndr_spoolss_c.h"
 #include "rpc_client/init_spoolss.h"
 #include "librpc/gen_ndr/messaging.h"
 #include "../libcli/security/security.h"
@@ -124,6 +124,7 @@ struct notify_back_channel {
 
        /* print notify back-channel pipe handle*/
        struct rpc_pipe_client *cli_pipe;
+       struct dcerpc_binding_handle *binding_handle;
        uint32_t active_connections;
 };
 
@@ -243,12 +244,16 @@ static void srv_spoolss_replycloseprinter(int snum,
                return;
        }
 
-       status = rpccli_spoolss_ReplyClosePrinter(
-                                       prn_hnd->notify.cli_chan->cli_pipe,
+       status = dcerpc_spoolss_ReplyClosePrinter(
+                                       
prn_hnd->notify.cli_chan->binding_handle,
                                        talloc_tos(),
                                        &prn_hnd->notify.cli_hnd,
                                        &result);
-       if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("dcerpc_spoolss_ReplyClosePrinter failed [%s].\n",
+                         nt_errstr(status)));
+               result = ntstatus_to_werror(status);
+       } else if (!W_ERROR_IS_OK(result)) {
                DEBUG(0, ("reply_close_printer failed [%s].\n",
                          win_errstr(result)));
        }
@@ -256,6 +261,7 @@ static void srv_spoolss_replycloseprinter(int snum,
        /* if it's the last connection, deconnect the IPC$ share */
        if (prn_hnd->notify.cli_chan->active_connections == 1) {
 
+               prn_hnd->notify.cli_chan->binding_handle = NULL;
                
cli_shutdown(rpc_pipe_np_smb_conn(prn_hnd->notify.cli_chan->cli_pipe));
                DLIST_REMOVE(back_channels, prn_hnd->notify.cli_chan);
                TALLOC_FREE(prn_hnd->notify.cli_chan);
@@ -1266,8 +1272,8 @@ static int send_notify2_printer(TALLOC_CTX *mem_ctx,
 
        info.info0 = &info0;
 
-       status = rpccli_spoolss_RouterReplyPrinterEx(
-                               prn_hnd->notify.cli_chan->cli_pipe,
+       status = dcerpc_spoolss_RouterReplyPrinterEx(
+                               prn_hnd->notify.cli_chan->binding_handle,
                                mem_ctx,
                                &prn_hnd->notify.cli_hnd,
                                prn_hnd->notify.change, /* color */
@@ -1275,7 +1281,13 @@ static int send_notify2_printer(TALLOC_CTX *mem_ctx,
                                &reply_result,
                                0, /* reply_type, must be 0 */
                                info, &werr);
-       if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(werr)) {
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(1, ("dcerpc_spoolss_RouterReplyPrinterEx to client: %s "
+                         "failed: %s\n",
+                         prn_hnd->notify.cli_chan->cli_pipe->srv_name_slash,
+                         nt_errstr(status)));
+               werr = ntstatus_to_werror(status);
+       } else if (!W_ERROR_IS_OK(werr)) {
                DEBUG(1, ("RouterReplyPrinterEx to client: %s "
                          "failed: %s\n",
                          prn_hnd->notify.cli_chan->cli_pipe->srv_name_slash,
@@ -2577,6 +2589,7 @@ static bool srv_spoolss_replyopenprinter(int snum, const 
char *printer,
                        TALLOC_FREE(chan);
                        return false;


-- 
Samba Shared Repository

Reply via email to