The branch, master has been updated
       via  88b27eb spoolss: handle SetPrinter for info level 4
      from  2947a70 ldb:wscript: make it possible to build samba with a system 
ldb again

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 88b27ebcc94da40783d01f5496bfcaad467e6048
Author: Garming Sam <[email protected]>
Date:   Tue Nov 18 12:41:30 2014 +1300

    spoolss: handle SetPrinter for info level 4
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10770
    
    Signed-off-by: Garming Sam <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Tue Sep  1 03:33:13 CEST 2015 on sn-devel-104

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

Summary of changes:
 source3/rpc_server/spoolss/srv_spoolss_nt.c | 83 +++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c 
b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 0639b87..2778ba8 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -7015,6 +7015,89 @@ WERROR _spoolss_SetPrinter(struct pipes_struct *p,
                case 3:
                        return update_printer_sec(r->in.handle, p,
                                                  r->in.secdesc_ctr);
+               case 4: {
+                       struct spoolss_PrinterInfo2 *old_printer;
+                       struct spoolss_SetPrinterInfo2 *set_old_printer;
+                       struct spoolss_SetPrinterInfoCtr *info_ctr;
+                       struct dcerpc_binding_handle *b;
+                       int snum;
+                       TALLOC_CTX *tmp_ctx;
+
+                       tmp_ctx = talloc_new(p->mem_ctx);
+                       if (tmp_ctx == NULL) {
+                               return WERR_NOMEM;
+                       }
+
+                       if (!get_printer_snum(p, r->in.handle, &snum, NULL)) {
+                               TALLOC_FREE(tmp_ctx);
+                               return WERR_BADFID;
+                       }
+
+                       result = winreg_printer_binding_handle(tmp_ctx,
+                                                              
get_session_info_system(),
+                                                              p->msg_ctx,
+                                                              &b);
+                       if (!W_ERROR_IS_OK(result)) {
+                               TALLOC_FREE(tmp_ctx);
+                               return result;
+                       }
+
+                       result = winreg_get_printer(tmp_ctx, b,
+                                                   lp_const_servicename(snum),
+                                                   &old_printer);
+                       if (!W_ERROR_IS_OK(result)) {
+                               TALLOC_FREE(tmp_ctx);
+                               return WERR_BADFID;
+                       }
+
+                       old_printer->servername = talloc_strdup(tmp_ctx, 
r->in.info_ctr->info.info4->servername);
+                       if (old_printer->servername == NULL) {
+                               TALLOC_FREE(tmp_ctx);
+                               return WERR_NOMEM;
+                       }
+
+                       old_printer->printername = talloc_strdup(tmp_ctx, 
r->in.info_ctr->info.info4->printername);
+                       if (old_printer->printername == NULL) {
+                               TALLOC_FREE(tmp_ctx);
+                               return WERR_NOMEM;
+                       }
+
+                       old_printer->attributes = 
r->in.info_ctr->info.info4->attributes;
+
+                       set_old_printer = talloc_zero(tmp_ctx, struct 
spoolss_SetPrinterInfo2);
+                       if (set_old_printer == NULL) {
+                               TALLOC_FREE(tmp_ctx);
+                               return WERR_NOMEM;
+                       }
+
+                       spoolss_printerinfo2_to_setprinterinfo2(old_printer, 
set_old_printer);
+
+                       info_ctr = talloc_zero(tmp_ctx, struct 
spoolss_SetPrinterInfoCtr);
+                       if (info_ctr == NULL) {
+                               TALLOC_FREE(tmp_ctx);
+                               return WERR_NOMEM;
+                       }
+
+                       info_ctr->level = 2;
+                       info_ctr->info.info2 = set_old_printer;
+
+                       result = update_printer(p, r->in.handle,
+                                               info_ctr,
+                                               r->in.devmode_ctr->devmode);
+
+                       if (!W_ERROR_IS_OK(result)) {
+                               TALLOC_FREE(tmp_ctx);
+                               return result;
+                       }
+
+                       if (r->in.secdesc_ctr->sd) {
+                               result = update_printer_sec(r->in.handle, p,
+                                                           r->in.secdesc_ctr);
+                       }
+
+                       TALLOC_FREE(tmp_ctx);
+                       return result;
+               }
                case 7:
                        return publish_or_unpublish_printer(p, r->in.handle,
                                                            
r->in.info_ctr->info.info7);


-- 
Samba Shared Repository

Reply via email to