]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 years agorpc_server: Remove unused make_server_pipes_struct()
Volker Lendecke [Mon, 11 Jan 2021 20:37:08 +0000 (21:37 +0100)] 
rpc_server: Remove unused make_server_pipes_struct()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agorpc_server: Use make_base_pipes_struct() in make_internal_rpc_pipe_socketpair()
Volker Lendecke [Mon, 11 Jan 2021 20:35:26 +0000 (21:35 +0100)] 
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>
4 years agorpc_server: Use make_base_pipes_struct() in dcesrv_ncacn_accept_step2()
Volker Lendecke [Mon, 11 Jan 2021 20:32:52 +0000 (21:32 +0100)] 
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>
4 years agorpc_server: Simplify find_policy_by_hnd_internal()
Volker Lendecke [Mon, 11 Jan 2021 20:25:40 +0000 (21:25 +0100)] 
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>
4 years agovfs_fruit: Fix CID 1471764 Dereference null return value
Volker Lendecke [Tue, 12 Jan 2021 10:24:38 +0000 (11:24 +0100)] 
vfs_fruit: Fix CID 1471764 Dereference null return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agovfs_fruit: Fix CID 1471760 Dereference null return value
Volker Lendecke [Tue, 12 Jan 2021 10:22:57 +0000 (11:22 +0100)] 
vfs_fruit: Fix CID 1471760 Dereference null return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agotdb: Fix CID 1471761 String not null terminated
Volker Lendecke [Tue, 12 Jan 2021 10:19:54 +0000 (11:19 +0100)] 
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>
4 years agos3:smbd: simplify the error handling in create_file_unixpath()
Stefan Metzmacher [Mon, 21 Dec 2020 15:49:03 +0000 (16:49 +0100)] 
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

4 years agos3:smbd: allow close_file() with a non-fsa fsp for {SHUTDOWN,ERROR}_CLOSE
Stefan Metzmacher [Wed, 23 Dec 2020 11:10:37 +0000 (12:10 +0100)] 
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>
4 years agos3:smbd: make sure a SHUTDOWN_CLOSE applies to a stream fsp before its base fsp
Stefan Metzmacher [Wed, 23 Dec 2020 10:50:34 +0000 (11:50 +0100)] 
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>
4 years agos3:smbd: make use of fsp_set_base_fsp() when changing fsp->base_fsp
Stefan Metzmacher [Mon, 21 Dec 2020 15:35:11 +0000 (16:35 +0100)] 
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>
4 years agos3:smbd: add fsp_set_base_fsp() helper
Stefan Metzmacher [Mon, 21 Dec 2020 14:44:22 +0000 (15:44 +0100)] 
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>
4 years agos3:smbd: remove duplicate assignment of base_fsp in create_file_unixpath()
Stefan Metzmacher [Mon, 4 Jan 2021 15:33:09 +0000 (16:33 +0100)] 
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>
4 years agos3:smbd: fix the error cleanup in create_file_unixpath()
Stefan Metzmacher [Mon, 21 Dec 2020 15:40:01 +0000 (16:40 +0100)] 
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>
4 years agos3:smbd: split out create_internal_fsp() from create_internal_dirfsp()
Stefan Metzmacher [Wed, 23 Dec 2020 10:50:34 +0000 (11:50 +0100)] 
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>
4 years agos3:smbd: make fsp_free() static, it should only ever be called by file_free()
Stefan Metzmacher [Mon, 21 Dec 2020 11:41:06 +0000 (12:41 +0100)] 
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>
4 years agos3:smbd: let vfs_default_durable_reconnect() use file_free()
Stefan Metzmacher [Mon, 21 Dec 2020 11:18:44 +0000 (12:18 +0100)] 
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>
4 years agos3:smbd: close pathref fsp in call_trans2findfirst()
Ralph Boehme [Tue, 12 Jan 2021 11:50:43 +0000 (12:50 +0100)] 
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>
4 years agos3:smbd: turn assignment into assert check in call_trans2findfirst()
Ralph Boehme [Mon, 4 Jan 2021 15:09:43 +0000 (16:09 +0100)] 
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>
4 years agos3:smbd: let call_trans2findfirst() use file_free() instead of fsp_free()
Stefan Metzmacher [Wed, 23 Dec 2020 12:28:40 +0000 (13:28 +0100)] 
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>
4 years agos3:smbd: make sure openat_pathref_fsp() calls fd_close(fsp->base_fsp);
Stefan Metzmacher [Mon, 21 Dec 2020 14:31:25 +0000 (15:31 +0100)] 
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>
4 years agos3:smbd: introduce a reopen_from_fsp() helper function
Stefan Metzmacher [Wed, 23 Dec 2020 14:48:36 +0000 (15:48 +0100)] 
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>
4 years agos3:smbd: don't pass an unused smb_fname to reopen_from_procfd()
Stefan Metzmacher [Wed, 23 Dec 2020 15:03:37 +0000 (16:03 +0100)] 
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>
4 years agos3:smbd: let open_directory() also use fd_open_atomic() as reopen_from_procfd() fallback
Stefan Metzmacher [Wed, 23 Dec 2020 14:38:03 +0000 (15:38 +0100)] 
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>
4 years agos3:smbd: let open_pathref_base_fsp() make use of smb_fname_fsp_unlink()
Stefan Metzmacher [Wed, 16 Dec 2020 14:12:46 +0000 (15:12 +0100)] 
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>
4 years agos3:smbd: let openat_pathref_fsp() make use of fsp_attach_smb_fname()
Stefan Metzmacher [Wed, 16 Dec 2020 14:02:11 +0000 (15:02 +0100)] 
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>
4 years agos3:smbd: let openat_pathref_fsp() allocate fsp->fsp_name directly on fsp
Stefan Metzmacher [Wed, 16 Dec 2020 13:50:08 +0000 (14:50 +0100)] 
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>
4 years agos3:smbd: split out a fsp_attach_smb_fname() helper function
Stefan Metzmacher [Wed, 16 Dec 2020 14:01:38 +0000 (15:01 +0100)] 
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>
4 years agos3:smbd: let fsp_set_smb_fname() always link fsp to fsp->fsp_name->fsp
Stefan Metzmacher [Wed, 16 Dec 2020 13:15:11 +0000 (14:15 +0100)] 
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>
4 years agos3:smbd: let fsp_smb_fname_link() set both sides of the link
Stefan Metzmacher [Wed, 16 Dec 2020 13:03:36 +0000 (14:03 +0100)] 
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>
4 years agos3:smbd: rearrange move_smb_fname_fsp_link a bit
Stefan Metzmacher [Thu, 17 Dec 2020 10:05:21 +0000 (11:05 +0100)] 
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>
4 years agos4 auth ntlm: Fix integer overflow in authsam_password_check_and_record
Gary Lockyer [Tue, 12 Jan 2021 23:04:18 +0000 (12:04 +1300)] 
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

4 years agos3:libsmb: Use cli_credentials directly
Andreas Schneider [Wed, 13 Jan 2021 14:46:22 +0000 (15:46 +0100)] 
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

4 years agos3:libsmb: Pass cli_credentials to get_ipc_connect_master_ip()
Andreas Schneider [Wed, 13 Jan 2021 14:40:08 +0000 (15:40 +0100)] 
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>
4 years agos3:libsmb: Pass cli_credentials to get_ipc_connect()
Andreas Schneider [Wed, 13 Jan 2021 14:35:11 +0000 (15:35 +0100)] 
s3:libsmb: Pass cli_credentials to get_ipc_connect()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3:waf: Do not link tevent_glib_glue_test against popt_samba3
Andreas Schneider [Wed, 13 Jan 2021 13:59:20 +0000 (14:59 +0100)] 
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>
4 years agos3:waf: Do not link smbspool against popt_samba3
Andreas Schneider [Wed, 13 Jan 2021 13:58:10 +0000 (14:58 +0100)] 
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>
4 years agos3:utils: Remove unused popt_common.h header from log2pcaphex.c
Andreas Schneider [Wed, 13 Jan 2021 12:35:20 +0000 (13:35 +0100)] 
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>
4 years agos3:utils: Remove unused popt_common.h header from net_vfs.c
Andreas Schneider [Wed, 13 Jan 2021 12:23:47 +0000 (13:23 +0100)] 
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>
4 years agos3:utils: Remove unused popt_common.h header from net_rpc_shell.c
Andreas Schneider [Wed, 13 Jan 2021 08:31:41 +0000 (09:31 +0100)] 
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>
4 years agos3:utils: Fix header and deps of mvxattr
Andreas Schneider [Wed, 13 Jan 2021 08:11:04 +0000 (09:11 +0100)] 
s3:utils: Fix header and deps of mvxattr

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3:utils: Remove unused header and deps from destroy_netlogon_creds_cli
Andreas Schneider [Wed, 13 Jan 2021 08:04:01 +0000 (09:04 +0100)] 
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>
4 years agos3: smbd: Add call to conn_setup_case_options() to create_conn_struct_as_root().
Jeremy Allison [Tue, 12 Jan 2021 19:44:44 +0000 (11:44 -0800)] 
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

4 years agos3: smbd: Factor out setting up case parameters for a share to a function - conn_setu...
Jeremy Allison [Tue, 12 Jan 2021 19:39:51 +0000 (11:39 -0800)] 
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>
4 years agoWHATSNEW: Change order.
Karolin Seeger [Mon, 11 Jan 2021 11:51:20 +0000 (12:51 +0100)] 
WHATSNEW: Change order.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Autobuild-User(master): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(master): Tue Jan 12 10:12:02 UTC 2021 on sn-devel-184

4 years agoWHATSNEW: Add new parameters.
Karolin Seeger [Thu, 7 Jan 2021 08:04:50 +0000 (09:04 +0100)] 
WHATSNEW: Add new parameters.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agopython/wscript: python3-asn1 -> python3-pyasn1
Karolin Seeger [Tue, 5 Jan 2021 08:33:30 +0000 (09:33 +0100)] 
python/wscript: python3-asn1 -> python3-pyasn1

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
4 years agolib: Fix 'charset' dependencies
Volker Lendecke [Sat, 9 Jan 2021 17:26:00 +0000 (18:26 +0100)] 
lib: Fix 'charset' dependencies

With this, 'charset' could be a SAMBA_LIBRARY without any undefined symbols

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 12 01:19:26 UTC 2021 on sn-devel-184

4 years agolib: Avoid "includes.h" in lib/util/charset/
Volker Lendecke [Sat, 9 Jan 2021 17:22:15 +0000 (18:22 +0100)] 
lib: Avoid "includes.h" in lib/util/charset/

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove using talloc_stack from lib/util/charset/
Volker Lendecke [Sat, 9 Jan 2021 17:20:34 +0000 (18:20 +0100)] 
lib: Remove using talloc_stack from lib/util/charset/

'charset' should be as standalone as possible, and for this one use
talloc_stackframe() is not really necessary.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: lib/param/param.h references TALLOC_CTX
Volker Lendecke [Sun, 3 Jan 2021 20:52:06 +0000 (21:52 +0100)] 
lib: lib/param/param.h references TALLOC_CTX

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc: gen_ndr/dcerpc.h references DATA_BLOB
Volker Lendecke [Sun, 3 Jan 2021 20:51:34 +0000 (21:51 +0100)] 
librpc: gen_ndr/dcerpc.h references DATA_BLOB

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc: Align a few integer types
Volker Lendecke [Thu, 31 Dec 2020 09:16:21 +0000 (10:16 +0100)] 
librpc: Align a few integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_client: Simplify rpc_pipe_open_ncalrpc()
Volker Lendecke [Sun, 10 Jan 2021 17:42:18 +0000 (18:42 +0100)] 
rpc_client: Simplify rpc_pipe_open_ncalrpc()

Consolidate close(fd)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_client: Use common "goto fail" for all error cases
Volker Lendecke [Sun, 10 Jan 2021 17:31:33 +0000 (18:31 +0100)] 
rpc_client: Use common "goto fail" for all error cases

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_client: Fix an error path memleak in rpc_pipe_open_ncalrpc()
Volker Lendecke [Sun, 10 Jan 2021 17:31:17 +0000 (18:31 +0100)] 
rpc_client: Fix an error path memleak in rpc_pipe_open_ncalrpc()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_client: Error from rpc_pipe_open_ncalrpc() for path overflow
Volker Lendecke [Sun, 10 Jan 2021 17:28:20 +0000 (18:28 +0100)] 
rpc_client: Error from rpc_pipe_open_ncalrpc() for path overflow

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoepmapper3: Fix a DEBUG message
Volker Lendecke [Sun, 10 Jan 2021 12:16:43 +0000 (13:16 +0100)] 
epmapper3: Fix a DEBUG message

This is not function dcesrv_interface_register()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoepmapper3: Fix a typo
Volker Lendecke [Sun, 10 Jan 2021 12:15:49 +0000 (13:15 +0100)] 
epmapper3: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Fix an error path memleak
Volker Lendecke [Sun, 10 Jan 2021 12:12:26 +0000 (13:12 +0100)] 
rpc_server: Fix an error path memleak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Avoid a pointless ZERO_STRUCTP
Volker Lendecke [Sun, 10 Jan 2021 12:10:47 +0000 (13:10 +0100)] 
rpc_server: Avoid a pointless ZERO_STRUCTP

We've done talloc_zero() 4 lines above.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Move a variable closer to its use
Volker Lendecke [Sun, 10 Jan 2021 12:07:54 +0000 (13:07 +0100)] 
rpc_server: Move a variable closer to its use

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Fix a typo
Volker Lendecke [Sun, 10 Jan 2021 12:01:45 +0000 (13:01 +0100)] 
rpc_server: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoauth4: Use global_sid_Anonymous
Volker Lendecke [Sat, 9 Jan 2021 21:53:29 +0000 (22:53 +0100)] 
auth4: Use global_sid_Anonymous

dom_sid_dup() is much simpler than dom_sid_parse_talloc()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoauth4: Use global_sid_System
Volker Lendecke [Sat, 9 Jan 2021 21:51:38 +0000 (22:51 +0100)] 
auth4: Use global_sid_System

dom_sid_dup() is much simpler than dom_sid_parse_talloc()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Move utf16_len[_n]() to lib/util/charset/
Volker Lendecke [Tue, 5 Jan 2021 09:27:12 +0000 (10:27 +0100)] 
lib: Move utf16_len[_n]() to lib/util/charset/

util_unistr.c references it, avoid broken dependencies

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agobuild: Make smb_panic() available as a subsystem of its own
Volker Lendecke [Mon, 11 Jan 2021 12:59:00 +0000 (13:59 +0100)] 
build: Make smb_panic() available as a subsystem of its own

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Avoid all_string_sub() in smb_panic()
Volker Lendecke [Mon, 11 Jan 2021 12:55:38 +0000 (13:55 +0100)] 
lib: Avoid all_string_sub() in smb_panic()

smb_panic() should be available everywhere. Avoid a dependency on
all_string_sub(), this pulls in a lot of other dependencies. The only
change is that this uses "strstr" instead of "strstr_m", but having
non-ascii panic actions strings can be called rare.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agobuild: Move weird.c and charset_macosxfs.c to ICONV_WRAPPER
Volker Lendecke [Mon, 4 Jan 2021 13:25:36 +0000 (14:25 +0100)] 
build: Move weird.c and charset_macosxfs.c to ICONV_WRAPPER

iconv.c directly references them, it does not make sense to have it
without them.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Simplify "weird" charset code
Volker Lendecke [Mon, 4 Jan 2021 11:28:20 +0000 (12:28 +0100)] 
lib: Simplify "weird" charset code

Don't depend on DEBUG. This is a pure developer module, the developer
should be able to figure out what's going on after this has abort()ed.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Move ucs2_align() to 'charset' subsystem
Volker Lendecke [Mon, 4 Jan 2021 10:14:56 +0000 (11:14 +0100)] 
lib: Move ucs2_align() to 'charset' subsystem

Fix a circular dependency: util_str_common.c depends on 'charset',
which depends on util_str_common.c. Fix that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Slightly simplify smbd_smb2_create_send()
Volker Lendecke [Sun, 27 Dec 2020 11:13:51 +0000 (12:13 +0100)] 
smbd: Slightly simplify smbd_smb2_create_send()

If we return unconditionally, "else" is not needed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_glusterfs: support read dirfsps in vfs_gluster_openat()
Ralph Boehme [Mon, 11 Jan 2021 09:53:31 +0000 (10:53 +0100)] 
vfs_glusterfs: support read dirfsps in vfs_gluster_openat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jan 11 21:34:52 UTC 2021 on sn-devel-184

4 years agosmbd: pass O_DIRECTORY to fd_openat() for directories
Ralph Boehme [Mon, 11 Jan 2021 08:58:58 +0000 (09:58 +0100)] 
smbd: pass O_DIRECTORY to fd_openat() for directories

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 years agosmbd: move S_ISDIR check up a bit in openat_pathref_fsp()
Ralph Boehme [Mon, 11 Jan 2021 08:57:26 +0000 (09:57 +0100)] 
smbd: move S_ISDIR check up a bit in openat_pathref_fsp()

This relies on the caller having stat()ed smb_fname instead of relying on
fd_openat() fstat()ing fsp->fsp_name. Otherwise no change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 years agolibrpc: Use GUID_buf_string in dcerpc_binding_string()
Volker Lendecke [Thu, 31 Dec 2020 09:11:04 +0000 (10:11 +0100)] 
librpc: Use GUID_buf_string in dcerpc_binding_string()

Avoid a (small) memleak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jan 11 14:25:04 UTC 2021 on sn-devel-184

4 years agorpc_servers: Remove unused variables
Volker Lendecke [Thu, 7 Jan 2021 19:53:17 +0000 (20:53 +0100)] 
rpc_servers: Remove unused variables

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agorpc_servers: Fix crash with many interfaces
Volker Lendecke [Thu, 31 Dec 2020 14:10:10 +0000 (15:10 +0100)] 
rpc_servers: Fix crash with many interfaces

Previously, the lowlevel routines wrote into the pf_listen_fd arrays
without checking its size.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agorpc_server: Add dcesrv_create_endpoint_list_fd_listen_fds()
Volker Lendecke [Thu, 31 Dec 2020 13:49:26 +0000 (14:49 +0100)] 
rpc_server: Add dcesrv_create_endpoint_list_fd_listen_fds()

This encapsulates the loop in the three standalone rpc daemons walking
the endpoints in a dcesrv_context.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agorpc_server: Lift ph_listen_fd logic one level
Volker Lendecke [Thu, 31 Dec 2020 09:47:03 +0000 (10:47 +0100)] 
rpc_server: Lift ph_listen_fd logic one level

Push filling in struct pf_listen_fd into the daemons using
dcesrv_create_endpoint_sockets().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agorpc_server: Lift logic to fill in pf_listen_fd one level
Volker Lendecke [Thu, 31 Dec 2020 08:54:15 +0000 (09:54 +0100)] 
rpc_server: Lift logic to fill in pf_listen_fd one level

dcesrv_create_ncacn_ip_tcp_sockets() now returns a struct of fd's
instead of filling a preallocated array: Its only function beyond
dcesrv_open_ncacn_ip_tcp_sockets() is thus gone.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agorpc_server: Use dcesrv_open_ncacn_ip_tcp_sockets() in dcesrv_setup_ncacn_ip_tcp_sockets()
Volker Lendecke [Thu, 31 Dec 2020 08:47:18 +0000 (09:47 +0100)] 
rpc_server: Use dcesrv_open_ncacn_ip_tcp_sockets() in dcesrv_setup_ncacn_ip_tcp_sockets()

Avoid duplication of logic with "lp_interfaces_only()"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agorpc_server: Factor out dcesrv_open_ncacn_ip_tcp_sockets()
Volker Lendecke [Thu, 31 Dec 2020 08:21:25 +0000 (09:21 +0100)] 
rpc_server: Factor out dcesrv_open_ncacn_ip_tcp_sockets()

The main change is to return an allocated array of file descriptors in
dcesrv_open_ncacn_ip_tcp_sockets() instead of filling a preallocated
array of pf_listen_fd structures.

Signed-off-by: Volker Lendecke <vl@samba.org>
4 years agolib: Add samba_sockaddr_[gs]et_port()
Volker Lendecke [Wed, 30 Dec 2020 21:50:36 +0000 (22:50 +0100)] 
lib: Add samba_sockaddr_[gs]et_port()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolib: Move sockaddr_storage_to_samba_sockaddr() to lib/
Volker Lendecke [Wed, 30 Dec 2020 21:43:07 +0000 (22:43 +0100)] 
lib: Move sockaddr_storage_to_samba_sockaddr() to lib/

This can be useful outside of source3/libsmb/namequery.c as Samba
moves towards samba_sockaddr.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agovfs_fruit: fix close for fake_fd
Ralph Boehme [Fri, 11 Dec 2020 11:59:28 +0000 (12:59 +0100)] 
vfs_fruit: fix close for fake_fd

If the next backend doesn't use kernel fd's should not
pass a fake_fd to the next backend.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan  8 21:38:18 UTC 2021 on sn-devel-184

4 years agovfs_fruit: check fake_fd in fruit_pread_meta_stream()
Ralph Boehme [Fri, 11 Dec 2020 12:00:56 +0000 (13:00 +0100)] 
vfs_fruit: check fake_fd in fruit_pread_meta_stream()

Don't call into the next VFS backend if we know we still have a fake-fd. Just
return -1 and the caller has the logic to handle this, which results in
returning a AFP_AfpInfo blob initialized with some defaults.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: use "fake_fd" instead of "created"
Ralph Boehme [Fri, 11 Dec 2020 12:00:09 +0000 (13:00 +0100)] 
vfs_fruit: use "fake_fd" instead of "created"

Both have basically the same semantics.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_streams_xattr: make use of vfs_fake_fd_close()
Stefan Metzmacher [Fri, 18 Dec 2020 13:36:00 +0000 (14:36 +0100)] 
vfs_streams_xattr: make use of vfs_fake_fd_close()

When we used vfs_fake_fd() we should use vfs_fake_fd_close()
in order to have things symetric.

That may allows us to change vfs_fake_fd() internally if required.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: make use of vfs_fake_fd_close()
Stefan Metzmacher [Fri, 18 Dec 2020 13:36:00 +0000 (14:36 +0100)] 
vfs_fruit: make use of vfs_fake_fd_close()

When we used vfs_fake_fd() we should use vfs_fake_fd_close()
in order to have things symetric.

That may allows us to change vfs_fake_fd() internally if required.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:smbd: add vfs_fake_fd_close() helper
Stefan Metzmacher [Fri, 18 Dec 2020 13:03:09 +0000 (14:03 +0100)] 
s3:smbd: add vfs_fake_fd_close() helper

When we used vfs_fake_fd() we should use vfs_fake_fd_close()
in order to have things symetric.

This makes code easier to understand and may allow us to change
vfs_fake_fd() internally if required.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:torture/fruit: avoid sleep(10000000); if write_stream() fails
Stefan Metzmacher [Tue, 8 Dec 2020 14:47:53 +0000 (15:47 +0100)] 
s4:torture/fruit: avoid sleep(10000000); if write_stream() fails

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: Remove "developer.c" module
Volker Lendecke [Mon, 4 Jan 2021 11:22:13 +0000 (12:22 +0100)] 
s3: Remove "developer.c" module

This can't have been built since commit f9acf770e9c12 from 2011 when
smb_register_charset was removed.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopassdb: Fix a typo
Volker Lendecke [Sun, 27 Dec 2020 10:38:45 +0000 (11:38 +0100)] 
passdb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Initialize pointers in server_prefork.c
Volker Lendecke [Sun, 27 Dec 2020 07:50:34 +0000 (08:50 +0100)] 
lib: Initialize pointers in server_prefork.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Fix error path memleaks in prefork_create_pool()
Volker Lendecke [Sat, 26 Dec 2020 17:22:23 +0000 (18:22 +0100)] 
lib: Fix error path memleaks in prefork_create_pool()

A few return statements missed the "TALLOC_FREE(pfp);"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Make default prefork configs const
Volker Lendecke [Sat, 26 Dec 2020 09:04:42 +0000 (10:04 +0100)] 
rpc_server: Make default prefork configs const

Move 24 bytes from modifyable data to .text segment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Make pfh_daemon_config take a const default config
Volker Lendecke [Sat, 26 Dec 2020 08:59:04 +0000 (09:59 +0100)] 
lib: Make pfh_daemon_config take a const default config

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc: Fix an error path memleak
Volker Lendecke [Sat, 26 Dec 2020 08:27:10 +0000 (09:27 +0100)] 
librpc: Fix an error path memleak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: give global_contexts.c its own header file
Volker Lendecke [Sun, 3 Jan 2021 20:53:49 +0000 (21:53 +0100)] 
lib: give global_contexts.c its own header file

It's a bit shocking how many references we have to global
contexts. Make this a bit more obvious.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>