summaryrefslogtreecommitdiff
path: root/source3/printing/print_cups.c
AgeCommit message (Collapse)AuthorFilesLines
2011-03-04s3-printing: fix cups pcap reload with no printersDavid Disseldorp1-12/+27
cups_async_callback() is called to receive new printcap data from a child process which requests the information from cupsd. Newly received printcap information is stored in a temporary printcap cache (tmp_pcap_cache). Once the child process closes the printcap IPC file descriptor, the system printcap cache is replaced with the newly populated tmp_pcap_cache, however this only occurs if tmp_pcap_cache is non null (has at least one printer). If the printcap cache is empty, which is the case when cups is not exporting any printers, the printcap cache is not replaced resulting in stale data. https://bugzilla.samba.org/show_bug.cgi?id=7915 Signed-off-by: Andreas Schneider <asn@samba.org>
2011-03-04s3-printing: remove unneeded local_pcap_copy globalDavid Disseldorp1-36/+18
The cups local_pcap_copy global served as a temporary buffer during asynchronous cups printcap cache updates, as well as indicating when the printcap cache had not yet been filled and printcap cache update should block. As smbd printcap reads are now triggered by the parent smbd following printcap cache update, the variable and blocking mechanism are no longer needed. Signed-off-by: Andreas Schneider <asn@samba.org>
2011-01-07s3-printing: remove old entries in pcap_cache_replaceDavid Disseldorp1-6/+5
Callers of pcap_cache_replace() assume the existing printcap cache is replaced by the new values provided. This is not currently the case, old entries should be removed.
2011-01-07s3-printing: reload shares after pcap cache fillDavid Disseldorp1-8/+32
Since commit eada8f8a, updates to the cups pcap cache are performed asynchronously - cups_cache_reload() forks a child process to request cups printer information and notify the parent smbd on completion. Currently printer shares are reloaded immediately following the call to cups_cache_reload(), this occurs prior to smbd receiving new cups pcap information from the child process. Such behaviour can result in stale print shares as outlined in bug 7836. This fix ensures print shares are only reloaded after new pcap data has been received. Pair-Programmed-With: Lars Müller <lars@samba.org>
2010-08-16s3-printing: Lift the use of smbd_server_fd from job_submit.Volker Lendecke1-8/+1
Signed-off-by: Andreas Schneider <asn@samba.org>
2010-08-16s3: Remove get_client_fd()Volker Lendecke1-2/+2
2010-08-08s3: Remove the smbd_messaging_context from cups_cache_reloadVolker Lendecke1-7/+5
2010-08-08s3: Remove the smbd_messaging_context from cups_pcap_load_asyncVolker Lendecke1-5/+7
2010-07-04s3: Pass the new server_id through reinit_after_forkVolker Lendecke1-2/+5
2010-06-13s3: Remove the pointless PRINTERNAME macroVolker Lendecke1-9/+18
2010-06-10s3:misc make use of server_[event/messaging]_context directlyAndreas Schneider1-4/+4
Untangle these functions from smbd specific dependencies so they can be freely used in multiple servers.
2010-05-14s3-printing: explicitly include "printing/pcap.h" as there is ↵Günther Deschner1-1/+1
/usr/include/pcap.h. Thanks metze for pointing this out. Simo, please check. Guenther
2010-05-14Make pcap headers privateSimo Sorce1-0/+1
Signed-off-by: Günther Deschner <gd@samba.org>
2010-03-26s3-printing: avoid mixing cups backend code with nt_printing code in ↵Günther Deschner1-21/+14
cups_pull_comment_location. Guenther
2010-03-25Fix bug #7288 - SMB job IDs in CUPS job names wrong.Jeremy Allison1-1/+10
Based on a patch from Michael Karcher <samba@mkarcher.dialup.fu-berlin.de>. I think this is the correct fix. It causes cups_job_submit to use print_parse_jobid(), which I've moved into printing/lpq_parse.c (to allow the link to work). It turns out the old print_parse_jobid() was *broken*, in that the pjob filename was set as an absolute path - not relative to the sharename (due to it not going through the VFS calls). This meant that the original code doing a strncmp on the first part of the filename would always fail - it starts with a "/", not the relative pathname of PRINT_SPOOL_PREFIX ("smbprn."). This fix could fix some other mysterious printing bugs - probably the ones Guenther noticed where job control fails on non-cups backends. Guenther PLEASE CHECK ! Jeremy.
2010-03-24Fix bug #7269 - Job management commands don't work for CUPS queues.Michael Karcher1-1/+9
Samba needs to retrieve pjob->sysjob from the CUPS response (as is done in the iprint backend).
2010-02-23s3-print: Remove obsolete signal type cast.Andreas Schneider1-3/+3
2009-06-19Fix coverity #740. Resource leak in error paths. We shouldJeremy Allison1-3/+2
always return queue here as the caller will free. Jeremy.
2009-05-27s3: Allow child processes to exit gracefully if we are out of fdsMarc VanHeyningen1-2/+2
When we run out of file descriptors for some reason, every new connection forks a child that immediately panics causing smbd to coredump. This seems unnecessarily harsh; with this code change we now catch that error and merely log a message about it and exit without the core dump. Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-03-30s3/cups: add encryption supportBjörn Jacke1-0/+5
2009-02-13Fix Coverity ID 740 (RESOURCE_LEAK)Volker Lendecke1-0/+2
2009-01-05Attempt to fix crash seen with new CUPS async printcap loading code.Jeremy Allison1-0/+3
Jeremy.
2009-01-05clean event context after child is forked.Bo Yang1-1/+2
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2008-12-30Fix a memory leak in cups_pull_comment_locationVolker Lendecke1-0/+4
We allocated "request" with ippNew, so we also should ippDelete it.
2008-10-10Initialize near creation of resource. Makes code clearer.Jeremy Allison1-0/+2
Jeremy.
2008-10-10Ensure we do reinit_after_fork().Jeremy Allison1-0/+5
Jeremy.
2008-10-10Allow data flow to be debugged and only log on error. All seems ok now.Jeremy Allison1-8/+40
Jeremy.
2008-10-10Async is trickier than it looks :-). Don't use a stack variable for a ↵Jeremy Allison1-6/+18
private data ptr. Jeremy.
2008-10-10If you have a large number of cups printers, then scanning for print info ↵Jeremy Allison1-3/+208
can cause a client to timeout (it takes longer than 30 seconds to enumerate them). Make scanning for printers async with a callback from the main loop. This fixes a bug that was irritating *me* :-). Jeremy.
2008-10-02Don't reject a successful alloc :-(.Jeremy Allison1-1/+1
Jeremy.
2008-10-01Fix bug #5080. Access to cups-printers via samba broken with cups 1.3.4, ↵Jeremy Allison1-90/+251
Unsupported character set. Cups 1.3.4 expects utf8 to be used in all messages to/from the server. We may be using a different character set so we need to use talloc utf8 push/pull functions in all communication. Needs more testing. Don't release until I've done a thorough test. I also have a version for 3.2.x. Jeremy.
2008-10-01Whitespace cleanup.Jeremy Allison1-16/+16
Jeremy.
2008-09-24printing: Rename new parameter "cups timeout" to "cups connection timeout".Karolin Seeger1-1/+1
Karolin
2008-09-23printing: Add new parameter "cups timeout".Karolin Seeger1-6/+28
The default timeout for connections to CUPS servers is set to 5 minutes in the CUPS libraries. The smbd hangs on startup until the timeout is reached if the CUPS server is unreachable. This parameter makes the timeout configurable. The default value is set to 30 seconds. Karolin
2007-11-27Remove pstring from srv_spoolss_nt.c. All gone from rpc_server/*.cJeremy Allison1-1/+3
Jeremy. (This used to be commit b5a2a1e3f82a0d319fc9a1d76f5166150680f4d4)
2007-11-21Remove pstring from printing/*.c except for theJeremy Allison1-4/+8
tdb_unpack requirement (I'll be making that an allocating interface later). Jeremy. (This used to be commit d2ee75326ac291ab4f1860075ba35f58703c7d9d)
2007-11-03Remove most of the remaining globals out of lib/util_sock.c.Jeremy Allison1-2/+2
I have a plan for dealing with the remaining..... Watch this space. Jeremy. (This used to be commit 963fc7685212689f02b3adcc05b4273ee5c382d4)
2007-11-03I can't get away without a 'length' arg. :-).Jeremy Allison1-1/+1
Jeremy. (This used to be commit 95d01279a5def709d0a5d5ae7224d6286006d120)
2007-11-03Stop get_peer_addr() and client_addr() from using globalJeremy Allison1-1/+2
statics. Part of my library cleanups. Jeremy. (This used to be commit e848506c858bd16706c1d7f6b4b032005512b8ac)
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-4/+4
bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
2007-10-11Add const to the get_peer_addr() and get_socket_addr()Jeremy Allison1-1/+1
calls. Use the IPv6 varient for get_peer_addr(). Jeremy. (This used to be commit baf1f52e34ae2465a7a34be1065da29ed97e7bea)
2007-10-10r23801: The FSF has moved around a lot. This fixes their Mass Ave address.Andrew Tridgell1-2/+1
(This used to be commit 87c91e4362c51819032bfbebbb273c52e203b227)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r21958: Fix Coverity ID 343 (dead code)Volker Lendecke1-3/+0
(This used to be commit 6d093043ed437c1de6f9a50013d9bd84c75cf3ff)
2007-10-10r21861: Pull the comment and location from CUPS if we don't have oneGerald Carter1-0/+139
when fetching a printer from ntprinters.tdb. Slightly modified from original version submitted on samba-technical ml by Andy Polyakov <appro@fy.chalmers.se> (This used to be commit e859e1fdcd13c55746a53b5de4a02a3278f41815)
2007-10-10r20245: merge 20244 from samba_3_0_24Herb Lewis1-2/+1
get rid of more nested extern declarations warnings (This used to be commit e9df051f5201843e3428ddbed7a719553c2e799a)
2007-10-10r20131: get rid of a few no previous prototype warningsHerb Lewis1-0/+1
(This used to be commit e710a7d39a662a1a339f3f71c4b051fde1bb5a16)
2007-10-10r17816: Merge my cupsprot branch. It is now possible to (optionally) specify ↵Jelmer Vernooij1-31/+37
:port in the "cups server" smb.conf parameter. (This used to be commit 3f665f4ec4cda80cc20e050458e150c086dc1412)
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-5/+2
realloc can return NULL in one of two cases - (1) the realloc failed, (2) realloc succeeded but the new size requested was zero, in which case this is identical to a free() call. The error paths dealing with these two cases should be different, but mostly weren't. Secondly the standard idiom for dealing with realloc when you know the new size is non-zero is the following : tmp = realloc(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } However, there were *many* *many* places in Samba where we were using the old (broken) idiom of : p = realloc(p, size) if (!p) { return error; } which will leak the memory pointed to by p on realloc fail. This commit (hopefully) fixes all these cases by moving to a standard idiom of : p = SMB_REALLOC(p, size) if (!p) { return error; } Where if the realloc returns null due to the realloc failing or size == 0 we *guarentee* that the storage pointed to by p has been freed. This allows me to remove a lot of code that was dealing with the standard (more verbose) method that required a tmp pointer. This is almost always what you want. When a realloc fails you never usually want the old memory, you want to free it and get into your error processing asap. For the 11 remaining cases where we really do need to keep the old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR, which can be used as follows : tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the pointer p, even on size == 0 or realloc fail. All this is done by a hidden extra argument to Realloc(), BOOL free_old_on_error which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR macros (and their array counterparts). It remains to be seen what this will do to our Coverity bug count :-). Jeremy. (This used to be commit 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
2007-10-10r10656: BIG merge from trunk. Features not copied overGerald Carter1-3/+3
* \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3)