1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

Changes from APPLIANCE_HEAD:

source/rpc_server/srv_spoolss_nt.c
        - Changed the se_access_check() call in _spoolss_open_printer_ex()
          to a print_access_check().  This allows the 'printer admins'
          smb.conf and other permission override parameters to affect the
          result of a printer open.
        - Don't perform access check when opening a handle on a print
          server as it breaks browsing the Printers folder.
This commit is contained in:
David O'Neill 0001-01-01 00:00:00 +00:00
parent b4c98196fc
commit bbe51d4b5f

View File

@ -669,10 +669,8 @@ uint32 _spoolss_open_printer_ex( const UNISTR2 *printername,
POLICY_HND *handle) POLICY_HND *handle)
{ {
uint32 result = NT_STATUS_NO_PROBLEMO; uint32 result = NT_STATUS_NO_PROBLEMO;
SEC_DESC_BUF *sec_desc = NULL;
uint32 acc_granted, status;
fstring name; fstring name;
extern struct current_user current_user; int snum;
if (printername == NULL) { if (printername == NULL) {
result = ERROR_INVALID_PRINTER_NAME; result = ERROR_INVALID_PRINTER_NAME;
@ -729,29 +727,22 @@ uint32 _spoolss_open_printer_ex( const UNISTR2 *printername,
} }
/* NT doesn't let us connect to a printer if the connecting user /* NT doesn't let us connect to a printer if the connecting user
doesn't have print permission. If no security descriptor just doesn't have print permission. */
return OK. */
if (!nt_printing_getsec(name, &sec_desc)) { if (!handle_is_printserver(handle)) {
goto done;
}
/* Yuck - we should use the pipe_user rather than current_user but if (!get_printer_snum(handle, &snum))
it doesn't seem to be filled in correctly. )-: */ return ERROR_INVALID_HANDLE;
map_printer_permissions(sec_desc->sec); if (!print_access_check(NULL, snum, PRINTER_ACCESS_USE)) {
if (!se_access_check(sec_desc->sec, &current_user, PRINTER_ACCESS_USE,
&acc_granted, &status)) {
DEBUG(3, ("access DENIED for printer open\n")); DEBUG(3, ("access DENIED for printer open\n"));
close_printer_handle(handle); close_printer_handle(handle);
result = ERROR_ACCESS_DENIED; result = ERROR_ACCESS_DENIED;
goto done; goto done;
} }
}
done: done:
free_sec_desc_buf(&sec_desc);
return result; return result;
} }