summaryrefslogtreecommitdiff
path: root/source3
AgeCommit message (Collapse)AuthorFilesLines
2023-01-18smbd: Modernize DBG statements in smbXsrv_open_global_store()Volker Lendecke1-10/+8
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-01-18smbd: Make smbXsrv_open_global_id_to_key() a bit more type-safeVolker Lendecke1-11/+10
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-01-18smbd: Directly initialize key in smbXsrv_open_global_fetch_locked()Volker Lendecke1-2/+1
Don't leave the key.dptr pointer uninitialized Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-01-18smbd: Remove unused smbXsrv_open_global_key_to_id()Volker Lendecke1-17/+0
This isn't exactly rocket science we would need to keep around Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-01-18smbd: Slightly simplify smbXsrv_open_create()Volker Lendecke1-25/+19
Move allocation of smbXsrv_open_global0 out of smbXsrv_open_global_allocate() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-01-18smbd: Remove smbXsrv_open_global_destructor()Volker Lendecke1-8/+0
This did not do much. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-01-18smbd: Slightly simplify smb2srv_open_recreate()Volker Lendecke1-4/+7
This moves the bit-fiddling right next to the check we do, "global_zeros" was only used for this one purpose and its assignment was a few lines away. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-01-17s3/libsmb: fix a typo in parameter descriptionBjörn Baumbach1-1/+1
Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
2023-01-13s3: smbd: Tweak openat_pathref_dirfsp_nosymlink() to NULL out fsp->fsp_name ↵Jeremy Allison1-2/+2
after calling fd_close() on intermediate directories, rather than before. vfs_virusfilter expects a non-NULL fsp->fsp_name to use for printing debugs (it always indirects fsp->fsp_name). vfs_fruit also does the same, so would also crash in fruit_close() with 'debug level = 10' and vfs_default:VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS = no set (we don't test with that which is why we haven't noticed this before). Remove knownfail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15283 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Jan 13 08:33:47 UTC 2023 on sn-devel-184
2023-01-13selftest: Show vfs_virusscanner crashes when traversing a 2-level directory ↵Jeremy Allison1-7/+18
tree. Modify check_infected_read() test to use a 2-level deep directory. We must have vfs_default:VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS = no set on the virusscanner share as otherwise the openat flag shortcut defeats the test. Add knownfail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15283 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2023-01-12lib: Fix a use-after-free in "net vfs getntacl"Volker Lendecke1-1/+3
Don't hang "sd" off "fsp", which is free'ed before printing Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Thu Jan 12 16:41:07 UTC 2023 on sn-devel-184
2023-01-12lib: Fix out-of-bounds access in print_ace_flags()Volker Lendecke1-3/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2023-01-12lib: Use talloc_asprintf_addbuf() in print_ace_flags()Volker Lendecke1-29/+9
Simplifies code. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2023-01-12build: Don't compile source3/lib/util_sd.c four timesVolker Lendecke3-4/+9
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2023-01-12s3:utils:mdsearch go to cmdline_messaging_context_freeJones Syue1-9/+11
mdsearch utility would exit earlier with failure in several cases like: a. samba server is not running yet, [~] # mdsearch -Uuser%password1 ${server} Public '*=="Samba"' main: Cannot connect to server: NT_STATUS_CONNECTION_REFUSED b. spotlight backend service is not ready yet, [~] # mdsearch -Uuser%password1 ${server} Public '*=="Samba"' Failed to connect mdssvc c. mdsearch utility paramters is not as expecred, [~] # mdsearch -Uuser%password1 ${server} share_not_exist '*=="Samba"' mdscli_search failed And in the mean while once mdsearch utility exit earlier with failure, the lock files are left behind in the directory 'msg.sock' and 'msg.lock'. If a script to run mdsearch utility in a loop, this might result in used space slowly growing-up on underlying filesystem. Supposed to add a new label 'fail_free_messaging', make it go through the cmdline_messaging_context_free() which deletes the lock files in the directory msg.sock and msg.lock before mdsearch utility is exiting with failure. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15284 Signed-off-by: Jones Syue <jonessyue@qnap.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Jan 12 11:40:19 UTC 2023 on sn-devel-184
2023-01-11s3:smbstatus: go to cmdline_messaging_context_freeJones Syue1-1/+2
If the locking.tdb is not found, (for example, fresh new installed samba server is not running yet) smbstatus utility would exit earlier, and lock files are left behind in the directory 'msg.sock' and 'msg.lock'. Consider that a script to run smbstatus utility in a loop, this might result in used space slowly growing-up on the underlying filesystem. Since the samba server is not running yet, there is no cleanupd daemon could delete these files to reclaim space. Supposed to use 'ret = 0; goto done;' instead of exit(0), this would go through the cmdline_messaging_context_free() which deletes the lock files in the directory msg.sock and msg.lock before smbstatus utility is exiting. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15282 Signed-off-by: Jones Syue <jonessyue@qnap.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jan 11 17:08:10 UTC 2023 on sn-devel-184
2023-01-11s3: smbd: Move check_fsp_open() and check_fsp() to smb1_reply.cJeremy Allison2-40/+40
As these functions can implicitly call reply_nterror(..., NT_STATUS_INVALID_HANDLE) they should never be available to SMB2 code paths. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jan 11 08:17:04 UTC 2023 on sn-devel-184
2023-01-11s3: smbd: Ensure check_fsp_ntquota_handle() doesn't send SMB1 error packets.Jeremy Allison1-1/+5
check_fsp_ntquota_handle() is called from SMB2 codepaths as well as from SMB1. Even in the SMB1 cases the callers of check_fsp_ntquota_handle() handle sendng the error packet when check_fsp_ntquota_handle returns false so on a 'return false' we'd end up sending an error packet twice. The SMB2 callers of check_fsp_ntquota_handle() already check that fsp is valid, so there's no danger of us sending an SMB1 error packet over the SMB2 stream (so I'm not classing this as a bug to be back-ported). Fix check_fsp_ntquota_handle() by inlineing the check_fsp_open() functionality without the reply_nterror() calls. This will allow the next commit to move check_fsp_open() with the implicit reply_nterror() and also check_fsp() (which calls check_fsp_open()) into the SMB1 smb1_reply.c file as SMB1-only code. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2023-01-11s3: smbd: SMB1 check_fsp_open() implicitly calls reply_nterror(.., ↵Jeremy Allison1-1/+0
NT_STATUS_INVALID_HANDLE) on error so don't duplicate in reply_close(). We'd end up sending 2 SMB1 error packets in this case. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2023-01-10smbd: Use an idtree for local IDsVolker Lendecke1-326/+44
Volatile file handle IDs are purely per-process, in fact we used a dbwrap_rbt for this. To get a unique ID we however have the specialized idtree data structure, we don't need to repeat the allocation algorithm that already exists there. 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 Jan 10 01:23:38 UTC 2023 on sn-devel-184
2023-01-10lib: Remove idtree from samba_util.hVolker Lendecke3-0/+3
No need to recompile the world when only a few files need this. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10smbd: Simplify smbXsrv_open_set_replay_cache() with dbwrap_store_bystring()Volker Lendecke1-3/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10smbd: Simplify smbXsrv_open_set_replay_cache() with a struct assignmentVolker Lendecke1-1/+1
Use a direct struct assignment instead of a function call Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Add "starting_id" to idr_get_new_random()Volker Lendecke2-1/+2
To be used in smbXsrv_open.c, for this we need a lower bound. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10smbd: Remove smbXsrv_open->db_recVolker Lendecke2-24/+16
This was only referenced in smbXsrv_open_close, but it was never assigned anything but NULL. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10smbd: Remove a "can't happen" NULL checkVolker Lendecke1-4/+0
This should really not happen, crashing would be the right response. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10smbd: Use talloc_tos() for pushing smbXsrv_open_globalBVolker Lendecke1-1/+2
Use the toplevel talloc pool Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Use tdb_data_dbg() where appropriateVolker Lendecke6-63/+56
This changes the talloc hierarchy for a few callers, but as talloc_tos() was initially designed exactly for this purpose (printing SIDs in DEBUG), it should be okay. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Add tdb_data_dbg()Volker Lendecke2-0/+6
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10smbd: Avoid explicit ZERO_STRUCT()Volker Lendecke1-2/+4
Saves a few bytes of .text Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10smbd: Move bytes from r/w data to r/o text sectionVolker Lendecke1-12/+9
Even const arrays of const strings need to be relocated at startup time. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Move 16 bytes to readonly .text segmentVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Remove unused smb_mkstemp prototypeVolker Lendecke2-4/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Move tab_depth() to reg_parse_prs.cVolker Lendecke3-8/+8
Wow, I did not know we still use prs_struct... Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Make map_share_mode_to_deny_mode() static to smbstatusVolker Lendecke3-22/+22
At some point in the future this might disappear, we should really not show DOS share modes in smbstatus. Maybe this can't be changed though. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10smbd: Make get_safe_[[SI]VAL|ptr] static to smb1_lanman.cVolker Lendecke3-44/+56
SMB1-specific, only used there. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-09CVE-2022-38023 s3:rpc_server/netlogon: Avoid unnecessary loadparm_context ↵Samuel Cabrero1-19/+2
allocations After s3 and s4 rpc servers merge the loadparm_context is available in the dcesrv_context structure. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15240 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Jan 9 15:17:14 UTC 2023 on sn-devel-184
2023-01-09CVE-2022-38023 s3:rpc_server/netlogon: Check for global "server schannel ↵Samuel Cabrero1-0/+12
require seal" By default we'll now require schannel connections with privacy/sealing/encryption. But we allow exceptions for specific computer/trust accounts. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15240 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2023-01-09CVE-2022-38023 s3:rpc_server/netlogon: make sure all _netr_LogonSamLogon*() ↵Samuel Cabrero1-17/+28
calls go through dcesrv_netr_check_schannel() Some checks are also required for _netr_LogonSamLogonEx(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=15240 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2023-01-09CVE-2022-38023 s3:rpc_server/netlogon: Use dcesrv_netr_creds_server_step_check()Samuel Cabrero2-159/+44
After s3 and s4 rpc servers merge we can avoid duplicated code. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15240 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2023-01-09CVE-2022-38023 s3:rpc_server/netlogon: 'server schannel != yes' warning to ↵Samuel Cabrero1-11/+28
dcesrv_interface_netlogon_bind Follow s4 netlogon server changes and move the checks to the RPC bind hook. Next commits will remove the s3 netr_creds_server_step_check() function. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15240 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2023-01-09source3/wscript: Remove implicit int and implicit function declarationsFlorian Weimer1-5/+6
This should fix the remaining C89isms in these configure checks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15281 Signed-off-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Jan 9 11:46:35 UTC 2023 on sn-devel-184
2023-01-09source3/wscript: Fix detection of major/minor macrosFlorian Weimer1-2/+2
These macros are only available via <sys/sysmacros.h> as of glibc commit e16deca62e16f645213dffd4ecd1153c37765f17 ("[BZ #19239] Don't include sys/sysmacros.h from sys/types.h."), which went into glibc 2.28. This is different from the usual C99 cleanups because it changes the configure check result with existing compilers that usually accept implicit function declarations. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15281 Signed-off-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-01-05smbd: Fix indentationVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Thu Jan 5 18:00:17 UTC 2023 on sn-devel-184
2023-01-05smbd: Fix CID 1518901 Logically dead codeVolker Lendecke1-25/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2023-01-05smbd: Fix CID 1518902 Use after freeVolker Lendecke1-16/+12
The SMB_REALLOC macro properly deals with failure to realloc, so overwriting the target variable is correct here. Signed-off-by: Volker Lendecke <vl@samba.org>
2023-01-04smbd: Use get_dirent_ea_size() also for BOTH_DIRECTORY_INFOVolker Lendecke1-7/+5
This is a bit more involved as readdir_attr_data needs to be looked at. The meaning of this if-statements should be the same though, readdir_attr_data can only be non-NULL if we don't have a reparse point around. See the beginning of smbd_marshall_dir_entry(). Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Wed Jan 4 09:48:37 UTC 2023 on sn-devel-184
2023-01-04smbd: Factor out get_dirent_ea_size()Volker Lendecke1-19/+17
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2023-01-04pylibsmb: Add reparse tag definitionsVolker Lendecke1-0/+7
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2023-01-04pylibsmb: Get reparse tag when listing directoriesVolker Lendecke1-0/+12
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>