]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r4134: check the setprinter(3) based on the access permissions on the handle and...
authorGerald Carter <jerry@samba.org>
Fri, 10 Dec 2004 21:08:34 +0000 (21:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:53:35 +0000 (10:53 -0500)
source/rpc_server/srv_spoolss_nt.c

index 78b5fb61fac2b7ee1bed6642cede90e79b07ee3d..9aa46d1a5a9e17b31118ffee6748aa20feb07a54 100644 (file)
@@ -5860,6 +5860,17 @@ static WERROR update_printer_sec(POLICY_HND *handle, uint32 level,
                result = WERR_BADFID;
                goto done;
        }
+       
+       /* Check the user has permissions to change the security
+          descriptor.  By experimentation with two NT machines, the user
+          requires Full Access to the printer to change security
+          information. */
+
+       if ( Printer->access_granted != PRINTER_ACCESS_ADMINISTER ) {
+               DEBUG(4,("update_printer_sec: updated denied by printer permissions\n"));
+               result = WERR_ACCESS_DENIED;
+               goto done;
+       }
 
        /* NT seems to like setting the security descriptor even though
           nothing may have actually changed. */
@@ -5909,20 +5920,6 @@ static WERROR update_printer_sec(POLICY_HND *handle, uint32 level,
                goto done;
        }
 
-       /* Work out which user is performing the operation */
-
-       get_current_user(&user, p);
-
-       /* Check the user has permissions to change the security
-          descriptor.  By experimentation with two NT machines, the user
-          requires Full Access to the printer to change security
-          information. */
-
-       if (!print_access_check(&user, snum, PRINTER_ACCESS_ADMINISTER)) {
-               result = WERR_ACCESS_DENIED;
-               goto done;
-       }
-
        result = nt_printing_setsec(Printer->sharename, new_secdesc_ctr);
 
  done: