summaryrefslogtreecommitdiff
path: root/source3/printing
Commit message (Collapse)AuthorAgeFilesLines
* s3:printing: Fix %J substitionRalph Boehme2019-11-072-12/+15
| | | | | | | | | | | | | | | | | | | | | 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:printing: add a DEBUG statementRalph Boehme2019-11-071-0/+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>
* s3: rename talloc_sub_advanced() to talloc_sub_full()Ralph Boehme2019-11-072-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* s3:printing: Add spoolssd header fileSamuel Cabrero2019-10-183-6/+31
| | | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3:printing: Add header inclusion guards in queue_process.hSamuel Cabrero2019-10-181-0/+5
| | | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3:libnet: Require sealed LDAP SASL connections for joiningAndreas Schneider2019-10-091-3/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* smbd: rename [un]become_user*() to [un]become_user_without_service*()Stefan Metzmacher2019-09-111-6/+6
| | | | | | | | | | | | We should make the behavior change (that gives up some protection) more obvious, by changing the function names. At least some OEMs have patches relying on the 4.9/4.10 behaviour and we want them to detect that they have to do more work when they need to change directories. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:rpc_server:spoolssd: Move socket creation to its own functionSamuel Cabrero2019-07-221-45/+73
| | | | | | | | The function also handles the registration in the endpoint mapper. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:rpc_server: Unify RPC client disconnect and termination functionsSamuel Cabrero2019-07-221-2/+1
| | | | | | | | | | | These functions are used by endpoint mapper to delete the endpoints when a NCALRPC connection from an external daemon is lost and by preforked childs to accept the next client as soon as the current connection terminates. We can use the same function for both purposes. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:spoolss: Set remote and local address for accepted connectionsSamuel Cabrero2019-07-221-6/+6
| | | | | | Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:rpc_server: Set debug class in all rpc server related filesSamuel Cabrero2019-07-221-0/+3
| | | | | | Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:prefork: Allow to associate private data with listening socketSamuel Cabrero2019-07-221-7/+9
| | | | | | | | | | Prepare for merger RPC server codebase, where it will be necessary to stablish an association between the listening socket and the dcesrv_endpoint that the socket is serving. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:rpc_server: Remove named_pipe_client struct and use dcerpc_ncacn_connSamuel Cabrero2019-07-221-3/+10
| | | | | | | | | Now NCACN_NP connections run the same loop as NCACN_IP_TCP and NCALRPC connections. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:spoolss: Exit if fork call failsSamuel Cabrero2019-07-221-0/+1
| | | | | | Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:rpc_server: Return NTSTATUS for dcesrv_create_ncacn_np_socketSamuel Cabrero2019-07-221-2/+2
| | | | | | | | The 'fd' state struct member is initialized after allocation because it is checked in the error path. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:rpc_server: Rename create_named_pipe_socketSamuel Cabrero2019-07-221-1/+1
| | | | | Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* 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>