1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

Replaced a whole bunch of lookup_name() requests in

construct_default_printer_sdb() with checks of the owner rid instead.  This
should be much faster, work on non-English systems and systems with renamed
user or group names.
This commit is contained in:
Tim Potter 0001-01-01 00:00:00 +00:00
parent 9ee43d61be
commit 8b435b0a2a

View File

@ -3039,16 +3039,19 @@ static SEC_DESC_BUF *construct_default_printer_sdb(TALLOC_CTX *ctx)
if (winbind_lookup_name(lp_workgroup(), &owner_sid, &name_type)) { if (winbind_lookup_name(lp_workgroup(), &owner_sid, &name_type)) {
sid_append_rid(&owner_sid, DOMAIN_USER_RID_ADMIN); sid_append_rid(&owner_sid, DOMAIN_USER_RID_ADMIN);
} else { } else {
uint32 owner_rid;
/* Backup plan - make printer owned by admins or root. This should /* Backup plan - make printer owned by admins or root.
emulate a lanman printer as security settings can't be This should emulate a lanman printer as security
changed. */ settings can't be changed. */
if (!lookup_name( "Printer Administrators", &owner_sid, &name_type) && sid_peek_rid(&owner_sid, &owner_rid);
!lookup_name( "Administrators", &owner_sid, &name_type) &&
!lookup_name( "Administrator", &owner_sid, &name_type) && if (owner_rid != BUILTIN_ALIAS_RID_PRINT_OPS &&
!lookup_name("root", &owner_sid, &name_type)) { owner_rid != BUILTIN_ALIAS_RID_ADMINS &&
sid_copy(&owner_sid, &global_sid_World); owner_rid != DOMAIN_USER_RID_ADMIN &&
!lookup_name("root", &owner_sid, &name_type)) {
sid_copy(&owner_sid, &global_sid_World);
} }
} }