summaryrefslogtreecommitdiff
path: root/source3/printing
Commit message (Collapse)AuthorAgeFilesLines
* s3:printing: Remove unused variableAndreas Schneider2023-02-061-2/+1
| | | | | | | | | | source3/printing/tests/vlp.c:144:19: error: variable 'job_count' set but not used [-Werror,-Wunused-but-set-variable] int i, num_jobs, job_count = 0; ^ Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:printing: Remove trailing whitespaces in vlp.cAndreas Schneider2023-02-061-9/+9
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3-librpc: add ads.idl and convert ads_struct to talloc.Günther Deschner2022-12-161-3/+3
| | | | | | | Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: remove process shortname arg from reinit_after_fork()Ralph Boehme2022-12-141-1/+1
| | | | | | | All callers pass NULL anyway, so it isn't used anymore. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* 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: smbd: Convert driver_unix_convert() to use filename_convert_dirfsp().Jeremy Allison2022-08-041-2/+8
| | | | | | | | | | | There is now only one user left of unix_convert(), inside the MSDFS code. I have plans to get rid of this soon. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Aug 4 18:10:43 UTC 2022 on sn-devel-184
* s3: smbd: Add dirfsp return parameter to driver_unix_convert().Jeremy Allison2022-08-041-11/+22
| | | | | | | | Not yet used, but (dirfsp=NULL) value passed to functions called after driver_unix_convert(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3: smbd: Add dirfsp parameter to create_directory().Jeremy Allison2022-08-021-1/+1
| | | | | | | Not yet used but passed down to SMB_VFS_CREATE(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3: smbd: Add dirfsp parameter to unlink_internals().Jeremy Allison2022-08-021-1/+1
| | | | | | | Not yet used but passed to SMB_VFS_CREATE(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:printing: Do not clear the printer-list.tdbAndreas Schneider2022-06-303-32/+15
| | | | | | | | | | | | | | | | | | | | | | 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
* s3:libads: Allocate ads->auth.password under ADS_STRUCT talloc contextSamuel Cabrero2022-06-271-13/+34
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:libads: Allocate ADS_STRUCT under a talloc contextSamuel Cabrero2022-06-271-10/+16
| | | | | | | | The ads_destroy() function is now static and only called from the ADS_STRUCT destructor. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:printing: Allocate a temporary talloc context for nt_printer_publish()Samuel Cabrero2022-06-271-9/+9
| | | | | | | Prepare to allocate ADS_STRUCT under a talloc context. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:printing: Fix temporary talloc context leakSamuel Cabrero2022-06-271-0/+1
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove NTCREATEX_FLAG_DELETE_ON_CLOSEVolker Lendecke2022-06-061-2/+2
| | | | | | | | | This is only used for print files. Storing it in the fd_handle seems overkill to me, this can easily be stored directly in the fsp itself, we have a flag for this. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:printing: Start samba-bgqd as soon as possibleAndreas Schneider2022-05-311-4/+4
| | | | | | | | | | | | We need some time to fill the printcap cache. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15081 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): Tue May 31 21:51:07 UTC 2022 on sn-devel-184
* s3:printing: Initialize the printcap cache as soon as the bgqd startsAndreas Schneider2022-05-311-0/+3
| | | | | | | | | | As soon as the background daemon starts, we need to initialize the printcap cache so that rpcd-spoolssd can serve printers. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15081 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify copy_file()Volker Lendecke2022-05-201-2/+1
| | | | | | | | | Pass in new_create_disposition directly. We can also remove the if-case (ofun & OPENX_FILE_EXISTS_OPEN) in copy_file, the two callers don't use it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify copy_file()Volker Lendecke2022-05-201-2/+1
| | | | | | | The only two callers did not use "count" and "target_is_directory". Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Revert "vfs: remove dirfsp arg from SMB_VFS_CREATE_FILE()"Volker Lendecke2022-04-281-0/+3
| | | | | | | | | | This reverts commit 322574834f1e71bc01f21be9059ca4d386517c84. Not strictly a revert anymore, but for future work we do need "dirfsp" in create_file_default() passed through the VFS. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* 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>
* printing: Fix a DBG messageVolker Lendecke2022-03-111-2/+3
| | | | | | | openat_pathref_fsp() returns NTSTATUS, errno might be wrong here Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* smbd: NULL out "fsp" in close_file()Volker Lendecke2022-02-101-6/+4
| | | | | | | | | Quite a few places already had this in the caller, but not all. Rename close_file() to close_file_free() appropriately. We'll factor out close_file_smb() doing only parts of close_file_free() later. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing/bgqd: Disable systemd notificationsFeRD (Frank Dana)2022-01-271-0/+3
| | | | | | | | | | | | | | | samba-bgqd daemon is started by existing Samba daemons. When running under systemd, those daemons control systemd notifications and samba-bgqd messages need to be silenced. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14947 Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com> Reviewed-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Alexander Bokovoy <ab@samba.org> Autobuild-Date(master): Thu Jan 27 10:53:50 UTC 2022 on sn-devel-184
* printing: Save a few lines with str_list_add_printf()Volker Lendecke2022-01-181-12/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:rpc_server: Delete unused code and doc referencesVolker Lendecke2021-12-102-854/+0
| | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* printing: Remove "start_daemons" from printing_subsystem_init()Volker Lendecke2021-12-102-26/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:rpc_server: Activate samba-dcerpcdVolker Lendecke2021-12-102-36/+5
| | | | | | | | | | | | | | This is the big switch to use samba-dcerpcd for the RPC services in source3/. It is a pretty big and unordered patch, but I don't see a good way to split this up into more manageable pieces without sacrificing bisectability even more. Probably I could cut out a few small ones, but a major architechtural switch like this will always be messy. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:printing: Move pcap_cache_loaded() to load.cVolker Lendecke2021-12-104-16/+16
| | | | | | | | | | | | | | | | A future patch will remove the PRINTING dependency from smbd, but in delete_and_reload_printers() we still reference it. Maybe at some later stage we can remove reload_printers() overall, we don't really need to load the full printer list into every smbd. All we need is to load them on-demand for explicit listing functions, but there we can throw them away again. And when someone connects to the printer, we can also load them on demand. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3: smbd: Remove 'bool has_wild' parameter from unlink_internals().Jeremy Allison2021-12-091-1/+1
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* samba-bgqd: fix startup and loggingRalph Boehme2021-11-111-25/+10
| | | | | | | | | | | | | | Let samba-bgqd use the new POPT_COMMON_DAEMON infrastructure. The calls to setup_logging() can safely be removed as this is already taken care of by samba_cmdline_init(). To avoid a logfile basename of ".log" when using "%m", we add a call to set_remote_machine_name(). 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>
* source3: move lib/substitute.c functions out of proto.hRalph Boehme2021-11-112-0/+2
| | | | | | 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>
* source3/printing/queue_process.c: fix build on macOSAlex Richardson2021-10-131-2/+0
| | | | | | | | | | | On macOS environ is defined to (*_NSGetEnviron()) in lib/replace/replace.h and otherwise the `extern char **environ` can be found there. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14862 Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Move closefrom_except*() to a separate fileVolker Lendecke2021-09-211-75/+1
| | | | | | | | | | Enable use in other daemons 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 Sep 21 01:12:12 UTC 2021 on sn-devel-184
* samba-bgqd: Convert closeall_*() to closefrom_*()Volker Lendecke2021-09-211-12/+9
| | | | | | Align it with closefrom() in preparation for use elsewhere Signed-off-by: Volker Lendecke <vl@samba.org>
* samba-bgqd: Enable smbcontrol pool-usageVolker Lendecke2021-09-211-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* samba-bgqd: Fix samba-bgqd with "clustering=yes"/"include=registry"Volker Lendecke2021-07-311-11/+47
| | | | | | | | | | | | | | | | | With the above combination, some flavor of lp_load() already initializes global_event_ctx, for which the closeall_except() later on will happily close the epoll fd for. If we want to close all file descriptors at startup, this must be the very first thing overall. Can't really write a proper test for this with knownfail that is removed with the fix, because if we have clustering+include=registry, the whole clusteredmember environment does not even start up. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sat Jul 31 16:58:41 UTC 2021 on sn-devel-184
* printing: avoid crash in LPRng_timeDouglas Bagnall2021-07-051-0/+6
| | | | | | | | | | | | | If the string is too shhort we don't want to atoi() whatever is beyond the end of it. Found using Honggfuzz and the fuzz_parse_lpq_entry fuzzer. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Jul 5 05:07:13 UTC 2021 on sn-devel-184
* 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>
* s3:printing: Migrate samba-bgqd to new cmdline option parserAndreas Schneider2021-05-281-14/+20
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* printing: Avoid a few references to background_lpq_updater_pidVolker Lendecke2021-05-115-19/+23
| | | | | | | | | | 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: Introduce samba-bgqdVolker Lendecke2021-05-112-76/+462
| | | | | | | | | | This is a separate binary executed from start_background_queue(). As such it does not really gain much, but the idea is to move all the code this runs out of the smbd and spoolssd binaries to just link here. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: Factor out register_printing_bq_handlers()Volker Lendecke2021-05-112-36/+82
| | | | | | | | The printing background jobs can be provided independently of the start_background_queue() implementation. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* printing: Simplify calling print commandsVolker Lendecke2021-05-111-5/+5
| | | | | | | We have fstr_sprintf for this Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* 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: Avoid zombies in the background daemonVolker Lendecke2021-04-271-8/+14
| | | | | | | Whatever you read about waitpid() tells you should should run it in a loop. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* printing: Reduce indentation in start_background_queue()Volker Lendecke2021-04-271-46/+43
| | | | | | | We don't need the "if(pid==0)" here, we've covered "if(pid!=0)" a few lines above. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* printing: Remove dead codeVolker Lendecke2021-04-271-5/+0
| | | | | | This was already covered a few lines above. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* printing: Remove the pause_pipe[] from queue_process.cVolker Lendecke2021-04-271-37/+0
| | | | | | Since c80f70390c37 we don't need this explicit pipe anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>