summaryrefslogtreecommitdiff
path: root/source3/printing/printing.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Add get_current_user_info_domain()Volker Lendecke2022-12-121-3/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:printing: Do not clear the printer-list.tdbAndreas Schneider2022-06-301-4/+0
| | | | | | | | | | | | | | | | | | | | | | With the new dcerpc architecture we need to keep printer-list.tdb around. A spoolss dcerpc call will start rpc-spoolssd which will then start the background queue process. However in order to enum the printers we need have a printer-list.tdb. Depending on the number of printers this task can take several seconds. It is unlinkly that the printer-list will change all the time, so we might provide outdated data till it gets refreshed, but this is better than providing no printer list at all. If there are a lot of printers, the idle_seconds for the rpc-spoolssd should be increased so that the background task can finish. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15082 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Jun 30 22:08:39 UTC 2022 on sn-devel-184
* smbd: fd_handle.h does not need includes.hVolker Lendecke2022-04-261-0/+1
| | | | | | | | | Move includes.h for struct files_struct to fd_handle.c. Both printing.c and smb1_utils.c depended on fd_handle.h to include the prototypes. Do that explicitly in those files. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* source3: move lib/substitute.c functions out of proto.hRalph Boehme2021-11-111-0/+1
| | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14897 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* printing: Factor out remove_from_jobs_list()Volker Lendecke2021-06-041-54/+13
| | | | | | | | remove_from_jobs_changed() and remove_from_jobs_added() only differed by the keystr. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: Simplify pack_devicemode()Volker Lendecke2021-06-041-3/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: Avoid a few references to background_lpq_updater_pidVolker Lendecke2021-05-111-4/+1
| | | | | | | | | | We have the bgqd in the pidfile now Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue May 11 23:45:21 UTC 2021 on sn-devel-184
* printing: Consolidate add_to_jobs_list()Volker Lendecke2021-05-111-31/+16
| | | | | | | | add_to_jobs_changed() and add_to_jobs_added() only differed in the key string. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: Remove code to upgrade from before b0909cfa14fVolker Lendecke2021-03-241-7/+0
| | | | | | | | | | I think even back then "printing.tdb" would have just been a stale tdb that would have been better handled externally. It might have been a product requirement back then, but I think a startup script and not core code might have been a better choice to handle this. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: Move rap2jobid functions to their own fileVolker Lendecke2021-03-161-143/+1
| | | | | | | This will make it easier to split out the spoolss functions later Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: Introduce printer_list_printername_exists()Volker Lendecke2021-03-161-1/+2
| | | | | | | | | | | Replace pcap_printername_ok(). Slightly different semantics: If the printer list db has a corrupted record, this is not detected. Why this patch? pcap_printername_ok() is a simple wrapper around the tdb accessing function, and this reduces a dependency on pcap.c Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: give global_contexts.c its own header fileVolker Lendecke2021-01-081-0/+1
| | | | | | | | | It's a bit shocking how many references we have to global contexts. Make this a bit more obvious. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: safe_string: do not include string_wrappers.hMatthew DeVore2020-08-281-0/+1
| | | | | | | | | | | | | Rather than have safe_string.h #include string_wrappers.h, make users of string_wrappers.h include it explicitly. includes.h now no longer includes string_wrappers.h transitively. Still allow includes.h to #include safe_string.h for now so that as many modules as possible get the safety checks in it. Signed-off-by: Matthew DeVore <matvore@google.com> Reviewed-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:param: make "servicename" a substituted optionRalph Boehme2019-11-271-4/+6
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbdotconf: mark "printername" with substitution="1"Ralph Boehme2019-11-271-7/+19
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbdotconf: mark "path" with substitution="1"Ralph Boehme2019-11-271-4/+10
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:printing: Fix %J substitionRalph Boehme2019-11-071-4/+4
| | | | | | | | | | | | | | | | | | | | | print_run_command() uses lp_print_command() which internally performs basic substition by calling talloc_sub_basic(). As a result. any of the variables in the "basic set", including "%J" are already substituted. To prevent the unwanted subtitution, we declare all affected configuration options as const, which disabled the basic substition. As a result print_run_command() can run manual substitution on all characters, including %J, in the variadic argument list *before* calling lp_string() to run basic substition which we had disabled before with the const. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Nov 7 16:01:21 UTC 2019 on sn-devel-184
* s3: rename talloc_sub_advanced() to talloc_sub_full()Ralph Boehme2019-11-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently have the following substitution functions: talloc_sub_basic() talloc_sub_advanced() talloc_sub_basic() currently substitutes a subset of talloc_sub_advanced(). We'll need a function X that only substitutes what talloc_sub_advanced() substitutes *without* what talloc_sub_basic() does. To get there rename talloc_sub_advanced() to talloc_sub_full(). A subsequent commit will then bring back talloc_sub_advanced() as described above. Examples with fictional replacement letters A and B. Currently: talloc_sub_basic: A talloc_sub_advanced: AB New: talloc_sub_basic: A talloc_sub_advanced: B talloc_sub_full: AB BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3: replace standard_sub_advanced with talloc_sub_advanced in one placeRalph Boehme2019-11-071-4/+10
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3:printing: fix a long lineRalph Boehme2019-11-071-1/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tdb_unpack: Correct "len" arg for "B" formatVolker Lendecke2018-10-081-1/+1
| | | | | | | | | | | | All but one of the users of the "B" format specifier passed in a pointer to uint32_t instead of what tdb_unpack expected, an "int". Because this is a purely internal API, change the tdb_unpack function and adjust that one caller. To reviewers: Please check carefully, thanks :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: Rename server_event_context() to global_event_context()Christof Schmitt2018-09-071-14/+14
| | | | | | | | | | | This reflects that the event context is also used outside of the server processes. The command used for the rename: find . -name '*.[hc]' -print0 | xargs -0 sed -i 's/server_event_context/global_event_context/' Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Pass mem_ctx to cache_path()Volker Lendecke2018-08-171-2/+2
| | | | | | | | | | | Fix a confusing API: Many places TALLOC_FREE the path where it's not clear you have to do it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Aug 17 14:28:51 CEST 2018 on sn-devel-144
* s3-printing: fix format-truncation in print_queue_update()Günther Deschner2018-05-171-1/+1
| | | | | | | | | | | | | | | | ../source3/printing/printing.c: In function ‘print_queue_update’: ../source3/printing/printing.c:1809:42: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 244 [-Werror=format-truncation=] snprintf(key, sizeof(key), "MSG_PENDING/%s", sharename); ^~ ~~~~~~~~~ ../source3/printing/printing.c:1809:2: note: ‘snprintf’ output between 13 and 268 bytes into a destination of size 256 snprintf(key, sizeof(key), "MSG_PENDING/%s", sharename); BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437 Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3:printing: Fix size typesAndreas Schneider2018-04-031-10/+17
| | | | | | | This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: Avoid an "extern current_user"Volker Lendecke2017-10-271-4/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* werror: replace WERR_INVALID_PARAM with WERR_INVALID_PARAMETER in ↵Günther Deschner2016-09-281-8/+8
| | | | | | | | | source3/printing/ Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Move sys_rw* to lib/utilVolker Lendecke2015-10-131-1/+1
| | | | | | | genrand.c will require it soon Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Convert the few instances of int32 there were to int32_t.Richard Sharpe2015-05-161-1/+1
| | | | | | | | Signed-off-by: Richard Sharpe <rsharpe@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat May 16 03:09:12 CEST 2015 on sn-devel-104
* Convert all (remaining) uses of uint32/16/8 to _t in source3/printing.Richard Sharpe2015-05-121-31/+31
| | | | | Signed-off-by: Richard Sharpe <rsharpe@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Convert uint32/16/8 to 32_t/16_t/8_t in printing.h and all files that ↵Richard Sharpe2015-05-011-68/+68
| | | | | | | include it. Signed-off-by: Richard Sharpe <rsharpe@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Remove tdb_fetch_compatVolker Lendecke2015-03-171-14/+14
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* 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>
* 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>
* printing: don't leak cache_path onto talloc tosDavid Disseldorp2014-10-061-2/+13
| | | | | | | | 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>
* lib: directory_create_or_exist() does not use "uid" parameterVolker Lendecke2014-07-281-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* 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>
* 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 "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 "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>
* loadparm: rename lp[cfg]_print_ok to lp[cfg]_printable for consistency with docsMichael Adam2014-02-031-4/+4
| | | | | | | 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-031-4/+4
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* 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-201-37/+35
| | | | | | | | | | 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>
* Make sure to set umask() before calling mkstemp().Andreas Schneider2013-03-061-0/+3
| | | | | | | Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Wed Mar 6 01:16:34 CET 2013 on sn-devel-104