1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

97 Commits

Author SHA1 Message Date
Andrew Bartlett
d5e6a47f06 s3-talloc Change TALLOC_P() to talloc()
Using the standard macro makes it easier to move code into common, as
TALLOC_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andreas Schneider
01bc556d03 s3-printing: Remove obsolete and unused cups_pull_comment_location().
Signed-off-by: Günther Deschner <gd@samba.org>
2011-05-16 12:54:33 +02:00
Günther Deschner
854467851d s3-printing: Get the location info from cups.
Signed-off-by: Günther Deschner <gd@samba.org>
2011-05-16 12:54:33 +02:00
Günther Deschner
f99d6f079a s3-printing: make cups_pull_comment_location() work again.
we deal with lp_cups_server in cups_connect() already, inside the URI all our
other cups functions we use ipp://localhost, do the same here.

Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed May 11 11:36:07 CEST 2011 on sn-devel-104
2011-05-11 11:36:07 +02:00
Günther Deschner
019f11dd5b s3-printing: Fix double free of cups request.
We never free the request in our cups api usage except for here. The reason is
probably htis (from the cupsDoConnect API docs):

"This function sends the IPP request to the specified server, retrying and
authenticating as necessary. The request is freed with ippDelete() after
receiving a valid IPP response."

Revert "Fix a memory leak in cups_pull_comment_location"

This reverts commit fee2664dad.

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Tue May 10 17:32:58 CEST 2011 on sn-devel-104
2011-05-10 17:32:58 +02:00
Günther Deschner
3ba3f68e03 s3-printing: very obvious fix for cups_pull_comment_location().
This has been in there since 2008...

Guenther
2011-05-10 16:30:28 +02:00
Jeremy Allison
644046f064 Fix compiler warning in debug message. 2011-04-21 17:22:44 -07:00
David Disseldorp
97cdf15f09 s3-printing: fix memory leak in print_cups.c
As found by valgrind, tmp_pcap_cache is not freed following printer list
tdb update.

Signed-off-by: Andreas Schneider <asn@samba.org>

Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Wed Mar 16 16:37:58 CET 2011 on sn-devel-104
2011-03-16 16:37:58 +01:00
David Disseldorp
52845c1054 s3-printing: remove duplicate cups response processing code
There is currently a lot of duplicate code included for processing
responses to CUPS_GET_PRINTERS and CUPS_GET_CLASSES requests. This
change splits this code into a separate function.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-03-16 15:52:21 +01:00
David Disseldorp
d6cb4feae1 s3-printing: use printcap IDL for IPC
Use printcap IDL for marshalling and unmarshalling messages between cups
child and parent smbd processes. This simplifies the IPC and ensures
the parent is notified of cups errors encountered by the child.

https://bugzilla.samba.org/show_bug.cgi?id=7994
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-03-16 15:52:21 +01:00
David Disseldorp
2b635949a2 s3-printing: fix cups pcap reload with no printers
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-04 15:46:23 +01:00
David Disseldorp
624e33f869 s3-printing: remove unneeded local_pcap_copy global
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-03-04 15:46:20 +01:00
David Disseldorp
ff577762b9 s3-printing: remove old entries in pcap_cache_replace
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-07 15:37:39 -08:00
David Disseldorp
04248c2cfa s3-printing: reload shares after pcap cache fill
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>
2011-01-07 15:37:39 -08:00
Volker Lendecke
d418f9f11a s3-printing: Lift the use of smbd_server_fd from job_submit.
Signed-off-by: Andreas Schneider <asn@samba.org>
2010-08-16 14:02:19 +02:00
Volker Lendecke
96ae457023 s3: Remove get_client_fd() 2010-08-16 13:13:10 +02:00
Volker Lendecke
795589b4f8 s3: Remove the smbd_messaging_context from cups_cache_reload 2010-08-08 23:37:47 +02:00
Volker Lendecke
83045b1ba9 s3: Remove the smbd_messaging_context from cups_pcap_load_async 2010-08-08 23:37:47 +02:00
Volker Lendecke
7f0e6df883 s3: Pass the new server_id through reinit_after_fork 2010-07-04 17:29:23 +02:00
Volker Lendecke
3f7e2222f4 s3: Remove the pointless PRINTERNAME macro 2010-06-13 12:40:27 +02:00
Andreas Schneider
0962763822 s3:misc make use of server_[event/messaging]_context directly
Untangle these functions from smbd specific dependencies so they can be freely
used in multiple servers.
2010-06-10 17:30:45 -04:00
Günther Deschner
a052aa87be s3-printing: explicitly include "printing/pcap.h" as there is /usr/include/pcap.h.
Thanks metze for pointing this out. Simo, please check.

Guenther
2010-05-14 14:41:50 +02:00
Simo Sorce
348b4b9bab Make pcap headers private
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-14 14:15:08 +02:00
Günther Deschner
3da91b786e s3-printing: avoid mixing cups backend code with nt_printing code in cups_pull_comment_location.
Guenther
2010-03-26 14:36:46 +01:00
Jeremy Allison
c79ca41baf Fix bug #7288 - SMB job IDs in CUPS job names wrong.
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-25 17:36:47 -07:00
Michael Karcher
845c2281c7 Fix bug #7269 - Job management commands don't work for CUPS queues.
Samba needs to retrieve pjob->sysjob from the CUPS response (as
is done in the iprint backend).
2010-03-24 17:33:21 -07:00
Andreas Schneider
d9f31fea6a s3-print: Remove obsolete signal type cast. 2010-02-23 12:23:42 +01:00
Jeremy Allison
271d09f599 Fix coverity #740. Resource leak in error paths. We should
always return queue here as the caller will free.
Jeremy.
2009-06-19 17:20:00 -07:00
Marc VanHeyningen
a4887e250b s3: Allow child processes to exit gracefully if we are out of fds
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-05-27 13:16:17 -07:00
Björn Jacke
4b184eaea1 s3/cups: add encryption support 2009-03-30 11:11:19 +02:00
Volker Lendecke
ad07bb8dbd Fix Coverity ID 740 (RESOURCE_LEAK) 2009-02-13 21:55:10 +01:00
Jeremy Allison
1f8b6238dd Attempt to fix crash seen with new CUPS async printcap loading code.
Jeremy.
2009-01-05 13:47:34 -08:00
Bo Yang
022e2f8199 clean event context after child is forked.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-01-05 15:07:31 +01:00
Volker Lendecke
fee2664dad Fix a memory leak in cups_pull_comment_location
We allocated "request" with ippNew, so we also should ippDelete it.
2008-12-30 15:59:25 +01:00
Jeremy Allison
47f7ef8f39 Initialize near creation of resource. Makes code clearer.
Jeremy.
2008-10-10 16:48:18 -07:00
Jeremy Allison
1d151b3161 Ensure we do reinit_after_fork().
Jeremy.
2008-10-10 16:43:13 -07:00
Jeremy Allison
4cbb3b23a4 Allow data flow to be debugged and only log on error. All seems ok now.
Jeremy.
2008-10-10 16:29:14 -07:00
Jeremy Allison
430cc44390 Async is trickier than it looks :-). Don't use a stack variable for a private data ptr.
Jeremy.
2008-10-10 15:55:49 -07:00
Jeremy Allison
eada8f8abe If you have a large number of cups printers, then scanning for print info 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-10 11:55:14 -07:00
Jeremy Allison
e0dbac6873 Don't reject a successful alloc :-(.
Jeremy.
2008-10-02 12:21:11 -07:00
Jeremy Allison
3bfb53caa8 Fix bug #5080. Access to cups-printers via samba broken with cups 1.3.4, 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-01 16:40:41 -07:00
Jeremy Allison
ea85ceefa9 Whitespace cleanup.
Jeremy.
2008-10-01 15:01:05 -07:00
Karolin Seeger
9cf1a68977 printing: Rename new parameter "cups timeout" to "cups connection timeout".
Karolin
2008-09-24 11:09:04 -07:00
Karolin Seeger
765e5d2282 printing: Add new parameter "cups timeout".
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
2008-09-23 16:57:58 -07:00
Jeremy Allison
0bc4ff7b28 Remove pstring from srv_spoolss_nt.c. All gone from rpc_server/*.c
Jeremy.
(This used to be commit b5a2a1e3f8)
2007-11-27 19:05:08 -08:00
Jeremy Allison
01acd4bb38 Remove pstring from printing/*.c except for the
tdb_unpack requirement (I'll be making that an
allocating interface later).
Jeremy.
(This used to be commit d2ee75326a)
2007-11-21 13:56:36 -08:00
Jeremy Allison
5b0b4f23ef Remove most of the remaining globals out of lib/util_sock.c.
I have a plan for dealing with the remaining..... Watch
this space.
Jeremy.
(This used to be commit 963fc76852)
2007-11-03 23:20:10 -07:00
Jeremy Allison
25074433f4 I can't get away without a 'length' arg. :-).
Jeremy.
(This used to be commit 95d01279a5)
2007-11-03 18:41:26 -07:00
Jeremy Allison
6658165d5e Stop get_peer_addr() and client_addr() from using global
statics. Part of my library cleanups.
Jeremy.
(This used to be commit e848506c85)
2007-11-03 18:15:45 -07:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
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 f35a266b3c)
2007-10-18 17:40:25 -07:00