summaryrefslogtreecommitdiffstats
path: root/source3/printing
Commit message (Collapse)AuthorAgeFilesLines
* printing: increse log level for unreachable cups serversBjörn Jacke2015-03-051-2/+2
| | | | | | | | | | | | | this annoying messages hitting the logs very often on non-cups servers by default in log level 0 otherwise. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11133 Signed-off-by: Bjoern Jacke <bj@sernet.de> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): Björn Jacke <bj@sernet.de> Autobuild-Date(master): Thu Mar 5 14:38:42 CET 2015 on sn-devel-104
* printing: rework nt_printer_guid_store to return errorsAndreas Schneider2015-02-181-17/+32
| | | | | | | | | | | Callers can now choose whether or not to ignore errors. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11018 Pair-programmed-with: David Disseldorp <ddiss@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* printing: add nt_printer_guid_retrieve() helperDavid Disseldorp2015-02-181-0/+58
| | | | | | | | | | | | This function connects to the domain controller and retrieves the GUID for the corresponding printer DN. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11018 Pair-programmed-with: Andreas Schneider <asn@samba.org> Signed-off-by: David Disseldorp <ddiss@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* printing: split out printer DN and GUID retrievalDavid Disseldorp2015-02-181-72/+137
| | | | | | | | | | | This functions are used for printer publishing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11018 Pair-programmed-with: Andreas Schneider <asn@samba.org> Signed-off-by: David Disseldorp <ddiss@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* printing/cups: pack requested-attributes with IPP_TAG_KEYWORDDavid Disseldorp2015-02-101-1/+1
| | | | | | | | | | | | | | | | | | The CUPS IPP_GET_JOBS requested-attributes array indicates which job attributes the caller would like in the cupsd response. Until now, Samba has packed these attributes with a IPP_TAG_NAME format tag. In recent versions of CUPS, this results in the IPP_GET_JOBS response only including the job-id and job-printer-uri fields, even with JobPrivateValues=none configured. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10808 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Feb 10 01:38:58 CET 2015 on sn-devel-104
* lib: Split out write_data[_iov]Volker Lendecke2014-12-071-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Split out sys_[read|write] & friendsVolker Lendecke2014-12-071-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:vfs: add create tags to SMB_VFS_CREATEFILERalph Boehme2014-12-041-3/+6
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:printing: fix some const warnings in print_iprint.cStefan Metzmacher2014-11-251-6/+6
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:printing: Avoid compiler warning about unused labelKai Blin2014-11-251-0/+4
| | | | | | Signed-off-by: Kai Blin <kai@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printer_list: don't leak lock_path onto talloc tosDavid Disseldorp2014-11-031-2/+9
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* nt_printing: don't leak state_path onto talloc tosDavid Disseldorp2014-11-032-30/+80
| | | | | | | | Also check for allocation failures, and close tdbs in nt_printing_tdb_upgrade error paths. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: add jobid_to_sysjob helper functionDavid Disseldorp2014-10-301-18/+52
| | | | | | | | | | | | Samba needs to deal with two types of print job identifiers, those allocated by the printing backend (sysjob ids), and those allocated by Samba's spoolss server (jobids). This change adds a helper function to map spoolss jobids to sysjob ids, to go alongside the corresponding sysjob to jobid mapping function. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printer_list: fix talloc tos leak of tdb recordDavid Disseldorp2014-10-071-0/+1
| | | | | | | | | Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Oct 7 19:25:09 CEST 2014 on sn-devel-104
* printing: don't leak cache_path onto talloc tosDavid Disseldorp2014-10-062-5/+25
| | | | | | | | Also check for allocation failures. Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs3: Pass "lease" through SMB_VFS_CREATE_FILEVolker Lendecke2014-08-111-0/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: split printer reload processingDavid Disseldorp2014-08-081-3/+97
| | | | | | | | | | | | | | | | | | | | All printer inventory updates are currently done via delete_and_reload_printers(), which handles registry.tdb updates for added or removed printers, AD printer unpublishing on removal, as well as share service creation and deletion. This change splits this functionality into two functions such that per-client smbd processes do not perform registry.tdb updates or printer unpublishing. This is now only performed by the process that performs the printcap cache update. This change is similar to ac6604868d1325dd4c872dc0f6ab056d10ebaecf from the 3.6 branch. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* printing: return last change time with pcap_cache_loaded()David Disseldorp2014-08-085-7/+13
| | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* printing: remove pcap_cache_add()David Disseldorp2014-08-082-11/+6
| | | | | | | | | | All print list updates are now done via pcap_cache_replace(), which can call into the print_list code directly. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* printing: reload printer_list.tdb from in memory listDavid Disseldorp2014-08-086-34/+52
| | | | | | | | | This will allow in future for a single atomic printer_list.tdb update. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* printing: only reload printer shares on client enumDavid Disseldorp2014-08-081-29/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, automatic printer share updates are handled in the following way: - Background printer process (BPP) forked on startup - Parent smbd and per-client children await MSG_PRINTER_PCAP messages - BPP periodically polls the printing backend for printcap data - printcap data written to printer_list.tdb - MSG_PRINTER_PCAP sent to all smbd processes following update - smbd processes all read the latest printer_list.tdb data, and update their share listings This procedure is not scalable, as all smbd processes hit printer_list.tdb in parallel, resulting in a large spike in CPU usage. This change sees smbd processes only update their printer share lists only when a client asks for this information, e.g. via NetShareEnum or EnumPrinters. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652 Suggested-by: Volker Lendecke <vl@samba.org> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* printing: traverse_read the printer list for share updatesDavid Disseldorp2014-08-085-12/+17
| | | | | | | | | | | | | | | | | | | | | | | The printcap update procedure involves the background printer process obtaining the printcap information from the printing backend, writing this to printer_list.tdb, and then notifying all smbd processes of the new list. The processes then all attempt to simultaneously traverse printer_list.tdb, in order to update their local share lists. With a large number of printers, and a large number of per-client smbd processes, this traversal results in significant lock contention, mostly due to the fact that the traversal is unnecessarily done with an exclusive (write) lock on the printer_list.tdb database. This commit changes the share update code path to perform a read-only traversal. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652 Reported-by: Alex K <korobkin+samba@gmail.com> Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib: directory_create_or_exist() does not use "uid" parameterVolker Lendecke2014-07-282-5/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Avoid double-free in get_print_db_bynameVolker Lendecke2014-07-081-2/+2
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Tue Jul 8 22:27:03 CEST 2014 on sn-devel-104
* printing: fix purge of all print jobsDavid Disseldorp2014-05-211-4/+19
| | | | | | | | | | | The incorrect (system) jobid is currently passed to the job deletion function. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10612 Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing_cups: Call the msg_ctx destructor on exitVolker Lendecke2014-04-231-0/+1
| | | | | | | | With the new messaging, if we don't do this, we'll leave sockets around. I'm sure we will not catch everything, so a periodic cleanup will be required. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3-spoolssd: Don't register spoolssd if epmd is not running.Andreas Schneider2014-02-271-17/+22
| | | | | | | https://bugzilla.samba.org/show_bug.cgi?id=10474 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3-printing: Fix obvious memory leak in printer_list_get_printer().Jeremy Allison2014-02-251-0/+1
| | | | | | | | | | | https://bugzilla.samba.org/show_bug.cgi?id=9993 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ira Cooper <ira@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Feb 25 13:19:37 CET 2014 on sn-devel-104
* s3:printing: Fix a possible NULL dereference.Poornima Gurusiddaiah2014-02-241-1/+1
| | | | | | | | Coverity-Id: 710708 Signed-off-by: Poornima Gurusiddaiah <pgurusid@redhat.com> Reviewed-by: Ira Cooper <ira@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* spoolssd: Use only one messaging_context per processVolker Lendecke2014-02-191-1/+1
| | | | | | | | | After the fork, the code created a fresh messaging_context before doing the reinit_after_fork. This means to have two initialized messaging contexts in that process. This patch aligns spoolssd with lsad. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: printing: Fix problem with server taking too long to respond to a ↵Jeremy Allison2014-02-182-2/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MSG_PRINTER_DRVUPGRADE message. Receiving a MSG_PRINTER_DRVUPGRADE causes smbd to iterate over all printers looking for ones that uses the driver. This is a very expensive operation requiring a read of all registry printer parameters. On a system with a large number of printers, this causes the clients to timeout (smbd can take longer than 60 seconds to respond). This patch fixes the problem by forwarding the MSG_PRINTER_DRVUPGRADE to the background lpq queue updater process and allowing it to take care of the updating of the changeid in the registry, allowing the smbd connected to the client to return to processing requests immediately. https://bugzilla.samba.org/show_bug.cgi?id=9942 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Feb 18 17:48:30 CET 2014 on sn-devel-104
* param: rename lp function and variable from "minprintspace" to "min_print_space"Garming Sam2014-02-071-2/+2
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "queueresumecommand" to ↵Garming Sam2014-02-071-1/+1
| | | | | | | | "queueresume_command" Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "queuepausecommand" to ↵Garming Sam2014-02-071-1/+1
| | | | | | | | "queuepause_command" Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "printcommand" to "print_command"Garming Sam2014-02-071-1/+1
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "max_reported_jobs" to ↵Garming Sam2014-02-071-2/+2
| | | | | | | | "max_reported_print_jobs" Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "lprmcommand" to "lprm_command"Garming Sam2014-02-071-2/+2
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "lpresumecommand" to ↵Garming Sam2014-02-071-1/+1
| | | | | | | | "lpresume_command" Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "lpqcommand" to "lpq_command"Garming Sam2014-02-071-2/+2
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "lpqcachetime" to "lpq_cache_time"Garming Sam2014-02-071-2/+2
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* param: rename lp function and variable from "lppausecommand" to ↵Garming Sam2014-02-071-1/+1
| | | | | | | | "lppause_command" Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap: add a dbwrap_flags argument to db_open()Michael Adam2014-02-071-1/+2
| | | | | | | | | | This is in preparation to support handing flags to backends, in particular activating read only record support for ctdb databases. For a start, this does nothing but adding the parameter, and all databases use DBWRAP_FLAG_NONE. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* loadparm: rename lp[cfg]_print_ok to lp[cfg]_printable for consistency with docsMichael Adam2014-02-034-7/+7
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* loadparm: rename lp[cfg]_pathname to lp[cfg]_path for consistency with docsMichael Adam2014-02-033-10/+10
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* s3:printing fix a compiler warningChristian Ambach2013-12-121-1/+1
| | | | | | | about a potentially uninitialized variable Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: use DEBUG instead of sys_adminlogDavid Disseldorp2013-11-201-24/+12
| | | | | | | | sys_adminlog() is another syslog wrapper. Use DEBUG(0, ...) instead, which offers the same syslog(LOG_ERR) behaviour. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* printing: fix double space in debug statementDavid Disseldorp2013-11-201-1/+1
| | | | | Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* printing: return WERROR from print_access_checkDavid Disseldorp2013-11-202-56/+47
| | | | | | | | | | print_access_check() currently returns a bool based on whether access is granted or denied. Errno is set on failure, but none of the callers use it. This change converts print_access_check() to return a WERROR. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* printing: always store sytem job-ID in queue stateDavid Disseldorp2013-11-181-21/+22
| | | | | | | | | | | | | | | | | | | Print jobs have multiple identifiers: the regular spoolss jobid, which is allocated by spoolss on job submission, and the system jobid, which is assigned by the printing back-end. Currently these identifiers are incorrectly mixed in print job queue tracking. Fix this by ensuring that only the system jobid is stored in the print queue state structure. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10271 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Mon Nov 18 18:03:41 CET 2013 on sn-devel-104
* spoolss: return the spoolss job ID in notificationsDavid Disseldorp2013-11-181-1/+1
| | | | | | | | | | | | | | | | | Print job notifications currently carry the system print job identifier from the queue structure. Instead, the spoolss job identifier should be resolved and returned. Print clients can use notification job-ids in subsequent spoolss SetJob requests. Returning an incorrect identifier can result in the failure of such requests, e.g. spoolss_SetJob(SPOOLSS_JOB_CONTROL_DELETE). BUG: https://bugzilla.samba.org/show_bug.cgi?id=10271 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>