summaryrefslogtreecommitdiff
path: root/source3/printing
AgeCommit message (Collapse)AuthorFilesLines
2024-01-08smbd: set fsp_flags.is_fsa to true on printer file handlesRalph Boehme1-0/+1
Printer file handles went through SMB_VFS_CREATE_FILE() and are network callable, so it makes sense to set this on them. This ensures that check_access_fsp() doesn't take the codepath calling smbd_check_access_rights_fsp(), but just checks the request rights from fsp->access_mask. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13688 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-08-08s3:printing: Fix code spellingJoseph Sutton1-4/+4
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-08s3:printing: Add missing spaces to error messagesJoseph Sutton1-3/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-08s3:printing: Add missing newlines to logging messagesJoseph Sutton4-10/+10
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-19s3:printing: Rename variably to dummy to make codespell happyAndreas Schneider1-4/+4
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-07-19s3:printing: Fix code spellingAndreas Schneider5-14/+14
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-07-19s3:printing: Fix trailing white spaces in print_iprint.cAndreas Schneider1-16/+16
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-02-06s3:printing: Remove unused variableAndreas Schneider1-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>
2023-02-06s3:printing: Remove trailing whitespaces in vlp.cAndreas Schneider1-9/+9
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-16s3-librpc: add ads.idl and convert ads_struct to talloc.Günther Deschner1-3/+3
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-14smbd: remove process shortname arg from reinit_after_fork()Ralph Boehme1-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>
2022-12-12lib: Add get_current_user_info_domain()Volker Lendecke1-3/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-04s3: smbd: Convert driver_unix_convert() to use filename_convert_dirfsp().Jeremy Allison1-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
2022-08-04s3: smbd: Add dirfsp return parameter to driver_unix_convert().Jeremy Allison1-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>
2022-08-02s3: smbd: Add dirfsp parameter to create_directory().Jeremy Allison1-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>
2022-08-02s3: smbd: Add dirfsp parameter to unlink_internals().Jeremy Allison1-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>
2022-06-30s3:printing: Do not clear the printer-list.tdbAndreas Schneider3-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
2022-06-27s3:libads: Allocate ads->auth.password under ADS_STRUCT talloc contextSamuel Cabrero1-13/+34
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-27s3:libads: Allocate ADS_STRUCT under a talloc contextSamuel Cabrero1-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>
2022-06-27s3:printing: Allocate a temporary talloc context for nt_printer_publish()Samuel Cabrero1-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>
2022-06-27s3:printing: Fix temporary talloc context leakSamuel Cabrero1-0/+1
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06smbd: Remove NTCREATEX_FLAG_DELETE_ON_CLOSEVolker Lendecke1-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>
2022-05-31s3:printing: Start samba-bgqd as soon as possibleAndreas Schneider1-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
2022-05-31s3:printing: Initialize the printcap cache as soon as the bgqd startsAndreas Schneider1-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>
2022-05-20smbd: Simplify copy_file()Volker Lendecke1-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>
2022-05-20smbd: Simplify copy_file()Volker Lendecke1-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>
2022-04-28Revert "vfs: remove dirfsp arg from SMB_VFS_CREATE_FILE()"Volker Lendecke1-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>
2022-04-26smbd: fd_handle.h does not need includes.hVolker Lendecke1-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>
2022-03-11printing: Fix a DBG messageVolker Lendecke1-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>
2022-02-10smbd: NULL out "fsp" in close_file()Volker Lendecke1-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>
2022-01-27printing/bgqd: Disable systemd notificationsFeRD (Frank Dana)1-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
2022-01-18printing: Save a few lines with str_list_add_printf()Volker Lendecke1-12/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-12-10s3:rpc_server: Delete unused code and doc referencesVolker Lendecke2-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>
2021-12-10printing: Remove "start_daemons" from printing_subsystem_init()Volker Lendecke2-26/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2021-12-10s3:rpc_server: Activate samba-dcerpcdVolker Lendecke2-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>
2021-12-10s3:printing: Move pcap_cache_loaded() to load.cVolker Lendecke4-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>
2021-12-09s3: smbd: Remove 'bool has_wild' parameter from unlink_internals().Jeremy Allison1-1/+1
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2021-11-11samba-bgqd: fix startup and loggingRalph Boehme1-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>
2021-11-11source3: move lib/substitute.c functions out of proto.hRalph Boehme2-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>
2021-10-13source3/printing/queue_process.c: fix build on macOSAlex Richardson1-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>
2021-09-21lib: Move closefrom_except*() to a separate fileVolker Lendecke1-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
2021-09-21samba-bgqd: Convert closeall_*() to closefrom_*()Volker Lendecke1-12/+9
Align it with closefrom() in preparation for use elsewhere Signed-off-by: Volker Lendecke <vl@samba.org>
2021-09-21samba-bgqd: Enable smbcontrol pool-usageVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-07-31samba-bgqd: Fix samba-bgqd with "clustering=yes"/"include=registry"Volker Lendecke1-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
2021-07-05printing: avoid crash in LPRng_timeDouglas Bagnall1-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
2021-06-04printing: Factor out remove_from_jobs_list()Volker Lendecke1-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>
2021-06-04printing: Simplify pack_devicemode()Volker Lendecke1-3/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-05-28s3:printing: Migrate samba-bgqd to new cmdline option parserAndreas Schneider1-14/+20
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-05-11printing: Avoid a few references to background_lpq_updater_pidVolker Lendecke5-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
2021-05-11printing: Introduce samba-bgqdVolker Lendecke2-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>