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

51090 Commits

Author SHA1 Message Date
Andreas Schneider
9f28d30633 s3:winbind: Do not lookup local system accounts in AD
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13503

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jul  4 23:55:56 CEST 2018 on sn-devel-144
2018-07-04 23:55:56 +02:00
Andreas Schneider
8e96e9ea46 nsswitch: Add tests to lookup user via getpwnam
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13503

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-07-04 21:07:10 +02:00
David Mulder
a958dc35bb samba-gpupdate: Change machine option to target
On a Windows client, you designate machine/user
apply with a 'target' parameter. This change
makes gpupdate work more like that command.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-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): Wed Jul  4 13:23:09 CEST 2018 on sn-devel-144
2018-07-04 13:23:09 +02:00
David Mulder
c8621948f6 samba_gpoupdate: Rename the command to samba-gpupdate
On a Windows client, this command is called 'gpupdate'

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-07-04 10:22:15 +02:00
Ralph Boehme
c5fa4b1531 s3: lib/ctdbd_conn: include .h, not .c
Probably a copy/paste mistake. Detected by a failing autobuild on
sn-devel and a local make test:

Build failed: default/examples/libsmbclient/testbrowse2: Symbol
tevent_req_is_unix_error linked in multiple libraries
['samba-cluster-support', 'tevent-util']
UNEXPECTED(failure): wafsamba.duplicate_symbols.duplicate_symbols(none)

Wonder why this didn't fail before in autobuild.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jul  4 01:19:50 CEST 2018 on sn-devel-144
2018-07-04 01:19:50 +02:00
Joe Guo
1078c969ab pysmbd: add py_smbd_create_file
Add create_file function to smbd API.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-06-28 09:25:09 +02:00
Joe Guo
747c3f1fb3 pysmbd: extract init_files_struct function
Extract initialization code from set_nt_acl_conn for reuse.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-06-28 09:25:09 +02:00
Joe Guo
f1566c2ef9 pysmbd: add py_smbd_mkdir
Add mkdir for smbd API.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-06-28 09:25:09 +02:00
Justin Stephenson
f90f434e04 s3:tests: Add test for smbclient --quiet
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13485

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Baumbach <bb@sernet.de>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jun 26 20:29:19 CEST 2018 on sn-devel-144
2018-06-26 20:29:19 +02:00
Justin Stephenson
89a8b3ecd4 s3:client: Add --quiet option to smbclient
Add quiet command-line argument to allow suppressing the help log
message printed automatically after establishing a smbclient connection

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

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Baumbach <bb@sernet.de>
2018-06-26 17:43:25 +02:00
Andrew Bartlett
1bb2a1c6b3 auth: For NTLM and KDC authentication, log the authentication duration
This is not a general purpose profiling solution, but these JSON logs are already being
generated and stored, so this is worth adding.

Some administrators are very keen to know how long authentication
takes, particularly due to long replication transactions in other
processes.

This complements a similar patch set to log the transaction duration.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2018-06-25 08:32:14 +02:00
Jeremy Allison
47c3155517 s3: smbd: Don't use getcwd() directly. We must always go through the VFS.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2018-06-21 13:08:17 +02:00
Andreas Schneider
c1c764925e s3:winbind: Fix regression introduced with bso #12851
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12851

Pair-Programmed-With: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jun 21 01:03:52 CEST 2018 on sn-devel-144
2018-06-21 01:03:52 +02:00
Andreas Schneider
4a3164e0be s3:smbget: Fix buffer truncation issues with gcc8
../source3/utils/smbget.c: In function ‘smb_download_file’:
../source3/utils/smbget.c:97:27: error: ‘b’ directive output may be truncated writing 1 byte into a region of size between 0 and 19 [-Werror=format-truncation=]
   snprintf(buffer, l, "%jdb", (intmax_t)s);
                           ^

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2018-06-20 22:22:07 +02:00
Andreas Schneider
29f6842ee8 s3:registry: Fix buffer truncation issues issues with gcc8
../source3/registry/reg_perfcount.c: In function ‘reg_perfcount_get_hkpd’:
../source3/registry/reg_perfcount.c:337:29: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
   snprintf(buf, buflen,"%d%s", key_part1, key_part2);

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2018-06-20 22:22:07 +02:00
Swen Schillig
bca97cc473 Possible memory leak in map_info3_to_validation
In case of a failing call to copy_netr_SamInfo3, the allocated memory
for "validation" needs to be free'd before returning.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 20 21:05:40 CEST 2018 on sn-devel-144
2018-06-20 21:05:40 +02:00
Volker Lendecke
e078991ae7 winbind: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jun 19 11:43:16 CEST 2018 on sn-devel-144
2018-06-19 11:43:16 +02:00
Volker Lendecke
b81990095f lib: Align integer types
Loop-variable and bound should be the same type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2018-06-19 08:59:11 +02:00
Volker Lendecke
ea50825acf idmap_hash: Align integer types
Loop-variable and bound should be the same type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2018-06-19 08:59:11 +02:00
Andreas Schneider
95dcdd3d4f testparm: Remove warning from the last century
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2018-06-19 08:59:11 +02:00
Volker Lendecke
877266f775 librpc/crypto: Fix a misleading comment
Probably cut&paste error

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

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jun 18 18:34:51 CEST 2018 on sn-devel-144
2018-06-18 18:34:51 +02:00
Stefan Metzmacher
721fbbfa70 smbd: remove unused smbd_server_connection->ev_ctx
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jun 18 11:46:36 CEST 2018 on sn-devel-144
2018-06-18 11:46:36 +02:00
Stefan Metzmacher
894e5001c7 smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing
In future this will an impersonation wrapper tevent_context based on the
user session.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:21 +02:00
Stefan Metzmacher
f2df8be16b smbd: add an effective connection_struct->user_ev_ctx that holds the event context used for the current user
This will be filled with an impersonation wrapper in the next commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:21 +02:00
Stefan Metzmacher
c835ffa72d smbd: use sconn->root_ev_ctx for smbd_sig_{term,hup}_handler()
They already call change_to_root_user(), which can be removed
later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:21 +02:00
Stefan Metzmacher
182991c26c smbd: use sconn->root_ev_ctx for brl_timeout_fn()
This already calls change_to_root_user(), which can be removed
later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:21 +02:00
Stefan Metzmacher
146938217e smbd: add smbd_server_connection->{root,guest}_ev_ctx pointer
For now these are just the same as smbd_server_connection->ev_ctx,
but this will change in future and we'll use impersonation wrappers.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:21 +02:00
Stefan Metzmacher
f5f9b71974 smbd: use raw_ev_ctx to clear the MSG_SMB_CONF_UPDATED registration
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
dc517b20f6 smbd: explain that/why we use the raw tevent_context for linux_oplock_signal_handler()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
1d5210b615 smbd: explain that/why we use the raw tevent_context for do_break_to_none()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
e73eaa3c80 smbd: explain that/why we use the raw tevent_context for oplock_timeout_handler()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
52f098d38d smbd: explain that/why we use the raw tevent_context for lease_timeout_handler()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
7cfafaf190 smbd: explain that/why we use the raw tevent_context for update_write_time_handler()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
b0af5715b0 vfs_glusterfs: explain that/why we use the raw tevent_context in init_gluster_aio()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
6114f9545f smbd: add smbd_server_connection->raw_ev_ctx pointer
This will replace smbd_server_connection->ev_ctx in the next commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
c059f0ae72 smbd: use req->xconn->client->raw_ev_ctx for schedule_deferred_open_message_smb()
process_smb() will redo the impersonation anyway.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
4d5d8d62e4 s3:smb2_server: use req->xconn->client->raw_ev_ctx for smbd_smb2_request_dispatch_immediate()
smbd_smb2_request_dispatch() will redo the impersonation anyway,
so we don't use req->ev_ctx.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
051c32167c s3:smb2_server: use req->xconn->client->raw_ev_ctx for smbd_smb2_request_pending_timer()
There's no need to use req->ev_ctx here just to do some network io.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:19 +02:00
Stefan Metzmacher
934b375639 smbd: remove unused tevent_context argument from notify_init
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
d2adcebda1 smbd: replace xconn->msg_ctx with xconn->client->msg_ctx
This is the same pointer and we don't have a lot of callers,
so we can just use one pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
d39f6ce3b1 smbd: replace xconn->ev_ctx with xconn->client->raw_ev_ctx
This is the same pointer and we don't have a lot of callers,
so we can just use one pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
19119a5549 smbd: rename smbXsrv_client->ev_ctx into smbXsrv_client->raw_ev_ctx
That makes it clearer that no tevent_context wrapper is used here
and the related code should really run without any (active) impersonation
as before.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
db83a8f7c8 vfs_default: maintain vfswrap_offload_write_state->{src_ev,dst_ev}
These get filled with impersonation wrappers in the following commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
506c9b37df vfs_default: make use of change_to_user_by_fsp() in order to switch between src and dst fsp
This may matter if at least one share uses "force user".

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
2d75da9f61 vfs_btrfs: make use of become_user_by_fsp() in order to switch between src and dst fsp
We can use become_user_by_fsp()/unbecome_user() as it spans only parts of
the btrfs_offload_write_send() function and never goes async in between.

This may matter if at least one share uses "force user".

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
e4fb4c1d0e smbd: add {become,change_to}_user_by_fsp() helper functions
This can be used if a request operates on two fsp's,
e.g. the offload_write_send/recv code.
This is important if (at least) one of
the shares uses "force user".

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
4512b91897 vfs_btrfs: don't keep state->subreq in btrfs_offload_write_send/recv()
This can be a local variable as used in most of our tevent_req based
code.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
2317316233 vfs_btrfs: update s/btrfs_cc_state/btrfs_offload_write_state/ s/cc_state/state/
This matches our naming conventions used for tevent_req based functions.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
5ac91e487d vfs_btrfs: remove unused checks which are already caught by vfs_offload_token_check_handles()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
4af45b8ff6 vfs_default: remove unused checks which are already caught by vfs_offload_token_check_handles()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
3194999f0b smbd: avoid calling set_current_user_info() twice with .need_tcon (SMB2)
It's already called via change_to_user().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
60dbaa490c smbd: avoid calling set_current_user_info() twice with AS_USER (SMB1)
It will be called via change_to_user().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
ff7efafe73 smbd: remove unused set_current_service()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
4a97448cc9 smbd: let switch_message() only call chdir_current_service() for SMBtdis/SMBexit
These are the two opcodes with DO_CHDIR, we don't want the
set_current_case_sensitive() logic for them,
so we don't need the full set_current_service() anymore.

The AS_USER case is already handled before, set_current_case_sensitive()
is called directly before change_to_user(), which already
calls chdir_current_service().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
d1c8057997 smbd: call chdir_current_service() in change_to_user_internal() and pop_conn_ctx()
change_to_user() should be the one and only function for the whole
impersonation processing. So we also need to stack the
chdir_current_service() behaviour for become_user/unbecome_user,
so we may need to call vfs_ChDir(ctx_p->conn, ctx_p->conn->cwd_fname);
in pop_conn_ctx().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
b27d885478 smbd: remove set_current_service() from smbd_smb2_request_check_tcon()
The change_to_user() above already called chdir_current_service().
And for smb2 we don't have per packet conn->case_sensitive anyway.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
03f69e82fc smbd: remove set_current_service() from defer_rename_done()
The change_to_user() above already called chdir_current_service().
And for smb2 we don't have per packet conn->case_sensitive anyway.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
58f4bbc103 smbd: call chdir_current_service() directly in smbXsrv_tcon_disconnect()
There's no need to worry about conn->case_sensitive here.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
1b86df90d2 smbd: remove useless set_current_service(NULL,0,True) from reload_services()
All this does is 'return false' as conn is NULL...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
a61d0aa35b smbd: use conn->lastused_count++ directly in process_blocking_lock_queue()
This avoids using set_current_service(), which will be removed shortly.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
f407a86b74 smbd: let create_conn_struct_as_root() fill in conn->origpath
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:17 +02:00
Stefan Metzmacher
0e2786a91f smbd: make it possible to call vfs_ChDir(conn, conn->cwd_fname);
We should only TALLOC_FREE(old_cwd) at the successful end.
This also avoids calling cp_smb_filename() on the old value.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
ffe1918e81 smbd: call set_current_case_sensitive() before change_to_user() in switch_message()
change_to_user() will soon call chdir_current_service() and we should
make sure conn->case_sensitive is prepared before calling vfs_ChDir().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
0186ff2324 smbd: remember that the tcon completely setup connection_struct
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
5472171bdb smbd: make it explicit that make_connection_snum() returns NT_STATUS_OK on success
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
8cfe36eee9 smbd: call set_current_user_info() in change_to_user_internal() and pop_conn_ctx()
change_to_user() should be the one and only function for the whole
impersonation processing. So we also need to stack the
set_current_user_info() information for become_user/unbecome_user.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
91a3796481 smbd: move current_user caching to change_to_user_internal()
Note that (current_user.vuid == vuid) also works with
UID_FIELD_INVALID.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
35a12e7009 smbd: simplify the logic in change_to_user()
We can return early if (vuser == NULL).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
e469d6c730 smbd: let check_user_ok() construct ent->session_info in one coherent block
We should finish manipulating ent->session_info before filling
conn->session_info. And conn->session_info should be not be changed.

Use git show -U15.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
0e7456d286 smbd: call set_current_case_sensitive() before chdir_current_service()
I guess we better setup conn->case_sensitive before doing the
vfs_ChDir() calls, so we have a consistent result everytime.
Otherwise vfs_Chdir() would get conn->case_sensitive from
last request.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
8e81090789 smbd: split out set_current_case_sensitive() and chdir_current_service() functions
We'll soon use them independend from set_current_service().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
71d5809188 smbd: remove xconn->client->last_session_id based set_current_user_info() caching
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:16 +02:00
Stefan Metzmacher
df5e459299 s3:lib: add caching to set_current_user_info()
Currently we do that in the caller, but we use global
cache anyway, so we can simplify the callers.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:15 +02:00
Volker Lendecke
bced81cd6c winbindd: Fix winbindd_ping_dc_recv
tevent_req_simple_recv_ntstatus is only for the one-liner without any
additional functionality.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-16 01:06:36 +02:00
Volker Lendecke
e67d605b8b winbindd: Add a missing NULL check
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-16 01:06:36 +02:00
Volker Lendecke
b394026f47 winbindd: Do an early TALLOC_FREE
Leave the if-block without leaking

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-16 01:06:36 +02:00
Volker Lendecke
73b183e138 winbindd: Use is_domain_offline() where appropriate
That if-condition is precisely covered by the helper routine

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-16 01:06:36 +02:00
Volker Lendecke
ea4b40e65a winbindd: Align integer types in for loops
Iterate over the same type as the loop limit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-16 01:06:36 +02:00
Swen Schillig
4dac6e7cd0 Possible memory leak in map_info6_to_validation
If the call to copy_netr_SamInfo6 returns an error status,
the allocated memory for "validation" needs to be free'd before returning.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2018-06-16 01:06:36 +02:00
Stefan Metzmacher
5ef6775919 smbd: don't call change_to_root_user() before change_to_guest()
This is just an optimization and it makes it clearer
that calling change_to_root_user() just before change_to_guest()
is useless and confusing.

We call change_to_guest() before set_current_service() now,
but that has no impact as we pass 'do_chdir=false'
as AS_GUEST is never mixed with AS_USER or DO_CHDIR.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jun 14 23:38:55 CEST 2018 on sn-devel-144
2018-06-14 23:38:55 +02:00
Stefan Metzmacher
9393d95f22 smbd: remove useless allow_access() check for AS_GUEST
We already call allow_access() when we accept the connection
in smbd_add_connection().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
51407b90d9 smbd: split out a fsp_flush_write_time_update() function from update_write_time_handler()
It's confusing to call update_write_time_handler() from anywhere,
it should only be called from within the event loop when the
timer expires.

This makes it more obvious that fsp_flush_write_time_update()
doesn't really need an tevent context argument.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
553df61946 smbd: make smbd_setup_sig_{term,hup}_handler() static
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
55b1b5568f vfs_glusterfs: use tevent_req_defer_callback() in order to use the correct event context
The callback and _recv() functions should be called from the same
event context that was passed to the _send() function.

In future the completion pipe should be replaced by
tevent_threaded_context_create()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
efce558797 smbd: call samba_tevent_context_init() within create_conn_struct_as_root()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
ee8ea5ce01 smbd: use pconn = talloc_move(ctx, &conn) in create_conn_struct_as_root()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
d156483d64 smbd: remove unused create_conn_struct() function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
b5302c6bc4 smbd: let create_conn_struct_tos() use create_conn_struct_as_root() directly
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
b71362b176 vfstest: make use of create_conn_struct_tos()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
cdb875f5f7 smbd: remove unused create_conn_struct_cwd() function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
240c47c2aa printing: convert delete_driver_files() to use create_conn_struct_tos_cwd()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Stefan Metzmacher
ae32a2681a printing: convert move_driver_to_download_area() to use create_conn_struct_tos_cwd()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:22 +02:00
Stefan Metzmacher
76297c3c17 printing: convert get_correct_cversion() to use create_conn_struct_tos_cwd()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:22 +02:00
Stefan Metzmacher
e56bb427d3 printing: add an explicit talloc_stackframe() to delete_driver_files()
This makes further changes simpler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:22 +02:00
Stefan Metzmacher
a2ad24f8b0 printing: add an explicit talloc_stackframe() to move_driver_to_download_area()
This makes further changes simpler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:22 +02:00
Stefan Metzmacher
bad43d3131 printing: add an explicit talloc_stackframe() to get_correct_cversion()
This makes further changes simpler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:22 +02:00
Stefan Metzmacher
7d493eaeb1 printing: add more 'const' to read only input pointers
This makes it clearer that they won't be changed.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:22 +02:00
Stefan Metzmacher
498830ccd2 s3:rpc_server/srvsvc: _srvsvc_NetSetFileSecurity form_junctions() to use create_conn_struct_tos_cwd()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:22 +02:00
Stefan Metzmacher
f9860b67be s3:rpc_server/srvsvc: _srvsvc_NetGetFileSecurity() to use create_conn_struct_tos_cwd()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:22 +02:00
Stefan Metzmacher
185d47159a s3:rpc_server/srvsvc: add an explicit talloc_stackframe() to _srvsvc_NetSetFileSecurity()
This makes further changes simpler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:22 +02:00