bbaumbach/samba-autobuild/.git
4 years agoscript/autobuild.py: add ENABLE_COVERAGE placeholder in configure cmd option
Joe Guo [Fri, 3 May 2019 14:37:25 +0000 (02:37 +1200)]
script/autobuild.py: add ENABLE_COVERAGE placeholder in configure cmd option

The value will be "--enable-coverage" or "".

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: replace more placeholders in cmds for coverage
Joe Guo [Mon, 6 May 2019 03:14:43 +0000 (15:14 +1200)]
script/autobuild.py: replace more placeholders in cmds for coverage

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: add --enable-coverage option
Joe Guo [Fri, 3 May 2019 14:32:40 +0000 (02:32 +1200)]
script/autobuild.py: add --enable-coverage option

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: mv optionparse to top
Joe Guo [Fri, 3 May 2019 10:41:51 +0000 (22:41 +1200)]
script/autobuild.py: mv optionparse to top

so the rest of the code can use the option values directly.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: mv find_git_root and gitroot to top
Joe Guo [Fri, 3 May 2019 10:34:32 +0000 (22:34 +1200)]
script/autobuild.py: mv find_git_root and gitroot to top

so the reset of the code can use gitroot directly.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: rename sdir to test_source_dir
Joe Guo [Fri, 3 May 2019 05:05:08 +0000 (17:05 +1200)]
script/autobuild.py: rename sdir to test_source_dir

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agowscript: mv --enable-coverage option to global
Joe Guo [Tue, 30 Apr 2019 05:21:15 +0000 (17:21 +1200)]
wscript: mv --enable-coverage option to global

We want to enable gcov for all tasks, move it to global wscript.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest/target/Samba4.pm: increase max_wait from 60s to 120s to avoid timeout failur...
Joe Guo [Mon, 6 May 2019 23:20:55 +0000 (11:20 +1200)]
selftest/target/Samba4.pm: increase max_wait from 60s to 120s to avoid timeout failure in samba-ad-dc-backup

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4 librpc rpc pyrpc: Ensure tevent_context deleted last
Gary Lockyer [Tue, 7 May 2019 23:30:20 +0000 (11:30 +1200)]
s4 librpc rpc pyrpc: Ensure tevent_context deleted last

Ensure that the tevent_context is deleted after the connection, to
prevent a use after free.

Note: Py_DECREF calls dcerpc_interface_dealloc so the
TALLOC_FREE(ret->mem_ctx) calls in the error paths of
py_dcerpc_interface_init_helper needed removal.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13932

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba_dnsupdate: flush dns update cache file after write
Joe Guo [Wed, 8 May 2019 05:21:27 +0000 (17:21 +1200)]
samba_dnsupdate: flush dns update cache file after write

While running samba python tests with `coverage.py`, `make test` failed
to start ad_dc env since dns_update_cache stays empty.
Flush the file after write fix the issue.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos3/rpcclient: Fix bad (and illegal) func cast
Noel Power [Fri, 3 May 2019 10:51:47 +0000 (11:51 +0100)]
s3/rpcclient: Fix bad (and illegal) func cast

../../source3/rpcclient/cmd_samr.c: In function ‘cmd_samr_get_usrdom_pwinfo’:
../../librpc/ndr/libndr.h:219:76: error: cast between incompatible function types from ‘void (*)(struct ndr_print *, const char *, uint32_t)’ {aka ‘void (*)(struct ndr_print *, const char *, unsigned int)’} to ‘void (*)(struct ndr_print *, const char *, const void *)’ [-Werror=cast-function-type]
 #define NDR_PRINT_STRUCT_STRING(ctx, type, p) ndr_print_struct_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, p)
                                                                            ^
../../source3/rpcclient/cmd_samr.c:2646:4: note: in expansion of macro ‘NDR_PRINT_STRUCT_STRING’
    NDR_PRINT_STRUCT_STRING(mem_ctx,

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 10 02:26:02 UTC 2019 on sn-devel-184

4 years agos3/registry: fix various 'cast between incompatible function' warnings
Noel Power [Fri, 3 May 2019 11:53:27 +0000 (12:53 +0100)]
s3/registry: fix various 'cast between incompatible function' warnings

[3395/3524] Compiling source3/registry/reg_import.c
../../source3/registry/reg_import.c: In function ‘reg_import_adapter’:
../../source3/registry/reg_import.c:237:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *, void **)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *, void **)’} [-Werror=cast-function-type]
   cb.openkey = (reg_import_callback_openkey_t)&nop;
                ^
../../source3/registry/reg_import.c:240:17: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *)’ {aka ‘struct <anonymous> (*)(void *, void *)’} [-Werror=cast-function-type]
   cb.closekey = (reg_import_callback_closekey_t)&nop;
                 ^
../../source3/registry/reg_import.c:243:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *, void **, _Bool *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *, void **, _Bool *)’} [-Werror=cast-function-type]
   cb.createkey = (reg_import_callback_createkey_t)&nop;
                  ^
../../source3/registry/reg_import.c:246:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *)’} [-Werror=cast-function-type]
   cb.deletekey = (reg_import_callback_deletekey_t)&nop;
                  ^
../../source3/registry/reg_import.c:249:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *)’} [-Werror=cast-function-type]
   cb.deleteval = (reg_import_callback_deleteval_t)&nop;

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3/registry: Fix incompatible func casts
Noel Power [Fri, 3 May 2019 11:06:45 +0000 (12:06 +0100)]
s3/registry: Fix incompatible func casts

[3425/3524] Compiling source3/registry/reg_parse.c
../../source3/registry/reg_parse.c: In function ‘reg_parse_new’:
../../source3/registry/reg_parse.c:223:12: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char **, size_t,  _Bool)’ {aka ‘int (*)(void *, const char **, long unsigned int,  _Bool)’} [-Werror=cast-function-type]
   cb.key = (reg_parse_callback_key_t)&nop;
            ^
../../source3/registry/reg_parse.c:226:12: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *, uint32_t,  const uint8_t *, uint32_t)’ {aka ‘int (*)(void *, const char *, unsigned int,  const unsigned char *, unsigned int)’} [-Werror=cast-function-type]
   cb.val = (reg_parse_callback_val_t)&nop;
            ^
../../source3/registry/reg_parse.c:229:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *)’ [-Werror=cast-function-type]
   cb.val_del = (reg_parse_callback_val_del_t)&nop;
                ^
../../source3/registry/reg_parse.c:232:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *)’ [-Werror=cast-function-type]
   cb.comment = (reg_parse_callback_comment_t)&nop;

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3/registry: Fix func cast error (diff in params size_t vs uint32)
Noel Power [Fri, 3 May 2019 11:21:07 +0000 (12:21 +0100)]
s3/registry: Fix func cast error (diff in params size_t vs uint32)

reg_parse_callback_key_t alread has size_t for number of elemens in key
but
reg_parse_callback_val_t uses uint32_t for length of value data.

Many internal function seem to take size_t as data len (see reg_format_value
etc.) It seems changing the signature of the callback aligns it more closely
with the existing api.

../../source3/registry/reg_format.c:438:10: error: cast between incompatible function types from ‘int (*)(reg_format *, const char *, uint32_t,  const uint8_t *, size_t)’ {aka ‘int (*)(struct reg_format *, const char *, unsigned int,  const unsigned char *, long unsigned int)’} to ‘int (*)(void *, const char *, uint32_t,  const uint8_t *, uint32_t)’ {aka ‘int (*)(void *, const char *, unsigned int,  const unsigned char *, unsigned int)’} [-Werror=cast-function-type]
   .val = (reg_parse_callback_val_t)&reg_format_value,

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4/lib/policy/gp_ldap: use ldb API to find messages
Douglas Bagnall [Wed, 10 Apr 2019 04:43:10 +0000 (16:43 +1200)]
s4/lib/policy/gp_ldap: use ldb API to find messages

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodsdb mod/linked_attributes: fix_link_slow(): clarify a comment.
Douglas Bagnall [Wed, 10 Apr 2019 04:38:52 +0000 (16:38 +1200)]
dsdb mod/linked_attributes: fix_link_slow(): clarify a comment.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodsdb/mod/extended_dn_out: use faster removal filters
Douglas Bagnall [Thu, 11 Apr 2019 01:14:24 +0000 (13:14 +1200)]
dsdb/mod/extended_dn_out: use faster removal filters

When filtering out multiple elements, we end up memmove()ing the same
elements many times over. It is simpler to not do that by keeping track
of how many elements we are keeping.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb_msg: remove_element() checks element array bounds
Douglas Bagnall [Sun, 7 Apr 2019 22:33:07 +0000 (10:33 +1200)]
ldb_msg: remove_element() checks element array bounds

Previously we half-heartedly checked one end.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb_kv: use ldb_msg_remove_element()
Douglas Bagnall [Sun, 7 Apr 2019 22:16:38 +0000 (10:16 +1200)]
ldb_kv: use ldb_msg_remove_element()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb/tools/ldbtest: initialise msg object
Douglas Bagnall [Sat, 6 Apr 2019 22:13:11 +0000 (10:13 +1200)]
ldb/tools/ldbtest: initialise msg object

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb_ldap: use ldb_msg API to add elements
Douglas Bagnall [Tue, 9 Apr 2019 08:29:59 +0000 (20:29 +1200)]
ldb_ldap: use ldb_msg API to add elements

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb_ldap: trust db_msg_new() to return empty message
Douglas Bagnall [Sat, 6 Apr 2019 22:12:02 +0000 (10:12 +1200)]
ldb_ldap: trust db_msg_new() to return empty message

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodsdb/replmd: use ldb_msg_remove_element()
Douglas Bagnall [Wed, 10 Apr 2019 04:40:34 +0000 (16:40 +1200)]
dsdb/replmd: use ldb_msg_remove_element()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodsdb mods/extended_dn_out: remove element using ldb_msg api
Douglas Bagnall [Wed, 10 Apr 2019 04:37:23 +0000 (16:37 +1200)]
dsdb mods/extended_dn_out: remove element using ldb_msg api

The bare memmove is not strictly safe at the end of the list.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodsdb/mod/extended_dn_out: zero whole fake_msg struct
Douglas Bagnall [Sat, 6 Apr 2019 01:20:25 +0000 (14:20 +1300)]
dsdb/mod/extended_dn_out: zero whole fake_msg struct

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4: use ldb_msg_new(), not talloc/talloc_zero
Douglas Bagnall [Mon, 15 Apr 2019 11:20:46 +0000 (23:20 +1200)]
s4: use ldb_msg_new(), not talloc/talloc_zero

ldb_msg_new() is currently the same as talloc_zero(), but it might
not always be.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb: use ldb_msg_new(), not talloc/talloc_zero
Douglas Bagnall [Sat, 6 Apr 2019 00:55:06 +0000 (13:55 +1300)]
ldb: use ldb_msg_new(), not talloc/talloc_zero

ldb_msg_new() is currently the same as talloc_zero(), but it might
not always be.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agokdb_kv_search: spell 'linearized'
Douglas Bagnall [Fri, 5 Apr 2019 03:29:14 +0000 (16:29 +1300)]
kdb_kv_search: spell 'linearized'

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodsdb/util: spell "equivalence"!
Douglas Bagnall [Sun, 7 Apr 2019 10:59:24 +0000 (22:59 +1200)]
dsdb/util: spell "equivalence"!

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb.h: spelling of 'means'
Douglas Bagnall [Mon, 8 Apr 2019 05:00:57 +0000 (17:00 +1200)]
ldb.h: spelling of 'means'

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb.h: improve comment for LDB_ATTR_FLAG_INDEXED
Douglas Bagnall [Mon, 15 Apr 2019 01:13:13 +0000 (13:13 +1200)]
ldb.h: improve comment for LDB_ATTR_FLAG_INDEXED

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4/policy/gp_filesys: avoid SIZE_MAX smbcli write (CID 1034779)
Douglas Bagnall [Wed, 8 May 2019 04:46:33 +0000 (16:46 +1200)]
s4/policy/gp_filesys: avoid SIZE_MAX smbcli write (CID 1034779)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4/messaging: do not deref NULL state (CID 1437973)
Douglas Bagnall [Wed, 8 May 2019 03:58:08 +0000 (15:58 +1200)]
s4/messaging: do not deref NULL state (CID 1437973)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4/ldap_bind: notice backend init failure
Douglas Bagnall [Wed, 8 May 2019 03:52:31 +0000 (15:52 +1200)]
s4/ldap_bind: notice backend init failure

This should silence CID 1418508 and CID 1418512

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoread_smb_length: Use correct function name in debug message
Michael Hanselmann [Wed, 8 May 2019 22:32:41 +0000 (00:32 +0200)]
read_smb_length: Use correct function name in debug message

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agogitlab-ci: Install libtasn1-tools on Fedora based distributions
Andreas Schneider [Thu, 9 May 2019 16:21:24 +0000 (18:21 +0200)]
gitlab-ci: Install libtasn1-tools on Fedora based distributions

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3: SMB1: Don't allow recvfile on stream fsp's.
Jeremy Allison [Thu, 9 May 2019 19:53:11 +0000 (12:53 -0700)]
s3: SMB1: Don't allow recvfile on stream fsp's.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May 10 01:14:02 UTC 2019 on sn-devel-184

4 years agodsdb/mod/count_attrs: set ldb var before using it (CID 1444979)
Douglas Bagnall [Wed, 8 May 2019 03:05:21 +0000 (15:05 +1200)]
dsdb/mod/count_attrs: set ldb var before using it (CID 1444979)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu May  9 23:54:35 UTC 2019 on sn-devel-184

4 years agos4/dsdb/util_samr: check some return codes (CID 1444977)
Douglas Bagnall [Wed, 8 May 2019 02:52:31 +0000 (14:52 +1200)]
s4/dsdb/util_samr: check some return codes (CID 1444977)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/dnsserver: delay return when trying to log (CID 1444976)
Douglas Bagnall [Wed, 8 May 2019 02:37:06 +0000 (14:37 +1200)]
s4/dnsserver: delay return when trying to log (CID 1444976)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/dnsserver: handle broken zone values in sort (CID 1414763, 1414769)
Douglas Bagnall [Wed, 8 May 2019 02:27:05 +0000 (14:27 +1200)]
s4/dnsserver: handle broken zone values in sort (CID 14147631414769)

We sort NULL values to the end of the list. What happens to the after
that is another question.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolibrpc/ndr: make push_charset_to_null UTF-16 safe (CID 1399648)
Douglas Bagnall [Wed, 8 May 2019 02:09:56 +0000 (14:09 +1200)]
librpc/ndr: make push_charset_to_null UTF-16 safe (CID 1399648)

The length is in test units, not bytes, and includes terminating
nulls. For 16-bit character sets, the terminating null must be two
bytes.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoldb modules: paged_search checks control is not NULL (CID 241355)
Douglas Bagnall [Wed, 8 May 2019 01:11:43 +0000 (13:11 +1200)]
ldb modules: paged_search checks control is not NULL (CID 241355)

It is unlikely to be NULL, since we're in the callback.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoldb_mdb: check fcntl return values (CID 1435851)
Douglas Bagnall [Wed, 8 May 2019 00:56:25 +0000 (12:56 +1200)]
ldb_mdb: check fcntl return values (CID 1435851)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoldb_map: check a return value (CID 241354)
Douglas Bagnall [Wed, 8 May 2019 00:50:30 +0000 (12:50 +1200)]
ldb_map: check a return value (CID 241354)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoldb_ldif: avoid NULL dereference with unexpected arguments (CID 1107195)
Douglas Bagnall [Wed, 8 May 2019 00:49:53 +0000 (12:49 +1200)]
ldb_ldif: avoid NULL dereference with unexpected arguments (CID 1107195)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoldb: avoid NULL deref in ldb_dn_from_ldb_val (CID 1034730)
Douglas Bagnall [Wed, 8 May 2019 00:31:36 +0000 (12:31 +1200)]
ldb: avoid NULL deref in ldb_dn_from_ldb_val (CID 1034730)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agopyrpc: remove crutch for python <= 2.5
Douglas Bagnall [Tue, 7 May 2019 01:31:12 +0000 (13:31 +1200)]
pyrpc: remove crutch for python <= 2.5

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agopyrpc: ndr PY_CHECK_TYPE checks for NULL as well as type
Douglas Bagnall [Tue, 7 May 2019 01:25:01 +0000 (13:25 +1200)]
pyrpc: ndr PY_CHECK_TYPE checks for NULL as well as type

Addresses CID 1361477 and others.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoauth/creds/torture: add a test showing segfault
Douglas Bagnall [Tue, 7 May 2019 01:22:10 +0000 (13:22 +1200)]
auth/creds/torture: add a test showing segfault

This file isn't actually run...

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoauth/creds/guess: avoid segfault with NULL lp (CID 241187)
Douglas Bagnall [Tue, 7 May 2019 00:51:09 +0000 (12:51 +1200)]
auth/creds/guess: avoid segfault with NULL lp (CID 241187)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agodsdb/modules/linked_attrs: remove pointless check (CID 240768)
Douglas Bagnall [Fri, 3 May 2019 05:51:16 +0000 (17:51 +1200)]
dsdb/modules/linked_attrs: remove pointless check (CID 240768)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agodsdb/modules/dirsync: ensure attrs exist (CID 1107212)
Douglas Bagnall [Fri, 3 May 2019 05:27:51 +0000 (17:27 +1200)]
dsdb/modules/dirsync: ensure attrs exist (CID 1107212)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agodsdb/modules/dirsync: remove useless function call
Douglas Bagnall [Fri, 3 May 2019 05:24:37 +0000 (17:24 +1200)]
dsdb/modules/dirsync: remove useless function call

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agodsdb/modules/dirsync: avoid possible NULL dereference (CID 1034800)
Douglas Bagnall [Fri, 3 May 2019 05:21:49 +0000 (17:21 +1200)]
dsdb/modules/dirsync: avoid possible NULL dereference (CID 1034800)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agodsdb/modules/acl: avoid deref of missing data (CID 1107200)
Douglas Bagnall [Fri, 3 May 2019 04:56:14 +0000 (16:56 +1200)]
dsdb/modules/acl: avoid deref of missing data (CID 1107200)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/auth/sam: silence CID 1435849
Douglas Bagnall [Fri, 3 May 2019 04:30:10 +0000 (16:30 +1200)]
s4/auth/sam: silence CID 1435849

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolib/texpect: avoid theoretical NULL dereference (CID 1273099)
Douglas Bagnall [Fri, 3 May 2019 04:15:30 +0000 (16:15 +1200)]
lib/texpect: avoid theoretical NULL dereference (CID 1273099)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agotdbtool: avoid theoretical NULL dereference (CID 1361462)
Douglas Bagnall [Fri, 3 May 2019 04:12:29 +0000 (16:12 +1200)]
tdbtool: avoid theoretical NULL dereference (CID 1361462)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/rpc/dcerpc_roh_channel_out: check ndr_init (CID 1273062)
Douglas Bagnall [Fri, 3 May 2019 04:06:40 +0000 (16:06 +1200)]
s4/rpc/dcerpc_roh_channel_out: check ndr_init (CID 1273062)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/rpc/dcerpc_roh_channel_out: check ndr_init (CID 1273065)
Douglas Bagnall [Fri, 3 May 2019 04:06:18 +0000 (16:06 +1200)]
s4/rpc/dcerpc_roh_channel_out: check ndr_init (CID 1273065)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/rpc/drsuapi/writespn: check the actual error code (CID 1034691)
Douglas Bagnall [Thu, 2 May 2019 23:29:37 +0000 (11:29 +1200)]
s4/rpc/drsuapi/writespn: check the actual error code (CID 1034691)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/rpc/dns: check for IP address errors at startup
Douglas Bagnall [Thu, 2 May 2019 22:47:28 +0000 (10:47 +1200)]
s4/rpc/dns: check for IP address errors at startup

The silent failure might leave an indeterminate or zero address.

CID: 1272838

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agorpc/dns: reduce the CID count on temporary variables
Douglas Bagnall [Thu, 2 May 2019 22:23:56 +0000 (10:23 +1200)]
rpc/dns: reduce the CID count on temporary variables

CID 1363189 and others.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agorpc/dns: leak less on memory failure (CID 1363191)
Douglas Bagnall [Thu, 2 May 2019 22:19:29 +0000 (10:19 +1200)]
rpc/dns: leak less on memory failure (CID 1363191)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agorpc/dnsdata: avoid crash on missing attr (CID: 1414757)
Douglas Bagnall [Thu, 2 May 2019 22:10:01 +0000 (10:10 +1200)]
rpc/dnsdata: avoid crash on missing attr (CID: 1414757)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agorpc/dnsdata: do not crash if message attr missing (CID: 1414773)
Douglas Bagnall [Thu, 2 May 2019 21:46:04 +0000 (09:46 +1200)]
rpc/dnsdata: do not crash if message attr missing (CID: 1414773)

This should be hard to trigger, but goto fail is always nicer than sig 11.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agotalloc torture: avoid NULL dereference
Douglas Bagnall [Wed, 1 May 2019 23:29:34 +0000 (11:29 +1200)]
talloc torture: avoid NULL dereference

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos3:smbd: don't use recvfile on streams
Ralph Boehme [Thu, 25 Apr 2019 08:57:58 +0000 (10:57 +0200)]
s3:smbd: don't use recvfile on streams

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13938

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu May  9 20:43:53 UTC 2019 on sn-devel-184

4 years agos3:smbspool: Fix regression printing with Kerberos credentials
Andreas Schneider [Thu, 9 May 2019 14:18:51 +0000 (16:18 +0200)]
s3:smbspool: Fix regression printing with Kerberos credentials

This is a regression which has been introduced with Samba 4.8.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu May  9 16:46:05 UTC 2019 on sn-devel-184

4 years agoctdb/build: fix ctdb_mutex_ceph_rados_helper builds
David Disseldorp [Thu, 18 Apr 2019 18:14:31 +0000 (20:14 +0200)]
ctdb/build: fix ctdb_mutex_ceph_rados_helper builds

2b5dbb352553699afce62dca4964eb0bd64477f8 fixed builds with an explicit
--with-libcephfs but broke builds against system Ceph libraries. This
change handles both cases.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu May  9 04:24:56 UTC 2019 on sn-devel-184

4 years agos4 lib socket: Ensure address string owned by parent struct
Gary Lockyer [Tue, 7 May 2019 04:30:22 +0000 (16:30 +1200)]
s4 lib socket: Ensure address string owned by parent struct

The local address string was not owned by it's parent structure, which
caused a use after free error in
continue_ip_open_socket source4/librpc/rpc/dcerpc_sock.c:267

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed May  8 20:03:42 UTC 2019 on sn-devel-184

4 years agog_lock: Fix a typo
Volker Lendecke [Mon, 6 May 2019 14:34:15 +0000 (16:34 +0200)]
g_lock: Fix a typo

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): Wed May  8 17:47:39 UTC 2019 on sn-devel-184

4 years agog_lock: Apply some const
Volker Lendecke [Mon, 6 May 2019 14:19:22 +0000 (16:19 +0200)]
g_lock: Apply some const

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agodbwrap: Adapt tdb_data_buf's overflow handling to modern conventions
Volker Lendecke [Fri, 3 May 2019 13:43:35 +0000 (15:43 +0200)]
dbwrap: Adapt tdb_data_buf's overflow handling to modern conventions

This is the way we do it right now, avoid confusion why "tmp" might be
needed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agodbwrap: Fix tdb_data_buf()
Volker Lendecke [Fri, 3 May 2019 13:42:42 +0000 (15:42 +0200)]
dbwrap: Fix tdb_data_buf()

IIRC there are platforms that don't like memcpy() with len=0.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:utils: If share is NULL in smbcacls, don't print it
Andreas Schneider [Wed, 8 May 2019 15:12:12 +0000 (17:12 +0200)]
s3:utils: If share is NULL in smbcacls, don't print it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:utils: If share is NULL in smbcquotas, don't print it
Andreas Schneider [Wed, 8 May 2019 15:11:13 +0000 (17:11 +0200)]
s3:utils: If share is NULL in smbcquotas, don't print it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbindd: Do not free db_path in idmap_tdb2 before we printed it
Andreas Schneider [Wed, 8 May 2019 15:05:58 +0000 (17:05 +0200)]
s3:winbindd: Do not free db_path in idmap_tdb2 before we printed it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoctdb:common: Do not print NULL if we don't get a sockpath
Andreas Schneider [Wed, 8 May 2019 15:03:54 +0000 (17:03 +0200)]
ctdb:common: Do not print NULL if we don't get a sockpath

sock_socket_start_recv() might not fill sockpath if we return early.

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:torture: Do not free full_name before we printed it
Andreas Schneider [Wed, 8 May 2019 14:58:07 +0000 (16:58 +0200)]
s4:torture: Do not free full_name before we printed it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib:torture: Fix string comparison macros where we directly pass NULL
Andreas Schneider [Wed, 8 May 2019 14:54:30 +0000 (16:54 +0200)]
lib:torture: Fix string comparison macros where we directly pass NULL

See e.g. lib/util/tests/strlist.c +177

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:torture: Do not print NULL strings we just checked before
Andreas Schneider [Wed, 8 May 2019 14:51:20 +0000 (16:51 +0200)]
s4:torture: Do not print NULL strings we just checked before

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:ntvfs: Do not free eadb before we printed an error
Andreas Schneider [Wed, 8 May 2019 14:32:45 +0000 (16:32 +0200)]
s4:ntvfs: Do not free eadb before we printed an error

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:rpc_server: Do not free the tdbname before we printed it
Andreas Schneider [Wed, 8 May 2019 14:31:10 +0000 (16:31 +0200)]
s3:rpc_server: Do not free the tdbname before we printed it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:auth: Fix debug statement in gensec_gssapi
Andreas Schneider [Wed, 8 May 2019 14:27:57 +0000 (16:27 +0200)]
s4:auth: Fix debug statement in gensec_gssapi

The 'role' is set to null, we should first set it to the correct value
before printing anything.

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoCID 1363286: Resource leak by failing to free tmp_ctx
Garming Sam [Tue, 7 May 2019 01:28:49 +0000 (13:28 +1200)]
CID 1363286: Resource leak by failing to free tmp_ctx

There are a few oddities in this function, including a duplicated NULL
check, a talloc_free of a context which is passed in and a number of
missing frees before a return.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Wed May  8 00:36:14 UTC 2019 on sn-devel-184

4 years agoCID 1363287: Resource leak using str_list_append
Garming Sam [Thu, 2 May 2019 05:11:57 +0000 (17:11 +1200)]
CID 1363287: Resource leak using str_list_append

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agowafsamba: Enable warnings about zero-length formats
Andreas Schneider [Thu, 14 Feb 2019 11:08:37 +0000 (12:08 +0100)]
wafsamba: Enable warnings about zero-length formats

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue May  7 18:45:06 UTC 2019 on sn-devel-184

4 years agowafsamba: Enable warnings about format overflows
Andreas Schneider [Thu, 14 Feb 2019 11:06:57 +0000 (12:06 +0100)]
wafsamba: Enable warnings about format overflows

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoctdb: Fix format in db_hash_test
Andreas Schneider [Mon, 29 Apr 2019 11:26:04 +0000 (13:26 +0200)]
ctdb: Fix format in db_hash_test

error: ‘%04d’ directive writing between 4 and 11 bytes into a region of
size 5 [-Werror=format-overflow=]
   sprintf(key, "key%04d", i);

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoctdb-tests: Don't clean up test var directory in autotest target
Martin Schwenke [Wed, 1 May 2019 05:17:14 +0000 (15:17 +1000)]
ctdb-tests: Don't clean up test var directory in autotest target

If the directory is always cleaned up then it is not possible to look
at daemon logs to debug test failures.

This target is only really used by autobuild.py, which (optionally)
cleans up the parent directory anyway.

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

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 May  7 06:56:01 UTC 2019 on sn-devel-184

4 years agoctdb-tests: Fix usage message
Martin Schwenke [Wed, 1 May 2019 05:10:28 +0000 (15:10 +1000)]
ctdb-tests: Fix usage message

Since commit 0e9ead8f28fced3ebfa888786a1dc5bb59e734a3 daemons have
been shut down after each test, so this option no longer has anything
to do with killing daemons.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tests: Wait to allow database attach/detach to take effect
Martin Schwenke [Sat, 27 Apr 2019 04:54:09 +0000 (14:54 +1000)]
ctdb-tests: Wait to allow database attach/detach to take effect

Sometimes the detach test fails:

  Check detaching single test database detach_test1.tdb
  BAD: database detach_test1.tdb is still attached
  Number of databases:4
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.0/db/volatile/detach_test4.tdb.0
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.0/db/volatile/detach_test3.tdb.0
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.0/db/volatile/detach_test2.tdb.0
  dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.0/db/volatile/detach_test1.tdb.0
  Number of databases:3
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.1/db/volatile/detach_test4.tdb.1
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.1/db/volatile/detach_test3.tdb.1
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.1/db/volatile/detach_test2.tdb.1
  Number of databases:4
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.2/db/volatile/detach_test4.tdb.2
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.2/db/volatile/detach_test3.tdb.2
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.2/db/volatile/detach_test2.tdb.2
  dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.2/db/volatile/detach_test1.tdb.2
  *** TEST COMPLETED (RC=1) AT 2019-04-27 03:35:40, CLEANING UP...

When issued from a client, the detach control re-broadcasts itself
asynchronously to all nodes and then returns success.  The controls to
some nodes to do the actual detach may still be in flight when success
is returned to the client.  Therefore, the test should wait for a few
seconds to allow the asynchronous controls to complete.

The same is true for the attach control, so workaround the problem in
the attach test too.

An alternative is to make the attach and detach controls synchronous
by avoiding the broadcast and waiting for the results of the
individual controls sent to the nodes.  However, a simple
implementation would involve adding new nested event loops.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tests: Avoid bulk output in $out, prefer $outfile
Martin Schwenke [Thu, 11 Apr 2019 10:55:20 +0000 (20:55 +1000)]
ctdb-tests: Avoid bulk output in $out, prefer $outfile

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tests: Make try_command_on_node less error-prone
Martin Schwenke [Thu, 28 Mar 2019 03:26:52 +0000 (14:26 +1100)]
ctdb-tests: Make try_command_on_node less error-prone

This sometimes fails, apparently due to a cat process in onnode
getting EAGAIN.  The conclusion is that tests that process large
amounts of output should not depend on a sub-shell delivering that
output into a shell variable.

Change try_command_on_node() to leave all of the output in file
$outfile and just put the first 1KB into $out.  $outfile is removed
after each test completes.

Change the implementation of sanity_check_output() to use $outfile
instead of $out.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tests: Change sanity_check_output() to internally use $out
Martin Schwenke [Tue, 30 Apr 2019 02:09:26 +0000 (12:09 +1000)]
ctdb-tests: Change sanity_check_output() to internally use $out

All callers are currently passed $out.  Global variable $out is used
in many other places so use it here to simplify the interface and make
future changes simpler.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-scripts: Drop script configuration variable CTDB_MONITOR_SWAP_USAGE
Martin Schwenke [Fri, 29 Mar 2019 00:19:55 +0000 (11:19 +1100)]
ctdb-scripts: Drop script configuration variable CTDB_MONITOR_SWAP_USAGE

CTDB's system memory monitoring in 05.system.script monitors both main
memory and swap.  The swap monitoring was originally based on
the (possibly incorrect, see below) idea that swap space stacks on top
of main memory, so that when a system starts filling swap space then
this is supposed to be a good sign that the system is running out of
memory.  Additionally, performance on a Linux system tends to be
destroyed by the I/O associated with a lot of swapping to spinning
disks.

However, some platforms default to creating only 4GB of swap space
even when there is 128GB of main memory.  With such a small swap to
main memory ratio, memory pressure can force swap to be nearly full
even when a significant amount of main memory is still available and
the system is performing well.  This suggests that checking swap
utilisation might be less than useful in many circumstances.

So, remove the separate swap space checking and change the memory
check to cover the total of main memory and swap space.

Test function set_mem_usage() still takes an argument for each of main
memory and swap space utilisation.  For simplicity, the same number is
now passed twice to make the intended results comprehensible.  This
could be changed later.

A couple of tests are cleaned up to no longer use hard-coded
/proc/meminfo and ps output.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tests: Extend test to cover ctdb rddumpmemory
Martin Schwenke [Thu, 11 Apr 2019 06:58:10 +0000 (16:58 +1000)]
ctdb-tests: Extend test to cover ctdb rddumpmemory

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tools: Fix ctdb dumpmemory to avoid printing trailing NUL
Martin Schwenke [Thu, 11 Apr 2019 06:56:32 +0000 (16:56 +1000)]
ctdb-tools: Fix ctdb dumpmemory to avoid printing trailing NUL

Fix ctdb rddumpmemory too.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>