From db2445358161e1a0a68b80a7551ed88e7dcc38c6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 9 Aug 2000 04:19:18 +0000 Subject: added printer admin option any user in that list can do anything to a printer (This used to be commit 7b5912be150dd590d6195be40b0976305b8716ba) --- source3/printing/nt_printing.c | 20 ++++++++++++++++---- source3/printing/printing.c | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 0265cf5593..11c8e80276 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -2122,8 +2122,11 @@ jfm: I should use this comment for the text file to explain */ -/* Check a user has permissions to perform the given operation */ +/**************************************************************************** + Check a user has permissions to perform the given operation + if user is NULL then use the current_user structure + ****************************************************************************/ BOOL print_access_check(struct current_user *user, int snum, uint32 required_access) { @@ -2132,14 +2135,23 @@ BOOL print_access_check(struct current_user *user, int snum, BOOL result; char *pname; int i; + extern struct current_user current_user; - /* Get printer name */ + if (!user) user = ¤t_user; + + /* always allow root or printer admins to do anything */ + if (user->uid==0 || + user_in_list(uidtoname(user->uid), lp_printer_admin(snum))) { + return True; + } + /* Get printer name */ pname = PRINTERNAME(snum); if (!pname || !*pname) pname = SERVICE(snum); - /* Get printer security descriptor */ + if (!pname || !*pname) return False; + /* Get printer security descriptor */ nt_printing_getsec(pname, &secdesc); /* The ACE for Full Control in a printer security descriptor @@ -2173,7 +2185,6 @@ BOOL print_access_check(struct current_user *user, int snum, DEBUG(4, ("access check was %s\n", result ? "SUCCESS" : "FAILURE")); /* Free mallocated memory */ - free_sec_desc_buf(&secdesc); return result; @@ -2208,4 +2219,5 @@ BOOL print_time_access_check(int snum) return ok; } + #undef OLD_NTDOMAIN diff --git a/source3/printing/printing.c b/source3/printing/printing.c index c6252b8fb1..a6dc81b172 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1,3 +1,4 @@ +#define OLD_NTDOMAIN 1 /* Unix SMB/Netbios implementation. Version 3.0 @@ -948,3 +949,4 @@ BOOL print_queue_purge(struct current_user *user, int snum) return True; } +#undef OLD_NTDOMAIN -- cgit