kai/samba-autobuild/.git
5 years agowinbindd: Use is_domain_offline() where appropriate
Volker Lendecke [Fri, 18 May 2018 14:15:06 +0000 (16:15 +0200)]
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>
5 years agowinbindd: Align integer types in for loops
Volker Lendecke [Fri, 18 May 2018 12:47:24 +0000 (14:47 +0200)]
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>
5 years agoPossible memory leak in map_info6_to_validation
Swen Schillig [Fri, 25 May 2018 08:06:21 +0000 (10:06 +0200)]
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>
5 years agoFix several mem leaks in ldb_index ldb_search ldb_tdb
Andrej Gessel [Thu, 14 Jun 2018 10:19:29 +0000 (12:19 +0200)]
Fix several mem leaks in ldb_index ldb_search ldb_tdb

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

Signed-off-by: Andrej Gessel <Andrej.Gessel@janztec.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jun 15 23:07:25 CEST 2018 on sn-devel-144

5 years agoldb_tdb: Use mem_ctx and so avoid leak onto long-term memory on duplicated add.
Andrew Bartlett [Wed, 13 Jun 2018 09:20:00 +0000 (11:20 +0200)]
ldb_tdb: Use mem_ctx and so avoid leak onto long-term memory on duplicated add.

After a duplicated add a small amount of memory can be leaked onto a
long-term context.

Found by Andrej Gessel https://github.com/andiges

https://github.com/samba-team/samba/commit/e8fb45125e6a279b918694668e0d4fbddac10aee#commitcomment-29334102

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13471
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jun 15 04:39:41 CEST 2018 on sn-devel-144

5 years agosmbd: don't call change_to_root_user() before change_to_guest()
Stefan Metzmacher [Wed, 23 May 2018 12:26:37 +0000 (14:26 +0200)]
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

5 years agosmbd: remove useless allow_access() check for AS_GUEST
Stefan Metzmacher [Wed, 23 May 2018 12:23:17 +0000 (14:23 +0200)]
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>
5 years agosmbd: split out a fsp_flush_write_time_update() function from update_write_time_handler()
Stefan Metzmacher [Wed, 23 May 2018 07:41:29 +0000 (09:41 +0200)]
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>
5 years agosmbd: make smbd_setup_sig_{term,hup}_handler() static
Stefan Metzmacher [Thu, 24 May 2018 07:49:40 +0000 (09:49 +0200)]
smbd: make smbd_setup_sig_{term,hup}_handler() static

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agovfs_glusterfs: use tevent_req_defer_callback() in order to use the correct event...
Stefan Metzmacher [Wed, 23 May 2018 06:53:47 +0000 (08:53 +0200)]
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>
5 years agosmbd: call samba_tevent_context_init() within create_conn_struct_as_root()
Stefan Metzmacher [Fri, 25 May 2018 06:49:29 +0000 (08:49 +0200)]
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>
5 years agosmbd: use pconn = talloc_move(ctx, &conn) in create_conn_struct_as_root()
Stefan Metzmacher [Fri, 25 May 2018 06:49:29 +0000 (08:49 +0200)]
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>
5 years agosmbd: remove unused create_conn_struct() function
Stefan Metzmacher [Fri, 25 May 2018 06:49:29 +0000 (08:49 +0200)]
smbd: remove unused create_conn_struct() function

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: let create_conn_struct_tos() use create_conn_struct_as_root() directly
Stefan Metzmacher [Fri, 25 May 2018 06:49:29 +0000 (08:49 +0200)]
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>
5 years agovfstest: make use of create_conn_struct_tos()
Stefan Metzmacher [Fri, 25 May 2018 06:49:29 +0000 (08:49 +0200)]
vfstest: make use of create_conn_struct_tos()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: remove unused create_conn_struct_cwd() function
Stefan Metzmacher [Fri, 25 May 2018 06:49:29 +0000 (08:49 +0200)]
smbd: remove unused create_conn_struct_cwd() function

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoprinting: convert delete_driver_files() to use create_conn_struct_tos_cwd()
Stefan Metzmacher [Thu, 24 May 2018 15:55:02 +0000 (17:55 +0200)]
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>
5 years agoprinting: convert move_driver_to_download_area() to use create_conn_struct_tos_cwd()
Stefan Metzmacher [Thu, 24 May 2018 15:55:02 +0000 (17:55 +0200)]
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>
5 years agoprinting: convert get_correct_cversion() to use create_conn_struct_tos_cwd()
Stefan Metzmacher [Thu, 24 May 2018 15:55:02 +0000 (17:55 +0200)]
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>
5 years agoprinting: add an explicit talloc_stackframe() to delete_driver_files()
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
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>
5 years agoprinting: add an explicit talloc_stackframe() to move_driver_to_download_area()
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
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>
5 years agoprinting: add an explicit talloc_stackframe() to get_correct_cversion()
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
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>
5 years agoprinting: add more 'const' to read only input pointers
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
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>
5 years agos3:rpc_server/srvsvc: _srvsvc_NetSetFileSecurity form_junctions() to use create_conn_...
Stefan Metzmacher [Thu, 24 May 2018 15:55:02 +0000 (17:55 +0200)]
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>
5 years agos3:rpc_server/srvsvc: _srvsvc_NetGetFileSecurity() to use create_conn_struct_tos_cwd()
Stefan Metzmacher [Thu, 24 May 2018 15:55:02 +0000 (17:55 +0200)]
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>
5 years agos3:rpc_server/srvsvc: add an explicit talloc_stackframe() to _srvsvc_NetSetFileSecurity()
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
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>
5 years agos3:rpc_server/srvsvc: add an explicit talloc_stackframe() to _srvsvc_NetGetFileSecurity()
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
s3:rpc_server/srvsvc: add an explicit talloc_stackframe() to _srvsvc_NetGetFileSecurity()

This makes further changes simpler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: convert form_junctions() to use create_conn_struct_tos_cwd()
Stefan Metzmacher [Thu, 24 May 2018 15:55:02 +0000 (17:55 +0200)]
smbd: convert form_junctions() to use create_conn_struct_tos_cwd()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: convert count_dfs_links() to use create_conn_struct_tos_cwd()
Stefan Metzmacher [Thu, 24 May 2018 15:55:02 +0000 (17:55 +0200)]
smbd: convert count_dfs_links() to use create_conn_struct_tos_cwd()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: convert get_referred_path() to use create_conn_struct_tos_cwd()
Stefan Metzmacher [Thu, 24 May 2018 15:55:02 +0000 (17:55 +0200)]
smbd: convert get_referred_path() to use create_conn_struct_tos_cwd()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: convert junction_to_local_path() to use create_conn_struct_tos_cwd()
Stefan Metzmacher [Thu, 24 May 2018 15:55:02 +0000 (17:55 +0200)]
smbd: convert junction_to_local_path() to use create_conn_struct_tos_cwd()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: add an explicit talloc_stackframe() to form_junctions()
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
smbd: add an explicit talloc_stackframe() to form_junctions()

This makes further changes simpler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: add an explicit talloc_stackframe() to count_dfs_links()
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
smbd: add an explicit talloc_stackframe() to count_dfs_links()

This makes further changes simpler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: add an explicit talloc_stackframe() to get_referred_path()
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
smbd: add an explicit talloc_stackframe() to get_referred_path()

This makes further changes simpler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: add an explicit talloc_stackframe() to {create,remove}_msdfs_link()
Stefan Metzmacher [Thu, 24 May 2018 15:40:27 +0000 (17:40 +0200)]
smbd: add an explicit talloc_stackframe() to {create,remove}_msdfs_link()

This makes further changes simpler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3:rpc_server/fss: make use of create_conn_struct_tos()
Stefan Metzmacher [Thu, 24 May 2018 15:34:18 +0000 (17:34 +0200)]
s3:rpc_server/fss: make use of create_conn_struct_tos()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3:rpc_server/fss: use talloc_stackframe() for temporary memory
Stefan Metzmacher [Thu, 24 May 2018 14:41:32 +0000 (16:41 +0200)]
s3:rpc_server/fss: use talloc_stackframe() for temporary memory

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: make use of create_conn_struct_tos() in get_nt_acl_no_snum()
Stefan Metzmacher [Thu, 24 May 2018 14:34:04 +0000 (16:34 +0200)]
smbd: make use of create_conn_struct_tos() in get_nt_acl_no_snum()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopysmbd: make use of create_conn_struct_tos()
Stefan Metzmacher [Thu, 24 May 2018 14:16:19 +0000 (16:16 +0200)]
pysmbd: make use of create_conn_struct_tos()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopysmbd: remove explicit talloc_stackframe() from get_conn() and name it get_conn_tos()
Stefan Metzmacher [Thu, 24 May 2018 14:16:19 +0000 (16:16 +0200)]
pysmbd: remove explicit talloc_stackframe() from get_conn() and name it get_conn_tos()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopysmbd: fix some talloc_stackframe() memory leaks and clean up the frame hierarchy...
Stefan Metzmacher [Thu, 24 May 2018 14:16:19 +0000 (16:16 +0200)]
pysmbd: fix some talloc_stackframe() memory leaks and clean up the frame hierarchy in make_simple_acl().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopysmbd: consitently use talloc_stackframe() for temporary memory
Stefan Metzmacher [Thu, 24 May 2018 14:16:19 +0000 (16:16 +0200)]
pysmbd: consitently use talloc_stackframe() for temporary memory

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopysmbd: remove useless explicit conn_free() from set_nt_acl_conn()
Stefan Metzmacher [Fri, 25 May 2018 05:38:24 +0000 (07:38 +0200)]
pysmbd: remove useless explicit conn_free() from set_nt_acl_conn()

The following TALLOC_FREE(frame); will do the same via
conn_free_wrapper().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: add create_conn_struct_tos[_cwd]() helper functions
Stefan Metzmacher [Thu, 24 May 2018 13:59:43 +0000 (15:59 +0200)]
smbd: add create_conn_struct_tos[_cwd]() helper functions

This makes it more obvious that the returned connection_struct
is only temporary (and allocated on talloc_tos()!)
It will never allow async requests on a long term
tevent context! So we create a short term event context.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoprinting: remove unused arguments from delete_and_reload_printers()
Stefan Metzmacher [Wed, 23 May 2018 14:35:20 +0000 (16:35 +0200)]
printing: remove unused arguments from delete_and_reload_printers()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoprinting: remove unused arguments from load_printers()
Stefan Metzmacher [Wed, 23 May 2018 14:35:20 +0000 (16:35 +0200)]
printing: remove unused arguments from load_printers()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoCID 1416475: possibly dereferencing NULL in fruit_pread_meta
Swen Schillig [Fri, 25 May 2018 10:45:35 +0000 (12:45 +0200)]
CID 1416475: possibly dereferencing NULL in fruit_pread_meta

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jun 13 16:29:48 CEST 2018 on sn-devel-144

5 years agoCID 1416476: possibly dereferencing NULL in fruit_ftruncate_rsrc
Swen Schillig [Fri, 25 May 2018 10:43:42 +0000 (12:43 +0200)]
CID 1416476: possibly dereferencing NULL in fruit_ftruncate_rsrc

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoCID 1416477: possibly dereferencing NULL in fruit_pwrite_meta
Swen Schillig [Fri, 25 May 2018 09:39:50 +0000 (11:39 +0200)]
CID 1416477: possibly dereferencing NULL in fruit_pwrite_meta

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoCID 1416478: de-ref NULL value in fruit_pwrite_rsrc
Swen Schillig [Fri, 25 May 2018 09:32:38 +0000 (11:32 +0200)]
CID 1416478: de-ref NULL value in fruit_pwrite_rsrc

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agodsdb: Fix CID 1435968 Dereference before null check
Volker Lendecke [Tue, 12 Jun 2018 19:31:15 +0000 (21:31 +0200)]
dsdb: Fix CID 1435968 Dereference before null check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 13 13:40:56 CEST 2018 on sn-devel-144

5 years agodsdb: Fix CID 1435966 Unchecked return value
Volker Lendecke [Tue, 12 Jun 2018 19:22:10 +0000 (21:22 +0200)]
dsdb: Fix CID 1435966 Unchecked return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agodsdb: Fix typos
Volker Lendecke [Tue, 12 Jun 2018 19:18:18 +0000 (21:18 +0200)]
dsdb: Fix typos

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agodsdb: Fix CID 1436918 Unchecked return value
Volker Lendecke [Tue, 12 Jun 2018 19:15:55 +0000 (21:15 +0200)]
dsdb: Fix CID 1436918 Unchecked return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agodsdb: Fix CID 1436919 Unchecked return value
Volker Lendecke [Tue, 12 Jun 2018 19:12:47 +0000 (21:12 +0200)]
dsdb: Fix CID 1436919 Unchecked return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agodsdb: Fix CID 1436920 Unchecked return value
Volker Lendecke [Tue, 12 Jun 2018 19:09:40 +0000 (21:09 +0200)]
dsdb: Fix CID 1436920 Unchecked return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoFix UDP DNS queries in addns
Timur I. Bakeyev [Mon, 11 Jun 2018 20:38:00 +0000 (04:38 +0800)]
Fix UDP DNS queries in addns

The addns code tries to use common approach for TCP and UDP queries,
calling connect() for both types of sockets. In case of UDP that
requires to use send() instead of sendto().

Signed-off-by: Timur I. Bakeyev <timur@iXsystems.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 13 03:51:04 CEST 2018 on sn-devel-144

5 years agopython: call fault_setup() if samba.getopt is used
Stefan Metzmacher [Fri, 25 May 2018 05:52:40 +0000 (07:52 +0200)]
python: call fault_setup() if samba.getopt is used

This means we have a samba command line tool written in python,
e.g. samba-tool

We should get the samba typicall backtraces instead of
just "Segmentation fault (core dumped)".

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jun 12 11:04:55 CEST 2018 on sn-devel-144

5 years agopython: export fault_setup() to python bindings
Stefan Metzmacher [Fri, 25 May 2018 05:52:02 +0000 (07:52 +0200)]
python: export fault_setup() to python bindings

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 years agopython/drs_utils: fix repeated typo
Douglas Bagnall [Fri, 8 Jun 2018 03:36:39 +0000 (15:36 +1200)]
python/drs_utils: fix repeated typo

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sun Jun 10 21:41:33 CEST 2018 on sn-devel-144

5 years agopython/join: fix a typo
Douglas Bagnall [Thu, 7 Jun 2018 08:11:26 +0000 (20:11 +1200)]
python/join: fix a typo

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agosambatool visualize: add up-to-dateness visualization
Douglas Bagnall [Fri, 1 Jun 2018 05:20:56 +0000 (17:20 +1200)]
sambatool visualize: add up-to-dateness visualization

Or more accurately, out-of-dateness visualization, which shows how far
each DCs is from every other using the difference in the up-to-dateness
vectors.

An example usage is

samba-tool visualize uptodateness -r -S -H ldap://somewhere \
      -UAdministrator --color=auto --partition=DOMAIN

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agosamba-tool visualize ntdsconn: properly sort/group vertices
Douglas Bagnall [Fri, 1 Jun 2018 05:14:32 +0000 (17:14 +1200)]
samba-tool visualize ntdsconn: properly sort/group vertices

The vertex is now a tuple, with the RODC state added.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agosamba-tool visualize: fix wrong variable name in get_partition()
Douglas Bagnall [Tue, 6 Mar 2018 22:40:00 +0000 (11:40 +1300)]
samba-tool visualize: fix wrong variable name in get_partition()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopython/graph: don't crash colourer on bad link
Douglas Bagnall [Fri, 1 Jun 2018 04:55:37 +0000 (16:55 +1200)]
python/graph: don't crash colourer on bad link

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopython/graph: use '>' for excessive numbers, not '+'
Douglas Bagnall [Fri, 1 Jun 2018 04:51:19 +0000 (16:51 +1200)]
python/graph: use '>' for excessive numbers, not '+'

'+' already has another meaning in these graphs.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopython/graph: add full_matrix graph function
Douglas Bagnall [Fri, 1 Jun 2018 04:48:34 +0000 (16:48 +1200)]
python/graph: add full_matrix graph function

This makes an ASCII/ANSI art picture like distance_matrix(), but from
a full matrix, not a list of adjacencies as in the distance_matrix case.

This will be used to visualise up-to-dateness vectors.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopython/graph: rework shorten_vertex_names to not need edges
Douglas Bagnall [Fri, 1 Jun 2018 04:39:19 +0000 (16:39 +1200)]
python/graph: rework shorten_vertex_names to not need edges

This will be necessary for the forthcoming full_matrix function.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopython/samba/graph: use look up table for ascii-art charsets
Douglas Bagnall [Tue, 15 May 2018 10:26:43 +0000 (22:26 +1200)]
python/samba/graph: use look up table for ascii-art charsets

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agosamba-tool visualize: separate dot options from common options
Douglas Bagnall [Thu, 24 May 2018 03:22:47 +0000 (15:22 +1200)]
samba-tool visualize: separate dot options from common options

because not all sub-commands make dot format

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agosamba-tool visualise: helper for getting the partition
Douglas Bagnall [Thu, 29 Mar 2018 02:52:25 +0000 (15:52 +1300)]
samba-tool visualise: helper for getting the partition

Repeated code becomes a function.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopython/graph: tweak colour schemes for distance charts
Douglas Bagnall [Thu, 24 May 2018 02:42:37 +0000 (14:42 +1200)]
python/graph: tweak colour schemes for distance charts

This works a bit better in terminals with white text.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agosamba-tool drs showrepl: add a --verbose flag
Douglas Bagnall [Thu, 7 Jun 2018 02:35:38 +0000 (14:35 +1200)]
samba-tool drs showrepl: add a --verbose flag

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agosamba-tool drs showrepl: generalise the way output mode is chosen
Douglas Bagnall [Fri, 9 Mar 2018 03:16:23 +0000 (16:16 +1300)]
samba-tool drs showrepl: generalise the way output mode is chosen

We have a couple more output modes coming along, so it makes senses to
untangle .run() into a number of independent sub-methods.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agosamba-tool drs showrepl tests: don't assert existence of DNS partitions
Douglas Bagnall [Sat, 9 Jun 2018 08:35:30 +0000 (20:35 +1200)]
samba-tool drs showrepl tests: don't assert existence of DNS partitions

Because their existence is uncertain immediately after provision,
when these tests will run under some circumstances.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopython/kcc/graph_utils: short-cut edge failure test without edges
Douglas Bagnall [Sat, 9 Jun 2018 08:07:37 +0000 (20:07 +1200)]
python/kcc/graph_utils: short-cut edge failure test without edges

Otherwise we get an exception because itertools.combinations is asked
to find combinations with negative size.

Instead we assert the graph is connected as-is, which in this case is
the same as asserting there are no vertices.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib/audit_logging fix flapping test
Gary Lockyer [Sat, 9 Jun 2018 12:58:51 +0000 (14:58 +0200)]
lib/audit_logging fix flapping test

Add an adjustment to the before and after values to cater for the
occasional differences between the calculated times.

The exact value of the time stamp is not important what is important is
that is correctly formatted and that the value is reasonable i.e. it's
close enough to the current time.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agodsdb: Use ldb_init() to make the ldb_context in dsdb audit tests
Andrew Bartlett [Thu, 7 Jun 2018 07:50:15 +0000 (09:50 +0200)]
dsdb: Use ldb_init() to make the ldb_context in dsdb audit tests

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Jun  9 17:42:38 CEST 2018 on sn-devel-144

5 years agodsdb: add defines for sessionInfo and networkSessionInfo
Gary Lockyer [Thu, 31 May 2018 03:12:46 +0000 (15:12 +1200)]
dsdb: add defines for sessionInfo and networkSessionInfo

Replace uses of the string "sessionInfo" with the constant
DSDB_SESSION_INFO, and "networkSessionInfo" with the constant
DSDB_NETWORK_SESSION_INFO.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agodsdb: Audit group membership changes
Gary Lockyer [Mon, 16 Apr 2018 02:03:14 +0000 (14:03 +1200)]
dsdb: Audit group membership changes

Log details of Group membership changes and User Primary Group changes.
Changes are logged in human readable and if samba has been built with
JANSSON support in JSON format.

Replicated updates are not logged.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agodsdb: audit samdb and password changes
Gary Lockyer [Tue, 3 Apr 2018 23:59:41 +0000 (11:59 +1200)]
dsdb: audit samdb and password changes

Add audit logging of DSDB operations and password changes, log messages
are logged in human readable format and if samba is commpile with
JANSSON support in JSON format.

Log:
  * Details all DSDB add, modify and delete operations. Logs
    attributes, values, session details, transaction id.
  * Transaction roll backs.
  * Prepare commit and commit failures.
  * Summary details of replicated updates.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos4-heimdal: Fix the format-truncation errors.
Günther Deschner [Wed, 30 May 2018 07:27:49 +0000 (09:27 +0200)]
s4-heimdal: Fix the format-truncation errors.

../source4/heimdal/lib/com_err/compile_et.c: In function ‘generate_h’:
../source4/heimdal/lib/com_err/compile_et.c:138:33: error: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 126 [-Werror=format-truncation=]
     snprintf(fn, sizeof(fn), "__%s__", hfn);
                                 ^~     ~~~
../source4/heimdal/lib/com_err/compile_et.c:138:5: note: ‘snprintf’ output between 5 and 132 bytes into a destination of size 128
     snprintf(fn, sizeof(fn), "__%s__", hfn);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../source4/heimdal/lib/com_err/compile_et.c: In function ‘main’:
../source4/heimdal/lib/com_err/compile_et.c:234:35: error: ‘.h’ directive output may be truncated writing 2 bytes into a region of size between 1 and 128 [-Werror=format-truncation=]
     snprintf(hfn, sizeof(hfn), "%s.h", Basename);
                                   ^~
../source4/heimdal/lib/com_err/compile_et.c:234:5: note: ‘snprintf’ output between 3 and 130 bytes into a destination of size 128
     snprintf(hfn, sizeof(hfn), "%s.h", Basename);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../source4/heimdal/lib/com_err/compile_et.c:235:35: error: ‘.c’ directive output may be truncated writing 2 bytes into a region of size between 1 and 128 [-Werror=format-truncation=]
     snprintf(cfn, sizeof(cfn), "%s.c", Basename);
                                   ^~
../source4/heimdal/lib/com_err/compile_et.c:235:5: note: ‘snprintf’ output between 3 and 130 bytes into a destination of size 128
     snprintf(cfn, sizeof(cfn), "%s.c", Basename);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

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

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jun  8 13:23:51 CEST 2018 on sn-devel-144

5 years agoWHATSNEW.txt: Updated with VFS ABI changes for 4.9.0.
Jeremy Allison [Thu, 7 Jun 2018 07:47:30 +0000 (00:47 -0700)]
WHATSNEW.txt: Updated with VFS ABI changes for 4.9.0.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Thu Jun  7 13:48:25 CEST 2018 on sn-devel-144

5 years agotests/demote: replace demote test bash script to python
Joe Guo [Wed, 6 Jun 2018 03:01:28 +0000 (15:01 +1200)]
tests/demote: replace demote test bash script to python

Convert bash script to python and add demote and dns remove test on top.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Jun  7 04:21:17 CEST 2018 on sn-devel-144

5 years agonetcmd/domain: remove dns records after DC demote
Joe Guo [Tue, 5 Jun 2018 22:38:11 +0000 (10:38 +1200)]
netcmd/domain: remove dns records after DC demote

Call `remove_dc.remove_dns_references()` at the end of demote cmd.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
5 years agonetcmd/domain: fix a typo in message
Joe Guo [Tue, 5 Jun 2018 22:37:20 +0000 (10:37 +1200)]
netcmd/domain: fix a typo in message

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
5 years agoctdb-daemon: CID 1435732: Argument cannot be negative
Swen Schillig [Fri, 25 May 2018 06:23:17 +0000 (08:23 +0200)]
ctdb-daemon: CID 1435732: Argument cannot be negative

Negative parameter passed to function which cannot take negative values.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Jun  6 01:13:18 CEST 2018 on sn-devel-144

5 years agoctdb-common: Add support to run events through failure
Amitay Isaacs [Thu, 17 May 2018 03:32:37 +0000 (13:32 +1000)]
ctdb-common: Add support to run events through failure

Usually run_event will stop executing event scripts on first failure.
Optionally it can continue to run events even on failure(s).

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-common: Reset running state on failure
Amitay Isaacs [Thu, 10 May 2018 08:49:06 +0000 (18:49 +1000)]
ctdb-common: Reset running state on failure

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-common: Improve error handling in run_event
Amitay Isaacs [Thu, 10 May 2018 06:50:35 +0000 (16:50 +1000)]
ctdb-common: Improve error handling in run_event

If event script directory does not exist, then return ENOTDIR.  If a
directory gets removed at runtime, report error from scandir in
get_script_list().

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-common: Return script_list for zero scripts
Amitay Isaacs [Thu, 10 May 2018 02:43:24 +0000 (12:43 +1000)]
ctdb-common: Return script_list for zero scripts

When an event script directory is empty, do not return script_list as
NULL.  Instead return empty script_list with zero scripts.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-common: Rename run_event_script_list to run_event_list
Amitay Isaacs [Thu, 10 May 2018 03:50:01 +0000 (13:50 +1000)]
ctdb-common: Rename run_event_script_list to run_event_list

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-common: Do not initialize run_proc inside run_event
Amitay Isaacs [Wed, 9 May 2018 06:42:40 +0000 (16:42 +1000)]
ctdb-common: Do not initialize run_proc inside run_event

Allowing run_event_init() to take run_proc_context as an argument allows
to create multiple run_event instances with a single run_proc_context.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-common: Simplify process registration using linked list
Amitay Isaacs [Wed, 9 May 2018 04:07:35 +0000 (14:07 +1000)]
ctdb-common: Simplify process registration using linked list

The way run_proc abstraction is used in run_event, there can be maximum
of 2 processes active at any given time.  So the memory requirements
can be reduced by using a linked list.

New eventd will have multiple run_event instances but will be limited to
3 or 4.  Even then the total number of processes will be less than 10.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Continue running if a testcase is not executable
Martin Schwenke [Fri, 18 May 2018 01:44:11 +0000 (11:44 +1000)]
ctdb-tests: Continue running if a testcase is not executable

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Jun  5 20:37:15 CEST 2018 on sn-devel-144

5 years agoRevert "ctdb-tests: Continue running if a testcase is not executable"
Martin Schwenke [Fri, 18 May 2018 01:39:49 +0000 (11:39 +1000)]
Revert "ctdb-tests: Continue running if a testcase is not executable"

This reverts commit 36e7043fb16ac996793545022147f696caedee9c.

An recent change broke this and I forgot to test before posting. :-(

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-scripts: Change directory for notifications to events/notification
Martin Schwenke [Wed, 16 May 2018 02:18:46 +0000 (12:18 +1000)]
ctdb-scripts: Change directory for notifications to events/notification

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-scripts: Event scripts must end with ".script" suffix
Martin Schwenke [Tue, 15 May 2018 08:36:29 +0000 (18:36 +1000)]
ctdb-scripts: Event scripts must end with ".script" suffix

Preparation for recommending configuration for each script next to the
actual script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-scripts: Move event scripts to events/legacy/ directory
Martin Schwenke [Tue, 15 May 2018 03:39:15 +0000 (13:39 +1000)]
ctdb-scripts: Move event scripts to events/legacy/ directory

This is the initial location that will be used by the new
multi-component aware event daemon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agodsdb: Honour LDB_FLG_NOSYNC for metadata.tdb
Andrew Bartlett [Sun, 3 Jun 2018 06:36:47 +0000 (18:36 +1200)]
dsdb: Honour LDB_FLG_NOSYNC for metadata.tdb

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jun  4 20:58:01 CEST 2018 on sn-devel-144