1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

124529 Commits

Author SHA1 Message Date
Volker Lendecke
6482bee22f rpc_server: Move setting ip-based socket options
All ncacn_ip_tcp listener sockets are created via
dcesrv_create_ncacn_ip_tcp_socket(). Moving setting the socket options
out of dcesrv_setup_ncacn_ip_tcp_socket() to remove a special case for
TCP from the dcesrv_setup_* family of routines.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
50dada72ad rpc_server: Direct pointer initialization in dcesrv_ncacn_np_accept_done()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
cc9ade9b0a lib: Initialize variables in prefork_listen_accept_handler()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
834f9e152e lib: Fix typos
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
33f7aac871 rpc_server: Make dcerpc_ncacn_accept() take tsocket_address **
dcerpc_ncacn_accept() talloc_move's the addresses away from the
caller's talloc hierarchy. Don't leave pointers around in the caller.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
51f5631bbb tsocket: Fix a few typos
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
a21867bc48 rpc_server: Remove unused make_server_pipes_struct()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
562e48655c rpc_server: Use make_base_pipes_struct() in make_internal_rpc_pipe_socketpair()
make_server_pipes_struct() is just a simple wrapper.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
8488b16f56 rpc_server: Use make_base_pipes_struct() in dcesrv_ncacn_accept_step2()
make_server_pipes_struct() is just a simple wrapper.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
dcc8f37af1 rpc_server: Simplify find_policy_by_hnd_internal()
Best viewed with "git show -b". Use the typical pattern of an early
error return.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
acca9ec4b6 vfs_fruit: Fix CID 1471764 Dereference null return value
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
8d5fb1ad14 vfs_fruit: Fix CID 1471760 Dereference null return value
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Volker Lendecke
5ef25729bd tdb: Fix CID 1471761 String not null terminated
This is a false positive (in is length 3 initialized to 0), but this
patch does not hurt

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-14 13:29:35 +00:00
Stefan Metzmacher
da052dde8a s3:smbd: simplify the error handling in create_file_unixpath()
We can just call close_file(req, fsp, ERROR_CLOSE), as it handles
non-fsa fsp's and base_fsp's just fine.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jan 14 12:40:56 UTC 2021 on sn-devel-184
2021-01-14 12:40:56 +00:00
Stefan Metzmacher
9c277b27de s3:smbd: allow close_file() with a non-fsa fsp for {SHUTDOWN,ERROR}_CLOSE
Such an fsp was typically created via create_internal_fsp() and
opened via fd_openat() without going through SMB_VFS_CREATE_FILE(),
so they should be closed via fd_close().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
20187c6f54 s3:smbd: make sure a SHUTDOWN_CLOSE applies to a stream fsp before its base fsp
Before we had open_pathref_fsp() we had the stream fsp before the base
fsp in the linked list we traverse for SHUTDOWN_CLOSE.

Now the order has changed. I could have used some DLIST_PROMOTE()
hacks, but that's still fragile.

Now we reference both fsp's via ->base_fsp and ->stream_fsp.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
930b6bb3b8 s3:smbd: make use of fsp_set_base_fsp() when changing fsp->base_fsp
This allows us to add some more logic for bi-directional linking between
base and stream fsp in the next commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
928382f270 s3:smbd: add fsp_set_base_fsp() helper
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
42c60703f2 s3:smbd: remove duplicate assignment of base_fsp in create_file_unixpath()
This has already been set a few lines above. The duplicate was the result of
restructuring create_file_unixpath() a few months ago, allocating fsp in
create_file_unixpath() instead of in the callees open_file_ntcreate() or
open_directory() respectively.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
87b4a8f35a s3:smbd: fix the error cleanup in create_file_unixpath()
We always need to cleanup the base_fsp!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
22bebaf858 s3:smbd: split out create_internal_fsp() from create_internal_dirfsp()
That will be useful in other places as well.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
7dc9a84bb5 s3:smbd: make fsp_free() static, it should only ever be called by file_free()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
81b6931be0 s3:smbd: let vfs_default_durable_reconnect() use file_free()
We should always go through file_free(), which calls fsp_free() at the end.

Most things in file_free() may not apply to all
vfs_default_durable_reconnect() cases, but we want fsp_free() to become
static to files.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Ralph Boehme
bcac1dab69 s3:smbd: close pathref fsp in call_trans2findfirst()
Before freeing the fsp we have to close the handle.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2021-01-14 11:30:38 +00:00
Ralph Boehme
eae7ce8a2e s3:smbd: turn assignment into assert check in call_trans2findfirst()
The pathref fsp link destructor will set smb_dname->fsp to NULL. Turning this
into an assert to give a hint at readers of the code trying to understand the
mechanics.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
e1a10b5817 s3:smbd: let call_trans2findfirst() use file_free() instead of fsp_free()
This makes sure we call vfs_remove_all_fsp_extensions() before
fsp_free() is called from within file_free(). And allows us to
make 'fsp_free()' static in the next commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
9b1dc2a4ca s3:smbd: make sure openat_pathref_fsp() calls fd_close(fsp->base_fsp);
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
8d79764ad3 s3:smbd: introduce a reopen_from_fsp() helper function
In future we may move the reopen logic to the VFS,
but for now we just keep it in one place.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
38ae1599a0 s3:smbd: don't pass an unused smb_fname to reopen_from_procfd()
Both callers pass in a helper variable that points to
fsp->fsp_name and it was only used for a debug message,
so we can simply use fsp_str_dgb() instead.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
d6949f0f93 s3:smbd: let open_directory() also use fd_open_atomic() as reopen_from_procfd() fallback
Calling fd_open_atomic() without O_CREAT is the same as calling
fd_openat() directly, so we can also use it to open an existing
directory.

In the next step we'll move the reopen_from_procfd() fallback logic to
a single helper function.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
3013463098 s3:smbd: let open_pathref_base_fsp() make use of smb_fname_fsp_unlink()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
c2e7256b1e s3:smbd: let openat_pathref_fsp() make use of fsp_attach_smb_fname()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
cff29e58ff s3:smbd: let openat_pathref_fsp() allocate fsp->fsp_name directly on fsp
Otherwise we'll always keep the current talloc_stackframe arround.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
347edf7ee0 s3:smbd: split out a fsp_attach_smb_fname() helper function
It's useful to watch this using: git show --histogram

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
1ab038b77a s3:smbd: let fsp_set_smb_fname() always link fsp to fsp->fsp_name->fsp
This was only done if fsp->fsp_name already existed, but not the first time.

This also makes sure we modify fsp->fsp_name and fsp->name_hash only on success.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
932c27e290 s3:smbd: let fsp_smb_fname_link() set both sides of the link
We also need to be sure both sides were not linked before.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Stefan Metzmacher
3fdfb79a12 s3:smbd: rearrange move_smb_fname_fsp_link a bit
We only modify smb_fname_src on success.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-14 11:30:38 +00:00
Gary Lockyer
4e624478dc s4 auth ntlm: Fix integer overflow in authsam_password_check_and_record
Fix a ubsan detected integer overflow.
../../source4/auth/ntlm/auth_sam.c:445:56: runtime error:
     signed integer overflow: 60 * 600000000
     cannot be represented in type 'int'

In practice this meant that the default for the smb.conf parameter
"old password allowed period" was approximately 16 seconds, rather than
the intended 60 minutes. Similarly the value used would be 22.5 times
less than the value specified in smd.conf.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 13 23:52:38 UTC 2021 on sn-devel-184
2021-01-13 23:52:38 +00:00
Andreas Schneider
181afa9f68 s3:libsmb: Use cli_credentials directly
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Jan 13 21:32:52 UTC 2021 on sn-devel-184
2021-01-13 21:32:52 +00:00
Andreas Schneider
78c4043a28 s3:libsmb: Pass cli_credentials to get_ipc_connect_master_ip()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2021-01-13 20:28:34 +00:00
Andreas Schneider
be18d600f7 s3:libsmb: Pass cli_credentials to get_ipc_connect()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2021-01-13 20:28:34 +00:00
Andreas Schneider
ce3a3c7eab s3:waf: Do not link tevent_glib_glue_test against popt_samba3
This isn't used at all.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2021-01-13 20:28:34 +00:00
Andreas Schneider
999cbc47a7 s3:waf: Do not link smbspool against popt_samba3
This isn't used at all.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2021-01-13 20:28:34 +00:00
Andreas Schneider
0f4827944b s3:utils: Remove unused popt_common.h header from log2pcaphex.c
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2021-01-13 20:28:34 +00:00
Andreas Schneider
e8eecc8a9e s3:utils: Remove unused popt_common.h header from net_vfs.c
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2021-01-13 20:28:34 +00:00
Andreas Schneider
e0ef27f03d s3:utils: Remove unused popt_common.h header from net_rpc_shell.c
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2021-01-13 20:28:34 +00:00
Andreas Schneider
c6ce7f2def s3:utils: Fix header and deps of mvxattr
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2021-01-13 20:28:34 +00:00
Andreas Schneider
33806a9ed9 s3:utils: Remove unused header and deps from destroy_netlogon_creds_cli
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2021-01-13 20:28:34 +00:00
Jeremy Allison
39ce733210 s3: smbd: Add call to conn_setup_case_options() to create_conn_struct_as_root().
Ensures temporary DFS share doesn't leave the case parameters set
as zero (i.e.:

conn->case sensitive = 0
conn->share_case_preserve = 0
and default case is lower

which can cause problems doing a DFS_GET_REFERRALS request).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14612

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>

Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Jan 13 18:14:31 UTC 2021 on sn-devel-184
2021-01-13 18:14:31 +00:00
Jeremy Allison
ab7700177c s3: smbd: Factor out setting up case parameters for a share to a function - conn_setup_case_options().
Will allow it to be reused in the msdfs temporary share code.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14612

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2021-01-13 17:02:34 +00:00