summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-04-15 04:07:13 +0000
committerTim Potter <tpot@samba.org>2002-04-15 04:07:13 +0000
commit1667a821060b8bbc1cef3db473f6967cd02f5886 (patch)
tree8f8a26c208e1d1df5d28c5a075ed451723a0678a /source3/rpc_server
parent36514b65eed055282f2f391d18128536026d9485 (diff)
downloadsamba-1667a821060b8bbc1cef3db473f6967cd02f5886.tar.gz
samba-1667a821060b8bbc1cef3db473f6967cd02f5886.tar.bz2
samba-1667a821060b8bbc1cef3db473f6967cd02f5886.zip
Merge of print server permission handling fixes from HEAD.
Unit tests rock! (This used to be commit bc673c42045ceb46d9569bc4d88f9c64897fc85a)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c49
1 files changed, 37 insertions, 12 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 3bc91c2472..a8552cd14d 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -92,7 +92,8 @@ static uint32 smb_connections=0;
/* in printing/nt_printing.c */
-extern STANDARD_MAPPING printer_std_mapping;
+
+extern STANDARD_MAPPING printer_std_mapping, printserver_std_mapping;
#define OUR_HANDLE(hnd) (((hnd)==NULL)?"NULL":(IVAL((hnd)->data5,4)==(uint32)sys_getpid()?"OURS":"OTHER")), \
((unsigned int)IVAL((hnd)->data5,4)),((unsigned int)sys_getpid())
@@ -959,26 +960,50 @@ Can't find printer handle we created for printer %s\n", name ));
get_current_user(&user, p);
if (Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER) {
- if (printer_default->access_required == 0) {
- return WERR_OK;
+
+ /* Printserver handles use global struct... */
+
+ snum = -1;
+
+ /* Map standard access rights to object specific access
+ rights */
+
+ se_map_standard(&printer_default->access_required,
+ &printserver_std_mapping);
+
+ /* Deny any object specific bits that don't apply to print
+ servers (i.e printer and job specific bits) */
+
+ printer_default->access_required &= SPECIFIC_RIGHTS_MASK;
+
+ if (printer_default->access_required &
+ ~(SERVER_ACCESS_ADMINISTER | SERVER_ACCESS_ENUMERATE)) {
+ DEBUG(3, ("access DENIED for non-printserver bits"));
+ close_printer_handle(p, handle);
+ return WERR_ACCESS_DENIED;
}
- else if ((printer_default->access_required & SERVER_ACCESS_ADMINISTER ) == SERVER_ACCESS_ADMINISTER) {
- /* Printserver handles use global struct... */
- snum = -1;
+ /* Allow admin access */
+
+ if (printer_default->access_required &
+ SERVER_ACCESS_ADMINISTER) {
if (!lp_ms_add_printer_wizard()) {
close_printer_handle(p, handle);
return WERR_ACCESS_DENIED;
}
- else if (user.uid == 0 || user_in_list(uidtoname(user.uid), lp_printer_admin(snum))) {
+
+ if (user.uid == 0 ||
+ user_in_list(uidtoname(user.uid),
+ lp_printer_admin(snum)))
return WERR_OK;
- }
- else {
- close_printer_handle(p, handle);
- return WERR_ACCESS_DENIED;
- }
+
+ close_printer_handle(p, handle);
+ return WERR_ACCESS_DENIED;
}
+
+ /* We fall through to return WERR_OK */
+
}
else
{