The branch, master has been updated
       via  05459cf833aebc8402ef9b58580aa05e0b5f653f (commit)
       via  118ac25784dba37e135ed427ab347107bf8fc8e9 (commit)
      from  a6ab195d72ab5b986f278662f1fbbb5d983effec (commit)

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


- Log -----------------------------------------------------------------
commit 05459cf833aebc8402ef9b58580aa05e0b5f653f
Author: Günther Deschner <[email protected]>
Date:   Tue Jun 23 20:27:05 2009 +0200

    s3-printing: eliminate another non sec_initial_uid using security check.
    
    Guenther

commit 118ac25784dba37e135ed427ab347107bf8fc8e9
Author: Günther Deschner <[email protected]>
Date:   Tue Jun 23 20:26:27 2009 +0200

    s3-spoolss: restructure _spoolss_EndDocPrinter().
    
    Guenther

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

Summary of changes:
 source3/printing/nt_printing.c      |    2 +-
 source3/rpc_server/srv_spoolss_nt.c |   62 ++++++++++++++++++-----------------
 2 files changed, 33 insertions(+), 31 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index f496ae5..3e206be 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -2532,7 +2532,7 @@ uint32 del_a_printer(const char *sharename)
 
        close_all_print_db();
 
-       if (geteuid() == 0) {
+       if (geteuid() == sec_initial_uid()) {
                if (asprintf(&printdb_path, "%s%s.tdb",
                                cache_path("printing/"),
                                sharename) < 0) {
diff --git a/source3/rpc_server/srv_spoolss_nt.c 
b/source3/rpc_server/srv_spoolss_nt.c
index f710994..899fed2 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1995,31 +1995,6 @@ static bool convert_printer_driver_info(const struct 
spoolss_AddDriverInfoCtr *r
        return true;
 }
 
-/********************************************************************
- * _spoolss_enddocprinter_internal.
- ********************************************************************/
-
-static WERROR _spoolss_enddocprinter_internal(pipes_struct *p,
-                                             struct policy_handle *handle)
-{
-       Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
-       int snum;
-
-       if (!Printer) {
-               DEBUG(2,("_spoolss_enddocprinter_internal: Invalid handle 
(%s:%u:%u)\n", OUR_HANDLE(handle)));
-               return WERR_BADFID;
-       }
-
-       if (!get_printer_snum(p, handle, &snum, NULL))
-               return WERR_BADFID;
-
-       Printer->document_started = false;
-       print_job_end(snum, Printer->jobid,NORMAL_CLOSE);
-       /* error codes unhandled so far ... */
-
-       return WERR_OK;
-}
-
 /****************************************************************
  _spoolss_ClosePrinter
 ****************************************************************/
@@ -2029,8 +2004,13 @@ WERROR _spoolss_ClosePrinter(pipes_struct *p,
 {
        Printer_entry *Printer = find_printer_index_by_hnd(p, r->in.handle);
 
-       if (Printer && Printer->document_started)
-               _spoolss_enddocprinter_internal(p, r->in.handle);          /* 
print job was not closed */
+       if (Printer && Printer->document_started) {
+               struct spoolss_EndDocPrinter e;
+
+               e.in.handle = r->in.handle;
+
+               _spoolss_EndDocPrinter(p, &e);
+       }
 
        if (!close_printer_handle(p, r->in.handle))
                return WERR_BADFID;
@@ -2055,8 +2035,13 @@ WERROR _spoolss_DeletePrinter(pipes_struct *p,
        Printer_entry *Printer = find_printer_index_by_hnd(p, r->in.handle);
        WERROR result;
 
-       if (Printer && Printer->document_started)
-               _spoolss_enddocprinter_internal(p, r->in.handle);  /* print job 
was not closed */
+       if (Printer && Printer->document_started) {
+               struct spoolss_EndDocPrinter e;
+
+               e.in.handle = r->in.handle;
+
+               _spoolss_EndDocPrinter(p, &e);
+       }
 
        result = delete_printer_handle(p, r->in.handle);
 
@@ -5659,7 +5644,24 @@ WERROR _spoolss_StartDocPrinter(pipes_struct *p,
 WERROR _spoolss_EndDocPrinter(pipes_struct *p,
                              struct spoolss_EndDocPrinter *r)
 {
-       return _spoolss_enddocprinter_internal(p, r->in.handle);
+       Printer_entry *Printer = find_printer_index_by_hnd(p, r->in.handle);
+       int snum;
+
+       if (!Printer) {
+               DEBUG(2,("_spoolss_EndDocPrinter: Invalid handle (%s:%u:%u)\n",
+                       OUR_HANDLE(r->in.handle)));
+               return WERR_BADFID;
+       }
+
+       if (!get_printer_snum(p, r->in.handle, &snum, NULL)) {
+               return WERR_BADFID;
+       }
+
+       Printer->document_started = false;
+       print_job_end(snum, Printer->jobid, NORMAL_CLOSE);
+       /* error codes unhandled so far ... */
+
+       return WERR_OK;
 }
 
 /****************************************************************


-- 
Samba Shared Repository

Reply via email to