summaryrefslogtreecommitdiff
path: root/source3/printing
Commit message (Collapse)AuthorAgeFilesLines
* s3/printing: cppcheck avoid 'nullPointerArithmetic:' errorNoel Power2019-05-291-4/+8
| | | | | | | | | | | | | | source3/printing/notify.c:94: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck] /home/samba/samba-pidl/source3/printing/notify.c:96: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck] /home/samba/samba-pidl/source3/printing/notify.c:103: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck] flatten_message function depends on behaviour of tdb_pack which will return the bytes that would be written (without actually writing to the buffer) if the bufsize passed is <=0. What we need to avoid here is the default modification of buf (when it is initially NULL) Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3: smbd: Convert print_svid code to use file_lines_ploadv().Jeremy Allison2019-05-241-2/+27
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* printing: check lp_load_printers() prior to pcap cache updateDavid Disseldorp2019-02-012-1/+6
| | | | | | | | | | | | Avoid explicit and housekeeping timer triggered printcap cache updates if lp_load_printers() is disabled. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13766 Signed-off-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Fri Feb 1 19:25:03 CET 2019 on sn-devel-144
* printing: drop pcap_cache_loaded() guard around load_printers()David Disseldorp2019-02-013-10/+6
| | | | | | | | | | | Add the pcap_cache_loaded() check to load_printers() and return early if it returns false. This simplifies callers in preparation for checking lp_load_printers() in the printcap cache update code-path. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13766 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Noel Power <npower@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_messaging_context() to global_messaging_context()Christof Schmitt2018-09-072-4/+4
| | | | | | | | | | | This reflects that the messaging 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_messaging_context/global_messaging_context/' Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: Rename server_event_context() to global_event_context()Christof Schmitt2018-09-072-16/+16
| | | | | | | | | | | 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-172-3/+3
| | | | | | | | | | | 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
* lib: Pass mem_ctx to state_path()Volker Lendecke2018-08-173-9/+9
| | | | | | | | 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>
* lib: Pass mem_ctx to lock_path()Volker Lendecke2018-08-171-1/+1
| | | | | | | | 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>
* printing: convert delete_driver_files() to use create_conn_struct_tos_cwd()Stefan Metzmacher2018-06-141-14/+8
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: convert move_driver_to_download_area() to use ↵Stefan Metzmacher2018-06-141-14/+7
| | | | | | | create_conn_struct_tos_cwd() Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: convert get_correct_cversion() to use create_conn_struct_tos_cwd()Stefan Metzmacher2018-06-141-13/+7
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: add an explicit talloc_stackframe() to delete_driver_files()Stefan Metzmacher2018-06-141-4/+9
| | | | | | | This makes further changes simpler. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: add an explicit talloc_stackframe() to move_driver_to_download_area()Stefan Metzmacher2018-06-141-13/+16
| | | | | | | This makes further changes simpler. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: add an explicit talloc_stackframe() to get_correct_cversion()Stefan Metzmacher2018-06-141-7/+13
| | | | | | | This makes further changes simpler. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: add more 'const' to read only input pointersStefan Metzmacher2018-06-141-6/+6
| | | | | | | This makes it clearer that they won't be changed. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: remove unused arguments from delete_and_reload_printers()Stefan Metzmacher2018-06-141-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: remove unused arguments from load_printers()Stefan Metzmacher2018-06-144-13/+7
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: smbd: printing: Re-implement delete-on-close semantics for print files ↵Jeremy Allison2018-06-011-0/+17
| | | | | | | | | | | | missing since 3.5.x. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13457 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Jun 1 20:32:03 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>
* printing: Fix CID 1435452 (TAINTED_SCALAR)Volker Lendecke2018-05-111-0/+6
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* s3: VFS: Remove vfs_write_data(). No longer used.Jeremy Allison2018-05-041-1/+0
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Remove the LSEEK in printing_pread_data() and use read_file() ↵Jeremy Allison2018-05-041-5/+3
| | | | | | | | | instead. Removes last-but-one user of SMB_VFS_READ. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Now we never pass an offset of -1, remove the off_t==-1 ↵Jeremy Allison2018-05-041-15/+9
| | | | | | | protections from printing_pread_data(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Use offset tracking in printing_pread_data() to remove the ↵Jeremy Allison2018-05-041-6/+2
| | | | | | | | | | seek in handle_ne_file(). Uses the fact that: lseek(fd, 0, SEEK_CUR) is merely getting the current file position, which we have already tracked in in_pos. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Use passed in offset, and offset tracking in ↵Jeremy Allison2018-05-041-22/+8
| | | | | | | printing_pread_data() to remove seeks from handle_pe_file(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Add existing offset position as a parameter to ↵Jeremy Allison2018-05-041-0/+4
| | | | | | | | | handle_pe_file(), handle_ne_file() Not yet used. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Use auto-updating of offset in printing_pread_data() to remove ↵Jeremy Allison2018-05-041-16/+2
| | | | | | | offset tracking in get_file_version(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Make printing_pread_data() update the offset paramter, if not ↵Jeremy Allison2018-05-041-1/+20
| | | | | | | | | passed in as -1. As all callers pass -1 here, still not used. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Rename printing_read_data() -> printing_pread_data() and add ↵Jeremy Allison2018-05-041-9/+17
| | | | | | | | | an offset parameter. Currently pass -1 as the offset, so it's not used. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Rename vfs_read_data() -> printing_read_data().Jeremy Allison2018-05-041-9/+10
| | | | | | | This is an internal printing call, nothing to do with the VFS. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Move handle_ne_file code into a separate function.Jeremy Allison2018-05-041-142/+173
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Split handling of PE file into separate function.Jeremy Allison2018-05-041-159/+188
| | | | | | | This is *horrible* old code... Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: printing: Reformatting of parts of this file to modern coding standards.Jeremy Allison2018-05-041-106/+264
| | | | | | | | | | This should not change the code behavior in any way, it is just being done to make it easier for me to move this code to calling the standard read_file() function later on, which takes a file offset to read from (and uses pread internally). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: VFS: Default. Move vfs_read_data() out of source3/smbd/vfs.c to the ↵Jeremy Allison2018-05-021-0/+28
| | | | | | | | | | | | printing code, which is the only caller. Make static. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Wed May 2 22:20:23 CEST 2018 on sn-devel-144
* printing: return the same error code as windows does on upload failuresBjörn Jacke2018-04-251-1/+1
| | | | | | | | | | | | | | Some print drivers inf files are broken and cause driver installation to fail on Samba servers. Windows returns WERR_APP_INIT_FAILURE in that case, we should do the same. Windows machines are less unlucky with that. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13395 Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Björn Jacke <bj@sernet.de> Autobuild-Date(master): Wed Apr 25 13:55:25 CEST 2018 on sn-devel-144
* lib: #include "util_event.h" only where neededVolker Lendecke2018-04-241-0/+1
| | | | | | | | | | One dependency of includes.h less 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 Apr 24 22:26:22 CEST 2018 on sn-devel-144
* 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>
* s3:printing: Fix size check in get_file_version()Andreas Schneider2018-03-211-6/+18
| | | | | | | This fixes compilation with -Wstrict-overflow=2 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3:printing: Fix size type in printing_dbAndreas Schneider2018-03-201-1/+1
| | | | | | | This fixes compilation with -Wstrict-overflow=2 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib: Remove unused serverid.tdbVolker Lendecke2017-12-053-24/+0
| | | | | | | | 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 Dec 5 04:58:26 CET 2017 on sn-devel-144
* lib: Use messaging_send_all instead of message_send_allVolker Lendecke2017-12-051-1/+1
| | | | | | | Just a global search&replace Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging: Remove the "n_sent" arg from message_send_allVolker Lendecke2017-12-051-1/+1
| | | | | | | | The only user of this is an informative message in smbcontrol. I don't think that's worth the effort. Signed-off-by: Volker Lendecke <vl@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>
* printing: Avoid an "extern current_user"Volker Lendecke2017-10-271-2/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:printing: Add NULL check for state_path()Andreas Schneider2017-08-191-0/+17
| | | | | | | | 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): Sat Aug 19 05:33:41 CEST 2017 on sn-devel-144
* s3-printing: precreate DriverStore directories.Günther Deschner2017-07-261-0/+22
| | | | | | | | | | Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Jul 26 05:34:15 CEST 2017 on sn-devel-144
* s3-printing: pre-create color and PCC directories under print$.Günther Deschner2017-07-261-0/+27
| | | | | | | Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3:printing: Fix setting the first jobnumAndreas Schneider2017-07-251-3/+4
| | | | | | | | This is just something logical. The define is called first jobnum but the first one was always 101. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>