summaryrefslogtreecommitdiff
path: root/source3/printing/printing.c
AgeCommit message (Collapse)AuthorFilesLines
2001-01-23Changes from APPLIANCE_HEAD:David O'Neill1-10/+42
source/rpc_server/srv_spoolss_nt.c - add an access check to _spoolss_deleteprinter() to stop random users and passers by from deleting printers. source/lib/messages.c - converted global msg_all struct to a local in message_send_all() function. source/include/smb.h - added a success error code to the spoolss return codes. source/include/proto.h source/param/loadparm.c source/printing/printing.c - Added new parameter "total print jobs" to limit the total number of print jobs across all queues. Currently individual queues are limited by "max print jobs". (This used to be commit 02f154e729b0e8465d3e1e2ac794e6ab3844ce57)
2001-01-23Changes from APPLIANCE_HEAD:David O'Neill1-1/+3
source/rpc_server/srv_spoolss_nt.c - remove redundant srv_spoolss_sendnotify() calls from _spoolss_startdocprinter() and _spoolss_enddocprinter(), as its functionality is already covered in print_job_start() and print_job_end() source/printing/printing.c - force a print_queue_update() prior to print queue purge so that all jobs are purged. (This used to be commit 0ccc552203d6432cde844c5946b203b27f257b1a)
2001-01-22Changes from APPLIANCE_HEAD:David O'Neill1-1/+1
source/printing/printing.c - remove unused variable (This used to be commit 2d09b53b3a9201c2f52306fc12ab01a92e712db2)
2001-01-22Changes from APPLIANCE_HEAD:David O'Neill1-17/+33
source/smbd/lanman.c - cleanup and bug fix for win9x print queue purge. source/printing/printing.c - cleanup and bug fix for win9x print queue purge. - print_job_end() changed to cleanup spool file in the event of a failure returned from the print_run_command() (This used to be commit 0235fbef37b400a2bf875163878e497282cd1739)
2001-01-19Changes from APPLIANCE_HEAD:David O'Neill1-14/+19
source/printing/nt_printing.c - use se_create_child_secdesc() to create appropriate security descriptor when performing print job admin security checks. source/printing/printing.c - Use JOB_ACCESS_ADMINISTER instead of PRINTER_ACCESS_ADMINISTER in print_job_{delete,pause,resume}() - If stat'ing the job file fails, delete the job from printing.tdb - In print_job_end() check lpq cache time and do a print_queue_update() This prevents printing.tdb from growing when using NT/2K clients, and there isn't someone pressing F5 in a port monitor window. - In print_queue_resume() check lpq cache time and do a print_queue_update() Probably should do it for print_job_resume() too. (This used to be commit 0068b7741fd54706ef36ddbbc3092389d281e684)
2001-01-17Changes from APPLIANCE_HEAD:David O'Neill1-1/+0
source/rpc_server/srv_spoolss_nt.c - Unrolled construct_notify_jobs_info() loop to only fetch printer info_2 structure once rather than num_print_jobs times. - convert command to unix codepage. - remove lp_remove_service() call as it prevents lp_killservice() from working. - Modified some DEBUG and DEBUGADD statements. source/param/loadparm.c source/param/params.c - change printer, preload, auto services to FLAG_DOS_STRING, reverted earlier changes to szPrintername et al, add comments. source/printing/load.c - fix bug with lp_auto_services() and strtok() source/printing/nt_printing.c source/printing/printing.c - remove redundant test that used SERVICE(snum) source/printing/pcap.c - add unix_to_dos() calls, add notes wrt FIXMEs for xxx_printer_fn() functions. source/web/swat.c - added FIXME comment. source/smbd/service.c - added comment re: dos codepage (This used to be commit 7b774b72c2857af9519012106714a9e2cb099da3)
2001-01-11Changes from APPLIANCE_HEAD:David O'Neill1-4/+12
testsuite/printing/psec.c - Use lock directory from smb.conf parameter when peeking at the ntdrivers.tdb file. source/rpc_parse/parse_sec.c - fix typo in debug message source/script/installbin.sh - create private directory as part of 'make install'. source/nsswitch/winbindd_cache.c source/nsswitch/winbindd_idmap.c source/passdb/secrets.c source/smbd/connection.c - always convert tdb key to unix code-page when generating. source/printing/nt_printing.c - always convert tdb key to unix code-page when generating. - don't prepend path to a filename that is NULL in add_a_printer_driver_3(). source/rpc_server/srv_spoolss_nt.c - always convert tdb key to unix code-page when generating. - don't prepend server name to a path/filename that is NULL in the fill_printer_driver_info functions. source/printing/printing.c - always convert tdb key to unix code-page when generating. - move access check for print_queue_purge() outside of job delete loop. source/smbd/unix_acls.c - fix for setting ACLs (this got missed earlier) source/lib/messages.c - trivial sync with appliance_head (This used to be commit 376601d17d53ef7bfaafa576bd770e554516e808)
2001-01-08Changes merged from APPLIANCE_HEAD:David O'Neill1-3/+4
source/printing/printing.c source/rpc_server/srv_spoolss_nt.c - convert args for print command to unix codepage. (This used to be commit 1c0ae957f8f1abee7d22a18b6df092eb2a884ae1)
2001-01-04Changes from APPLIANCE_HEAD:David O'Neill1-5/+6
source/Makefile.in - changes to ctags and etags rules that somehow got lost along the way. source/include/proto.h - make proto source/smbd/sec_ctx.c source/smbd/password.c - merge debugs for debugging user groups and NT token stuff. source/lib/util_str.c - capitalise domain name returned from parse_domain_user() source/nsswitch/wb_client.c - fix broken conditional in debug statement. source/include/rpc_secdes.h source/include/rpc_spoolss.h source/printing/nt_printing.c source/lib/util_seaccess.c - fix printer permission bugs related to ACE masks for printers. This adds mapping of generic access rights to object specific rights for NT printers. Still need to work out whether or not to ignore ACEs with certain flags set, though. See comments in util_seaccess.c:check_ace() for details. source/printing/nt_printing.c source/printing/printing.c - use PRINTER_ACCESS_ADMINISTER instead of JOB_ACCESS_ADMINISTER until we sort out printer/printjob permission stuff. (This used to be commit 1dba9c5cd1e6389734c648f6903abcb7c8d5b2f0)
2000-12-15Fixed memory leaks in lsa_XX calls. Fixed memory leaks in smbcacls. MergedJeremy Allison1-8/+8
in fixes from appliance-head and 2.2. Fixed multiple connection.tdb open problem. Jeremy. (This used to be commit 0a40bc83e14c69a09948ec09bb6fc5026c4f4c14)
2000-12-13Changes from APPLIANCE_HEAD:David O'Neill1-14/+19
- trivial typo in definition of enum_printing[] (source/param/loadparm.c) - fixed printer status display bug. When no jobs existed in queue, the clients were not properly notified of printer status. This caused native tools for pausing/unpausing a print queue to not work. (source/printing/printing.c) (This used to be commit c533e77f1912618230a938458980a9339924fe06)
2000-12-07file_lines_load/file_lines_pload can now optionally convert unix_to_dos()Jeremy Allison1-1/+1
on read. Jeremy. (This used to be commit 76b8dd376d13eb4469417be217c966d54d333367)
2000-12-06Sync-up with appliance-head printing code.Jeremy Allison1-2/+0
Jeremy. (This used to be commit fe730614d70b331ec7b1a909940395c9713ea8ac)
2000-11-21Fix for updating of print queues changed from a local box. Essentially,Jeremy Allison1-15/+43
this makes sure that the change messages sent to ourselves are handled synchronously w.r.t. other smb packets incoming. Jeremy. (This used to be commit 78a13074455618308d048d1c69f62e660988eb90)
2000-11-16Fix for a problem with the new messaging system. If a sender is using theJeremy Allison1-14/+7
messaging system as a notification mechanism, and the speed of notification greatly exceeds the speed of message recovery, then you get a massively (>75Mb) growing tdb. If the message is a simple notification, then the message is static, and you only need one of them in transit to a target process at any one time. This patch adds a BOOL "allow_duplicates" to the message_send_XX primitives. If set to False, then before sending a message the sender checks the existing message queue for a target pid for a duplicate of this message, and doesn't add to it if one already exists. Also added code into msgtest.c to test this. Jeremy. (This used to be commit 3aa7995660395ecb85c8e35b638fa9fbbb952558)
2000-11-15Tuyrn debug timestamps on by default.Jeremy Allison1-4/+16
Add Tim's lpq race fix. Jeremy. (This used to be commit d43405bc47c95bf8c906035cba23bf95d252d13b)
2000-11-14Merge from appliance head of JR's changes for driver versioning.Jeremy Allison1-8/+11
Jeremy. (This used to be commit cdbd2e99775642dc2e92004be9014bf38a92d80f)
2000-11-10Added Tim's changes to lock DB during update.Jeremy Allison1-3/+18
Jeremy. (This used to be commit f25b5798b8610de9748ae90ea1bf813b125f517d)
2000-11-10printing/nt_printing.c: use getpwuid not smbgetpwuid. Canonicalize printernames.Jeremy Allison1-0/+5
printing/printing.c: Insure fix for malloc of zero. rpc_parse/parse_misc.c: Enusre UNISTR's are zero filled. rpc_parse/parse_spoolss.c: Correct INFO_6 - differs between pre-releases of W2K and shipping build. rpc_server/srv_spoolss_nt.c: Canonicalize printernames. Jeremy. (This used to be commit b17e23a8ff2b44540726968355a4b7e26f244f3b)
2000-11-07Merge of latest round of printing fixes from appliance branch.Tim Potter1-30/+69
(This used to be commit 8fe17fd59488814cdbe9abcfe53ab2627901e421)
2000-11-04Merge from Tim - don't reinsert UNIX job if already exists.Jeremy Allison1-0/+8
Jeremy. (This used to be commit a33c395c98d80f620257fed480d5824fc609d9c9)
2000-11-04Merge of printing improvements/fixes from appliance branch.Tim Potter1-1/+60
(This used to be commit 8e163eac33e8f407de00c318d3de29fcfbf2b8a7)
2000-10-18Removed null user checks to enable lanman print queue pausing and print jobTim Potter1-4/+0
deleting. (This used to be commit e40a0e2f52326199264d622c4f11877f20e4ebce)
2000-10-11Fix for growing printing.tdb by adding check on job creation.Jeremy Allison1-17/+50
This also updates the printing.tdb db version to 2. Jeremy. (This used to be commit 13395514c632341e7be36eb9589011bb0949b075)
2000-10-11Remove lpq as root fix - do this in print_job_start insteadJeremy Allison1-28/+0
as part of print queue length processing. Jeremy. (This used to be commit e85a0fadd8dcf608822819f00f15569713518806)
2000-10-10Fixes to periodically scan printing.tdb in idle time and occasionallyJeremy Allison1-1/+42
on exit. Needed to fix printing.tdb from groving to 300Mb+ if being driven by smbclient clients that never ask for status... (effective DOS attack :-). Jeremy. (This used to be commit 6581066b93a674fadf6f9b92441428d2cc8b4a02)
2000-10-10Fixed Realloc memory fragmentation problems.Jeremy Allison1-17/+57
Jeremy. (This used to be commit 5518f59976ecac796a85db959cb9e8cc6c4d3504)
2000-10-10got rid of tdb_writelock() and instead lock a chain. tdb_writelock()Andrew Tridgell1-7/+9
is conceptually flawed (This used to be commit 6e4a3585521b7e5928298bd0f1418ff9fbcacfb4)
2000-09-13When creating a print job entry for the printing backend, use the WindowsTim Potter1-11/+21
username rather than the Unix username. The Windows username will then be shown in the port monitor regardless of the Unix username used to spool the job. (This used to be commit a15e610bb34636448cb30e590277c53e7f9efe1a)
2000-09-13Added time check test before allowing print job.Jeremy Allison1-1/+6
Jeremy. (This used to be commit 0249de4cd91d72efb344e9fb05e2be2cb3f03945)
2000-09-01Changes from APPLIANCE_HEAD (per Tim Potter):David O'Neill1-15/+15
- make proto - addition of function to convert from errno values to NT status codes (source/lib/error.c) - purge queue done without full access permission will purge only the jobs owned by that user, rather than failing. - unlock job database tdb before sending job to printer - in print_job_start(), ensure that we don't pick a jobid with an existing temporary file that may be owned by another user, as it causes silent failures. - fixes for printer permission checking for NT5 clients (source/include/rpc_spoolss.h, source/printing/nt_printing.c, source/printing/printing.c, source/rpc_server/srv_spoolss_nt.c) - change from uint8 to 'enum SID_NAME_USE' (source/rpc_server/srv_lsa.c) - fixed memory leaks for win95 driver download process (source/smbd/lanman.c) - properly free prs_structs and dacl in testsuite/printing/psec.c (This used to be commit 74af3e2caec7197e5d1ca389e2f78054a4197502)
2000-08-30Implemented AbortPrinter() from Gerald's Win32 test code. Just purge allJeremy Allison1-3/+6
possible printjobs from that printer (I think this is correct). Added error code returns for print_queue_XXX() functions. Jeremy. (This used to be commit 6d081a9017f87f59b7189ba507e211db01c40af5)
2000-08-23Tidied up some error returns from printing calls. Still need to map UNIXJeremy Allison1-1/+3
errors to NT error for print job failure returns. Patch from John Reilly at HP. Jeremy. (This used to be commit 3514b5bb8fffd78e3647425d93b74e2e6291bafc)
2000-08-09added printer admin optionAndrew Tridgell1-0/+2
any user in that list can do anything to a printer (This used to be commit 7b5912be150dd590d6195be40b0976305b8716ba)
2000-08-01Added print job substitutions for %{printername}, %{sharename} and %{portname}Jeremy Allison1-9/+16
from the NT printer tdb. Also added checks for time restrictions before allowing a job to print. Jeremy. (This used to be commit 8cfb55e81abebf0354e6d470ed68bbac1d6560ad)
2000-07-17Allow job owner to delete own print job.Tim Potter1-13/+28
(This used to be commit 90b1857c81627e587a7395ee2bdb51b26ea46512)
2000-07-10Re-instated lanman printing security checks (oops).Tim Potter1-3/+24
A user can now pause, resume or delete their own job even if they don't have the Manage Documents privilege. Added call to se_access_check() for changing printer properties. The Full Access privilege is required for the user to perform this. Several uninitialised variables and memory leaks plugged. Modified default ACL created on new printers to be Everyone / Print instead of Everyone / Full Access. This required some random stuffing around with the value of the revision field to correspond with the ACL that NT produces when setting the same permission on the printer. Fixed dodgy function call in printing/printfsp.c (This used to be commit 2abce4dcfa351051df6e5f789b34fa99c9b81c22)
2000-07-06printing/nt_printing.c: (From JF) use the driver name - already given to us.Jeremy Allison1-1/+1
printing/printing.c: priority needs to be 1 not zero (found by checked build). rpc_server/srv_spoolss_nt.c: Log invalid handle access, also print out if this is a different pid handle. This will help track down client access after a connection is closed. Jeremy. (This used to be commit 4ff949228c40b6abb2008df8db985562ac2895d2)
2000-07-06Implemented NT printer descriptor checking. Yay!Tim Potter1-14/+14
User details are passed into the printing back end from the spoolss code. For each print operation these details are checked using the se_access_check() function using information from the winbind daemon. Fixed bug in nt_printing_setsec() where the user and group SIDs were trashed if the permissions were changed from NT. It is necessary to merge these sids from the previous value of the security descriptor before storing it in the tdb. (This used to be commit 8d42661d424d80e1048d08b5cad3281643231d62)
2000-06-16Call print_access_check() function from printing back end.Tim Potter1-15/+45
(This used to be commit 979e083d3dd844b98b03108e636dfe11ae157fb0)
2000-06-03added %J and %T to run_print_command()Andrew Tridgell1-17/+25
made the run_print_command a varargs fn (This used to be commit b9f2cf459322fb3f10844f9441633c7bcd6ed151)
2000-05-24a fairly big change in spoolss.Andrew Tridgell1-1/+5
got rid of the forms, drivers and printers files in the nt drivers directory and instead use a single tdb note that this is _not_ all finished. (This used to be commit 06763d1ec2fafc42f8ee3f36f0aeacceb3a7109d)
2000-05-12While we're all making incompatible tdb changes, I changed the implementationTim Potter1-3/+3
of tdb_{store,get}_int() to store the length of the string key + 1 so the stored key contains the trailing NULL character. This allows normal string library routines to manipulate keys. Also renamed tdb_get_int() to tdb_fetch_int() to keep the set of verbs consistent. (This used to be commit a423c7c5f21dc4046530b85482dee88dcfcbf070)
2000-05-10fail a print start on a deleted auto printerAndrew Tridgell1-0/+6
(This used to be commit f1f92bf4da75ec6fccd34b07719d642196665258)
2000-05-02Added sys_fork() and sys_getpid() functions to stop the overheadJeremy Allison1-2/+2
of doing a system call every time we want to just get our pid. Jeremy. (This used to be commit 148628b616b5c29ba6340d65fc3ddbcabba6e67a)
2000-04-23check for a valid snum when running a printing commandAndrew Tridgell1-0/+5
(This used to be commit 381ddb464fd0da671d567177f1ded10f67952692)
2000-04-23split fsp specific routines out of printing.c to fix linking problemAndrew Tridgell1-65/+0
in TNG (This used to be commit 82df25b28b94b0041676fb433e0e677acb544579)
2000-04-22This is a *big* checkin that may break some things, but implements theJeremy Allison1-3/+14
new open mechanism Andrew & I discussed. config.sub: configure: Included the QNX patch. include/vfs.h: smbd/vfs-wrap.c: smbd/vfs.c: Added ftruncate vfs call (needed). Note that we will also need locking calls in the vfs (to be added). lib/util_unistr.c: nmbd/nmbd_processlogon.c: Fix for NT domain logons causing nmbd to core dump. Also fix for sidsize DOS bug. locking/locking.c: Check value of ret before using it for memdup. printing/printing.c: Convert print_fsp_open to return an allocated fsp. rpc_server/srv_lsa.c: Fix for NT domain logons. I have removed all use of lp_share_modes() from the code (although I left the parameter in the table for backwards compatibility). It no longer makes sense for this to exist. smbd/close.c: Removed lp_share_modes(). smbd/fileio.c: Fixed parameters to unlock_share_entry call in panic code. smbd/files.c: Correctly set the unix_ERR_code to ERRnofids on fsp allocation fail. smbd/nttrans.c: smbd/reply.c: smbd/trans2.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. smbd/open.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. In addition I have fixed a long standing race condition in the deny mode processing w.r.t. two smbd's creating a file. Andrew, please note that your original idea of using open with O_EXCL in this case would not work (I went over the races very carefully) and so we must re-check deny modes *after* the open() call returns. This is because there is a race between the open with O_EXCL and the lock of the share mode entry. Imagine the case where the first smbd does the open with O_EXCL and a deny mode of DENY_ALL, but is pre-empted before it locks the share modes and creates the deny mode entry for DENY_ALL. A second smbd could then come in with O_RDONLY and a deny mode of DENY_NONE and the two opens would be allowed. The *only* way to fix this race is to lock the share modes after the open and then do the deny mode checks *after* this lock in the case where the file did not originally exist. This code will need extensive testing but seems to initially work. Jeremy. (This used to be commit ab0ecc39d688f16b9692fe90b991f0b89287070a)
2000-04-19use sys_fsusage() not disk_free() in printing.cAndrew Tridgell1-3/+3
(This used to be commit 763704f78fc44976b2d977e8a08ffdeb727903c4)
2000-04-18locking/locking.c: Fixed placeholder code for POSIX locking.Jeremy Allison1-7/+7
printing/printing.c: Cast tdb_delete to (tdb_traverse_func) to stop warning. tmpfile gives mirror warning. smbd/groupname.c: Remember to file_lines_free() on exit. tdb/tdb.h: Add tdb_traverse_func typedef. Jeremy (This used to be commit 204ca1195c86499bd9beb273ce573db7a56ccead)