samba.git
4 years agoctdb-recoverd: Periodically log recovery master of incomplete cluster
Martin Schwenke [Mon, 15 Jul 2019 22:58:33 +0000 (08:58 +1000)]
ctdb-recoverd: Periodically log recovery master of incomplete cluster

Only do this if the recovery lock is unset.  Log every minute for the
first 10 minutes, then every 10 minutes, then every hour.

This is useful for determining whether a split brain occurred.  It is
particularly useful if logging failed or was throttled at startup, so
there is no evidence of the split brain when it began.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Log the master at the end of elections
Martin Schwenke [Sun, 14 Jul 2019 23:15:04 +0000 (09:15 +1000)]
ctdb-recoverd: Log the master at the end of elections

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tests: Add tests for empty values in config file
Amitay Isaacs [Thu, 25 Jul 2019 05:15:43 +0000 (15:15 +1000)]
ctdb-tests: Add tests for empty values in config file

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-common: Fix empty value handling in conf
Amitay Isaacs [Thu, 25 Jul 2019 05:14:32 +0000 (15:14 +1000)]
ctdb-common: Fix empty value handling in conf

In tini, allow_empty_value=false causes the parser to ignore the lines
without '=' sign, but lines with nothing after '=' sign are allowed and
cause empty string ("") to be passed as a value.

This is counter-intuitive, so conf requires special handling for empty
values (which are treated as invalid).

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-tests: Use required_error instead of required_result
Amitay Isaacs [Thu, 25 Jul 2019 05:15:23 +0000 (15:15 +1000)]
ctdb-tests: Use required_error instead of required_result

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agos3:rpc_server: Only dump passwords in developer builds
Andreas Schneider [Tue, 16 Jul 2019 14:13:17 +0000 (16:13 +0200)]
s3:rpc_server: Only dump passwords in developer builds

Signed-off-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 Jul 26 03:05:01 UTC 2019 on sn-devel-184

4 years agonetlogon: Fix potential use of uninitialized variable
David Disseldorp [Fri, 12 Jul 2019 15:29:23 +0000 (17:29 +0200)]
netlogon: Fix potential use of uninitialized variable

The _netr_NetrEnumerateTrustedDomains()->dcerpc_lsa_open_policy2() error
path checks the policy handle and closes it if non-empty. The policy
handle may be uninitialized in this code-path - fix this.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Use a stackframe for temporary memory
Andreas Schneider [Tue, 16 Jul 2019 14:02:12 +0000 (16:02 +0200)]
s3:rpc_server: Use a stackframe for temporary memory

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:utils: Use a stackframe for temporary memory
Andreas Schneider [Tue, 16 Jul 2019 13:49:43 +0000 (15:49 +0200)]
s3:utils: Use a stackframe for temporary memory

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpcclient: Use a stackframe for temporary memory
Andreas Schneider [Tue, 16 Jul 2019 13:45:51 +0000 (15:45 +0200)]
s3:rpcclient: Use a stackframe for temporary memory

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:lib: Use the passed mem_ctx instead of talloc_tos()
Andreas Schneider [Tue, 16 Jul 2019 13:20:23 +0000 (15:20 +0200)]
s3:lib: Use the passed mem_ctx instead of talloc_tos()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:crypto: Don't build RC4 if we have GnuTLS >= 3.4.7
Andreas Schneider [Fri, 22 Feb 2019 12:28:01 +0000 (13:28 +0100)]
lib:crypto: Don't build RC4 if we have GnuTLS >= 3.4.7

We have a GnuTLS DCEPRC backupkey implementation for the server and the
test. However this is only working with GnuTLS >= 3.4.7. So we need to
keep this around till we can require at least GnuTLS in a newer version.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:crypto: Remove arcfour.h from crypto.h
Andreas Schneider [Tue, 26 Feb 2019 17:18:36 +0000 (18:18 +0100)]
lib:crypto: Remove arcfour.h from crypto.h

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:crypto: Use GnuTLS RC4 in py_crypto
Andreas Schneider [Fri, 22 Feb 2019 11:59:13 +0000 (12:59 +0100)]
lib:crypto: Use GnuTLS RC4 in py_crypto

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in testjoin RPC test
Andreas Schneider [Fri, 22 Feb 2019 12:06:34 +0000 (13:06 +0100)]
s4:torture: Use init_samr_CryptPassword in testjoin RPC test

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use samba_gnutls_arcfour_confounded_md5() in test_ChangePasswordRandomBytes
Andrew Bartlett [Thu, 25 Jul 2019 01:07:48 +0000 (13:07 +1200)]
s4:torture: Use samba_gnutls_arcfour_confounded_md5() in test_ChangePasswordRandomBytes

This ensures GnuTLS is used as the underlying RC4 crypto engine

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:torture: Use GnuTLS RC4 in test_ChangePasswordRandomBytes
Andreas Schneider [Wed, 24 Jul 2019 14:01:31 +0000 (16:01 +0200)]
s4:torture: Use GnuTLS RC4 in test_ChangePasswordRandomBytes

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in test_ChangePasswordRandomBytes
Andrew Bartlett [Thu, 25 Jul 2019 05:43:23 +0000 (17:43 +1200)]
s4:torture: Use init_samr_CryptPassword in test_ChangePasswordRandomBytes

This allows the use of GnuTLS for the underlying RC4 crypto

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:torture: clarify comments and variable names in "ChangePasswordUser3 tests
Andrew Bartlett [Thu, 25 Jul 2019 05:18:50 +0000 (17:18 +1200)]
s4:torture: clarify comments and variable names in "ChangePasswordUser3 tests

There is no session key here, the buffers are directly encrypted
with the long-term passwords.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in test_ChangePasswordUser3
Andreas Schneider [Wed, 24 Jul 2019 14:01:02 +0000 (16:01 +0200)]
s4:torture: Use init_samr_CryptPassword in test_ChangePasswordUser3

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use GnuTLS RC4 in test_ChangePasswordUser2_ntstatus
Andreas Schneider [Wed, 24 Jul 2019 14:00:32 +0000 (16:00 +0200)]
s4:torture: Use GnuTLS RC4 in test_ChangePasswordUser2_ntstatus

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4_torture: Use GnuTLS RC4 in test_ChangePasswordUser2
Andreas Schneider [Wed, 24 Jul 2019 14:24:18 +0000 (16:24 +0200)]
s4_torture: Use GnuTLS RC4 in test_ChangePasswordUser2

This uses STR_ASCII as string encodings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in test_ChangePasswordUser2_ntstatus
Andrew Bartlett [Thu, 25 Jul 2019 04:52:41 +0000 (16:52 +1200)]
s4:torture: Use init_samr_CryptPassword in test_ChangePasswordUser2_ntstatus

This allows the use of GnuTLS for the RC4 crypto operation

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in test_ChangePasswordUser2
Andrew Bartlett [Thu, 25 Jul 2019 04:46:06 +0000 (16:46 +1200)]
s4:torture: Use init_samr_CryptPassword in test_ChangePasswordUser2

This allows the use of GnuTLS for the RC4 crypto operation

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:torture: Use GnuTLS RC4 in test_OemChangePasswordUser2
Andreas Schneider [Wed, 24 Jul 2019 14:49:53 +0000 (16:49 +0200)]
s4:torture: Use GnuTLS RC4 in test_OemChangePasswordUser2

This uses STR_ASCII for password encoding!

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in test_SetUserPass_level_ex
Andreas Schneider [Wed, 24 Jul 2019 13:59:19 +0000 (15:59 +0200)]
s4:torture: Use init_samr_CryptPassword in test_SetUserPass_level_ex

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in test_SetUserPass_25
Andreas Schneider [Wed, 24 Jul 2019 13:58:38 +0000 (15:58 +0200)]
s4:torture: Use init_samr_CryptPassword in test_SetUserPass_25

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in test_SetUserPassEx
Andreas Schneider [Wed, 24 Jul 2019 13:58:06 +0000 (15:58 +0200)]
s4:torture: Use init_samr_CryptPassword in test_SetUserPassEx

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in test_SetUserPass_23
Andreas Schneider [Wed, 24 Jul 2019 13:57:25 +0000 (15:57 +0200)]
s4:torture: Use init_samr_CryptPassword in test_SetUserPass_23

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword in test_SetUserPass
Andreas Schneider [Wed, 24 Jul 2019 13:56:08 +0000 (15:56 +0200)]
s4:torture: Use init_samr_CryptPassword in test_SetUserPass

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use init_samr_CryptPassword(Ex) in samba3rpc test
Andreas Schneider [Thu, 21 Feb 2019 09:21:39 +0000 (10:21 +0100)]
s4:torture: Use init_samr_CryptPassword(Ex) in samba3rpc test

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Use GnuTLS RC4 for RAP SAM test
Andreas Schneider [Wed, 20 Feb 2019 14:52:49 +0000 (15:52 +0100)]
s4:torture: Use GnuTLS RC4 for RAP SAM test

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:rpc_server: Use GnuTLS RC4 for samr password
Andreas Schneider [Tue, 19 Feb 2019 16:40:29 +0000 (17:40 +0100)]
s4:rpc_server: Use GnuTLS RC4 for samr password

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:rpc_server: Use samba_gnutls_arcfour_confounded_md5() in samr_set_password_ex()
Andrew Bartlett [Thu, 25 Jul 2019 00:50:57 +0000 (12:50 +1200)]
s4:rpc_server: Use samba_gnutls_arcfour_confounded_md5() in samr_set_password_ex()

This allows the use of GnuTLS for the underlying RC4 crypto operations.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:utils: Use GnuTLS RC4 in ntlm_auth
Andreas Schneider [Thu, 17 Jan 2019 11:40:21 +0000 (12:40 +0100)]
s3:utils: Use GnuTLS RC4 in ntlm_auth

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Use GnuTLS RC4 to decrypt samr password buffers
Andreas Schneider [Wed, 15 May 2019 12:04:31 +0000 (14:04 +0200)]
s3:rpc_server: Use GnuTLS RC4 to decrypt samr password buffers

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Use GnuTLS RC4 in samr password check
Andreas Schneider [Wed, 16 Jan 2019 16:40:13 +0000 (17:40 +0100)]
s3:rpc_server: Use GnuTLS RC4 in samr password check

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_client: Use init_samr_CryptPassword in cli_samr rpc_client
Andreas Schneider [Wed, 16 Jan 2019 11:41:32 +0000 (12:41 +0100)]
s3:rpc_client: Use init_samr_CryptPassword in cli_samr rpc_client

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:libsmb: Use GnuTLS RC4 in clirap
Andreas Schneider [Tue, 15 Jan 2019 17:14:17 +0000 (18:14 +0100)]
s3:libsmb: Use GnuTLS RC4 in clirap

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoauth:ntlmssp: Use GnuTLS RC4 for ntlmssp signing
Andreas Schneider [Thu, 6 Dec 2018 17:11:14 +0000 (18:11 +0100)]
auth:ntlmssp: Use GnuTLS RC4 for ntlmssp signing

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoauth:ntlmssp: Use GnuTLS RC4 in ntlmssp client
Andreas Schneider [Fri, 9 Nov 2018 11:29:55 +0000 (12:29 +0100)]
auth:ntlmssp: Use GnuTLS RC4 in ntlmssp client

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Use samba_gnutls_arcfour_confounded_md5() in decode_wkssvc_join_password...
Andreas Schneider [Mon, 8 Jul 2019 16:21:18 +0000 (18:21 +0200)]
libcli:auth: Use samba_gnutls_arcfour_confounded_md5() in decode_wkssvc_join_password_buffer()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Use samba_gnutls_arcfour_confounded_md5() in encode_wkssvc_join_password...
Andreas Schneider [Mon, 8 Jul 2019 16:03:00 +0000 (18:03 +0200)]
libcli:auth: Use samba_gnutls_arcfour_confounded_md5() in encode_wkssvc_join_password_buffer()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Add test for (encode|decode)_wkssvc_join_password_buffer
Andreas Schneider [Mon, 8 Jul 2019 15:36:58 +0000 (17:36 +0200)]
libcli:auth: Add test for (encode|decode)_wkssvc_join_password_buffer

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Return WERROR for encode_wkssvc_join_password_buffer()
Andreas Schneider [Wed, 29 May 2019 13:50:45 +0000 (15:50 +0200)]
libcli:auth: Return WERROR for encode_wkssvc_join_password_buffer()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:libnet: Use GnuTLS RC4 in libnet_ChangePassword_samr()
Andreas Schneider [Thu, 25 Jul 2019 03:15:46 +0000 (15:15 +1200)]
s4:libnet: Use GnuTLS RC4 in libnet_ChangePassword_samr()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:libnet: Use GnuTLS RC4 in libnet_SetPassword_samr_handle_23()
Andreas Schneider [Fri, 1 Feb 2019 12:38:21 +0000 (13:38 +0100)]
s4:libnet: Use GnuTLS RC4 in libnet_SetPassword_samr_handle_23()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:libnet: Use GnuTLS RC4 in libnet_SetPassword_samr_handle_24()
Andreas Schneider [Fri, 1 Feb 2019 12:38:21 +0000 (13:38 +0100)]
s4:libnet: Use GnuTLS RC4 in libnet_SetPassword_samr_handle_24()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:libnet: Use encode_rc4_passwd_buffer() in libnet_SetPassword_samr_handle_25()
Andreas Schneider [Tue, 9 Jul 2019 11:11:54 +0000 (13:11 +0200)]
s4:libnet: Use encode_rc4_passwd_buffer() in libnet_SetPassword_samr_handle_25()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:libnet: Use encode_rc4_passwd_buffer() in libnet_SetPassword_samr_handle_26()
Andreas Schneider [Tue, 9 Jul 2019 11:01:49 +0000 (13:01 +0200)]
s4:libnet: Use encode_rc4_passwd_buffer() in libnet_SetPassword_samr_handle_26()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_client: Use encode_rc4_passwd_buffer() in init_samr_CryptPasswordEx()
Andreas Schneider [Wed, 24 Jul 2019 09:44:51 +0000 (11:44 +0200)]
s3:rpc_client: Use encode_rc4_passwd_buffer() in init_samr_CryptPasswordEx()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Add test for encode_rc4_passwd_buffer()
Andreas Schneider [Tue, 9 Jul 2019 11:06:49 +0000 (13:06 +0200)]
libcli:auth: Add test for encode_rc4_passwd_buffer()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Add encode_rc4_passwd_buffer()
Andreas Schneider [Tue, 9 Jul 2019 11:01:10 +0000 (13:01 +0200)]
libcli:auth: Add encode_rc4_passwd_buffer()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Pass samr_CryptPasswordEx to decode_rc4_passwd_buffer()
Andreas Schneider [Tue, 9 Jul 2019 10:53:31 +0000 (12:53 +0200)]
libcli:auth: Pass samr_CryptPasswordEx to decode_rc4_passwd_buffer()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Rename encode_or_decode_arc4_passwd_buffer()
Andreas Schneider [Fri, 5 Jul 2019 08:12:43 +0000 (10:12 +0200)]
libcli:auth: Rename encode_or_decode_arc4_passwd_buffer()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Use samba_gnutls_arcfour_confounded_md5() for rc4 passwd buffer
Andreas Schneider [Fri, 5 Jul 2019 08:09:32 +0000 (10:09 +0200)]
libcli:auth: Use samba_gnutls_arcfour_confounded_md5() for rc4 passwd buffer

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_client: Use GnuTLS RC4 in init_samr_CryptPassword()
Andreas Schneider [Wed, 16 Jan 2019 12:15:08 +0000 (13:15 +0100)]
s3:rpc_client: Use GnuTLS RC4 in init_samr_CryptPassword()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_client: Use samba_gnutls_arcfour_confounded_md5 in init_samr_CryptPasswordEx
Andreas Schneider [Thu, 4 Jul 2019 14:22:48 +0000 (16:22 +0200)]
s3:rpc_client: Use samba_gnutls_arcfour_confounded_md5 in init_samr_CryptPasswordEx

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Add test for decoding an RC4 password buffer
Andreas Schneider [Fri, 5 Jul 2019 07:39:02 +0000 (09:39 +0200)]
libcli:auth: Add test for decoding an RC4 password buffer

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Return NTSTATUS for encode_or_decode_arc4_passwd_buffer()
Andreas Schneider [Wed, 29 May 2019 12:57:52 +0000 (14:57 +0200)]
libcli:auth: Return NTSTATUS for encode_or_decode_arc4_passwd_buffer()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_client: Return NTSTATUS for init_samr_CryptPasswordEx()
Andreas Schneider [Wed, 29 May 2019 15:16:26 +0000 (17:16 +0200)]
s3:rpc_client: Return NTSTATUS for init_samr_CryptPasswordEx()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_client: Return NTSTATUS for init_samr_CryptPassword()
Andreas Schneider [Wed, 29 May 2019 14:22:11 +0000 (16:22 +0200)]
s3:rpc_client: Return NTSTATUS for init_samr_CryptPassword()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:crypto: Document samba_gnutls_arcfour_confounded_md5()
Andreas Schneider [Thu, 18 Jul 2019 11:33:54 +0000 (13:33 +0200)]
lib:crypto: Document samba_gnutls_arcfour_confounded_md5()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:crypto: Document gnutls_error_to_werror()
Andreas Schneider [Thu, 18 Jul 2019 11:27:57 +0000 (13:27 +0200)]
lib:crypto: Document gnutls_error_to_werror()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:crypto: Document gnutls_error_to_ntstatus()
Andreas Schneider [Thu, 18 Jul 2019 07:03:51 +0000 (09:03 +0200)]
lib:crypto: Document gnutls_error_to_ntstatus()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3/lib: clang: Fix 'access to field results in a deref of a null pointer'
Noel Power [Tue, 9 Jul 2019 16:07:09 +0000 (16:07 +0000)]
s3/lib: clang: Fix 'access to field results in a deref of a null pointer'

Fixes:

source3/lib/ctdbd_conn.c:1953:6: warning: Access to field 'operation' results in a dereference of a null pointer (loaded from variable 'hdr') <--[clang]
        if (hdr->operation != CTDB_REPLY_CALL) {
            ^~~

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Wed Jul 24 22:50:27 UTC 2019 on sn-devel-184

4 years agos3/lib: clang: Fix 'function call argument is an uninitialized value'
Noel Power [Tue, 9 Jul 2019 16:05:37 +0000 (16:05 +0000)]
s3/lib: clang: Fix 'function call argument is an uninitialized value'

Fixes:

source3/lib/ctdbd_conn.c:1066:3: warning: 3rd function call argument is an uninitialized value <--[clang]
                DEBUG(0,("ctdbd_control failed: %s, %d\n", strerror(ret),
                ^

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos3/lib: clang: Fix 'Acces to field results in a deref of a null pointer'
Noel Power [Tue, 9 Jul 2019 16:02:47 +0000 (16:02 +0000)]
s3/lib: clang: Fix 'Acces to field results in a deref of a null pointer'

Fixes:

source3/lib/ctdbd_conn.c:415:6: warning: Access to field 'operation' results in a dereference of a null pointer (loaded from variable 'hdr') <--[clang]
        if (hdr->operation == CTDB_REQ_MESSAGE) {

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolib/addns: clang: Fix 'Assigned value is garbage or undefined'
Noel Power [Tue, 9 Jul 2019 15:06:30 +0000 (15:06 +0000)]
lib/addns: clang: Fix 'Assigned value is garbage or undefined'

Fixes:

lib/addns/dnsquery.c:222:10: warning: Assigned value is garbage or undefined <--[clang]
        *numdcs = num_srvs;     /* size_t->int */
                ^
1 warning generated.

Also fixes the out param being modified even on failure

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolib/addns: clang: Fix 'Value stored to 'err' is never read'
Noel Power [Tue, 9 Jul 2019 14:50:24 +0000 (14:50 +0000)]
lib/addns: clang: Fix 'Value stored to 'err' is never read'

Fixes:

/home/samba/samba/lib/addns/dnsmarshall.c:406:2: warning: Value stored to 'err' is never read <--[clang]
        err = ERROR_DNS_NO_MEMORY;
        ^     ~~~~~~~~~~~~~~~~~~~
/home/samba/samba/lib/addns/dnsmarshall.c:447:3: warning: Value stored to 'err' is never read <--[clang]
                err = buf->error;
                ^     ~~~~~~~~~~
2 warnings generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolibcls/nbt: clang: Fix 'initialization value is never read'
Noel Power [Tue, 9 Jul 2019 14:45:52 +0000 (14:45 +0000)]
libcls/nbt: clang: Fix 'initialization value is never read'

Fixes:

libcli/nbt/nbtsocket.c:65:27: warning: Value stored to 'req' during its initialization is never read <--[clang]
        struct nbt_name_request *req = nbtsock->send_queue;
                                 ^~~   ~~~~~~~~~~~~~~~~~~~
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos3/lib/dbwrap: clang: Fix 'Access to field results in a deref of a null'
Noel Power [Tue, 9 Jul 2019 14:42:46 +0000 (14:42 +0000)]
s3/lib/dbwrap: clang: Fix 'Access to field results in a deref of a null'

Fixes:

source3/lib/dbwrap/dbwrap_ctdb.c:530:39: warning: Access to field 'm_write' results in a dereference of a null pointer (loaded from field 'transaction') <--[clang]
        if (pull_newest_from_marshall_buffer(ctx->transaction->m_write, key,

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos3/lib/dwrap: clang: Fix 'Value stored to 'ret' is never read'
Noel Power [Tue, 9 Jul 2019 14:13:13 +0000 (14:13 +0000)]
s3/lib/dwrap: clang: Fix 'Value stored to 'ret' is never read'

Fixes:

source3/lib/dbwrap/dbwrap_ctdb.c:95:2: warning: Value stored to 'ret' is never read <--[clang]
        ret = ctdbd_init_connection(mem_ctx,
        ^     ~~~~~~

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolib/adnss: clang: Fix The left operand of '!=' is a garbage value
Noel Power [Tue, 9 Jul 2019 14:08:49 +0000 (14:08 +0000)]
lib/adnss: clang: Fix The left operand of '!=' is a garbage value

Fixes:

lib/addns/dnssock.c:143:3: warning: The left operand of '!=' is a garbage value <--[clang]
                TALLOC_FREE(conn);
                ^
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolibcli/smb: clang: Fix Value stored to 'next_offset' is never read
Noel Power [Tue, 9 Jul 2019 14:04:34 +0000 (14:04 +0000)]
libcli/smb: clang: Fix Value stored to 'next_offset' is never read

Fixes:

ibcli/smb/smb2_negotiate_context.c:117:3: warning: Value stored to 'next_offset' is never read <--[clang]
                next_offset += next_pad;
                ^              ~~~~~~~~
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/dsdb/replmd: use incoming_dn_should_be_renamed() 2/2
Douglas Bagnall [Wed, 24 Jul 2019 03:43:46 +0000 (15:43 +1200)]
s4/dsdb/replmd: use incoming_dn_should_be_renamed() 2/2

In replmd_replicated_handle_rename().

The helper function was introduced two commits ago and consists of
a large common stretch of this and the function modified in the previous
commit.

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): Wed Jul 24 11:21:50 UTC 2019 on sn-devel-184

4 years agos4/dsdb/replmd: use incoming_dn_should_be_renamed() 1/2
Douglas Bagnall [Wed, 24 Jul 2019 03:21:10 +0000 (15:21 +1200)]
s4/dsdb/replmd: use incoming_dn_should_be_renamed() 1/2

In replmd_op_possible_conflict_callback().

The helper function was introduced in the previous commit and consists
of a large common stretch of this and replmd_replicated_handle_rename().

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4/dsdb/replmd: add a helper for common calculations
Douglas Bagnall [Wed, 24 Jul 2019 03:16:36 +0000 (15:16 +1200)]
s4/dsdb/replmd: add a helper for common calculations

We currently do exactly this work, in exactly these words (ignoring
formatting) in two different places. The next two commits will make
those places use this helper function. We do this over three commits
so that we can more easily compare the next two and be sure they are
doing the same thing.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4/dsdb/replmd: replicated_handle_rename free temp_ctx
Douglas Bagnall [Wed, 24 Apr 2019 09:30:07 +0000 (21:30 +1200)]
s4/dsdb/replmd: replicated_handle_rename free temp_ctx

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be...
Jeremy Allison [Wed, 17 Jul 2019 16:55:58 +0000 (09:55 -0700)]
s3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be dir_hnd.

Fixes SearchDir(). No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jul 24 08:57:05 UTC 2019 on sn-devel-184

4 years agos3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be...
Jeremy Allison [Wed, 17 Jul 2019 16:53:40 +0000 (09:53 -0700)]
s3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be dir_hnd.

Fixes TellDir(). No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be...
Jeremy Allison [Wed, 17 Jul 2019 16:52:41 +0000 (09:52 -0700)]
s3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be dir_hnd.

Fixes RewindDir(). No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be...
Jeremy Allison [Wed, 17 Jul 2019 16:51:07 +0000 (09:51 -0700)]
s3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be dir_hnd.

Fixes ReadDirName(). No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be...
Jeremy Allison [Wed, 17 Jul 2019 16:47:31 +0000 (09:47 -0700)]
s3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be dir_hnd.

Fixes OpenDir_fsp(). No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be...
Jeremy Allison [Wed, 17 Jul 2019 16:44:56 +0000 (09:44 -0700)]
s3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be dir_hnd.

Fixes OpenDir_internal(). No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be...
Jeremy Allison [Wed, 17 Jul 2019 16:42:45 +0000 (09:42 -0700)]
s3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be dir_hnd.

Fixes DirCacheAdd(). No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be...
Jeremy Allison [Wed, 17 Jul 2019 16:40:04 +0000 (09:40 -0700)]
s3: smbd: Naming consistency. Change all uses of struct smb_Dir * variables to be dir_hnd.

Fixes smb_Dir_destructor(). No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbd: Use a separate simple destructor for the OpenDir() codepath.
Jeremy Allison [Wed, 17 Jul 2019 16:31:46 +0000 (09:31 -0700)]
s3: smbd: Use a separate simple destructor for the OpenDir() codepath.

This will help greatly in understanding the code changes later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbd: Move the setting of the destructor of struct smb_Dir * up two levels.
Jeremy Allison [Wed, 17 Jul 2019 16:11:25 +0000 (09:11 -0700)]
s3: smbd: Move the setting of the destructor of struct smb_Dir * up two levels.

Previously, open_dir_safely() called OpenDir_internal() which
set the destructor.

Move setting the destructor into the callers of open_dir_safely()
as this will allow us to have different destructors for handle-based
calls.

The reason this is important is that I have a follow up patchset
that depends on this which makes all client directory enumerations
handle-based, calling OpenDir_fsp() only, and so the destructor there
will take care of the fsp back pointer.

Trying to keep a common destructor for handle-based and non-handle
based calls broke my brain when trying to separate the handle-based
calls from the non-handle based ones in my later patchset.

NB. The change in OpenDir_fsp() isn't a logic change as instead
of doing an early return from a function that sets the destructor,
we now fallthrough to setting the destructor then return, which
is identical.

Eventually the whole codepath using the fallback for non-handle
opens inside dptr_create() will go away and this simplifies the
code immensely. Some short term pain for long-term gain :-).

Added doxygen documentation as requested.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbd: OpenDir() is merely a wrapper around open_dir_safely().
Jeremy Allison [Wed, 17 Jul 2019 15:56:49 +0000 (08:56 -0700)]
s3: smbd: OpenDir() is merely a wrapper around open_dir_safely().

Preparatory work.

Separate these out internal to source3/smbd/dir.c so I can
give the internal and external uses separate destructor functions
to allow all client requested directory enumeration to move to handle
based functions.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agonetcmd: Better error message for backup with no RID pool
Tim Beale [Wed, 24 Jul 2019 02:17:06 +0000 (14:17 +1200)]
netcmd: Better error message for backup with no RID pool

Add a better error message (and what to do about it) if the user tries
to back up a DC that hasn't initialized its RID pool yet.

Seems to be a fairly common problem hit by users.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14048
RN: Added more informative error message if the 'samba-tool domain
backup' command fails due to no RID pool being present on the DC.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jul 24 07:07:01 UTC 2019 on sn-devel-184

4 years agopartition: reversing partition unlocking
Aaron Haslett [Mon, 15 Jul 2019 01:32:41 +0000 (13:32 +1200)]
partition: reversing partition unlocking

Unlock partition databases in the reverse order from which they were
acquired. This is separated from the previous commit for future
bisecting purposes, since the last commit was made to fix specific CI
failures, while this one is a speculative fix made based on code
inspection.

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopartition: correcting lock ordering
Aaron Haslett [Thu, 11 Jul 2019 05:12:06 +0000 (17:12 +1200)]
partition: correcting lock ordering

A schema reading bug was traced to a lock ordering issue in partition.c.
This patch fixes the problem by:
1. Releasing locks/transactions in the order they were acquired.
2. Always lock/start_trans on metadata.tdb first, before any other
databases, and release it last, after all others. This is so that we are
never exposed to MDB's lock semantics, which we don't support.

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4/source4/common: clang: Fix 'Dereference of undefined pointer value'
Noel Power [Fri, 5 Jul 2019 11:34:25 +0000 (11:34 +0000)]
s4/source4/common: clang: Fix 'Dereference of undefined pointer value'

Fixes:

source4/dsdb/common/util.c:3131:6: warning: Dereference of undefined pointer value <--[clang]
        if (res->count < 1) {
            ^

/source4/dsdb/common/util.c:3207:6: warning: Dereference of undefined pointer value <--[clang]
        if (res->count < 1) {
            ^~~~~~~~~~
source4/dsdb/common/util.c:4004:39: warning: Dereference of undefined pointer value <--[clang]
        (*wkguid_dn) = talloc_steal(mem_ctx, res->msgs[0]->dn);
                                             ^
source4/dsdb/common/util.c:4191:35: warning: Dereference of undefined pointer value <--[clang]
        ouv_value = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector");

source4/dsdb/common/util.c:5757:13: warning: 1st function call argument is an uninitialized value <--[clang]
        same_nc = (ldb_dn_compare(source_nc, target_nc) == 0);
                   ^
This fix also fixes the associated 'Access to field 'xyx' results in a
dereference of a null pointer' warnings that also will happen when this
is fixed

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Wed Jul 24 05:49:14 UTC 2019 on sn-devel-184

4 years agos4/dsdb/common: clang: Fix 'Value stored to 'cps_stdin' is never read'
Noel Power [Fri, 5 Jul 2019 11:16:45 +0000 (11:16 +0000)]
s4/dsdb/common: clang: Fix 'Value stored to 'cps_stdin' is never read'

Fixes:

source4/dsdb/common/util.c:2125:4: warning: Value stored to 'cps_stdin' is never read <--[clang]
                        cps_stdin = -1;

                        ^           ~~
source4/dsdb/common/util.c:2132:3: warning: Value stored to 'cps_stdin' is never read <--[clang]
                cps_stdin = -1;

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/dsdb/common: clang: Fix 'Access results in a deref of a null pointer'
Noel Power [Fri, 5 Jul 2019 11:07:07 +0000 (11:07 +0000)]
s4/dsdb/common: clang: Fix 'Access results in a deref of a null pointer'

Fixes:

source4/dsdb/common/util.c:2000:6: warning: Access to field 'count' results in a dereference of a null pointer (loaded from variable 'res') <--[clang]
        if (res->count != 1) {
            ^~~

source4/dsdb/common/util.c:3281:28: warning: Access to field 'msgs' results in a dereference of a null pointer (loaded from variable 'res') <--[clang]
        el = ldb_msg_find_element(res->msgs[0], attr);
                                  ^~~
source4/dsdb/common/util.c:3568:6: warning: Access to field 'count' results in a dereference of a null pointer (loaded from variable 'res') <--[clang]
        if (res->count != 1 || ret != LDB_SUCCESS) {
            ^~~

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/dsdb/common: clang: Fix 'The left operand of '&' is a garbage value'
Noel Power [Fri, 5 Jul 2019 11:04:10 +0000 (11:04 +0000)]
s4/dsdb/common: clang: Fix 'The left operand of '&' is a garbage value'

Fixes:

source4/dsdb/common/util.c:1964:18: warning: The left operand of '&' is a garbage value <--[clang]
        return (options & DS_NTDSDSA_OPT_IS_GC) != 0;
                ~~~~~~~ ^

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/dsdb/common: clang: Fix 'function call argument is an uninitialized value'
Noel Power [Fri, 5 Jul 2019 10:42:54 +0000 (10:42 +0000)]
s4/dsdb/common: clang: Fix 'function call argument is an uninitialized value'

Fixes:

source4/dsdb/common/util.c:1804:8: warning: 3rd function call argument is an uninitialized value <--[clang]
        ret = samdb_reference_dn(ldb, mem_ctx, server_ref_dn, "rIDSetReferences", dn);

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/auth/kerberos: clang: Fix Value stored to 'code' is never read
Noel Power [Fri, 5 Jul 2019 10:41:19 +0000 (10:41 +0000)]
s4/auth/kerberos: clang: Fix Value stored to 'code' is never read

Fixes:

source4/auth/kerberos/kerberos_util.c:645:3: warning: Value stored to 'code' is never read <--[clang]
                code = 0;
                ^      ~
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4/auth/kerberos: clang: Fix 'value stored to 'ret' is never read '
Noel Power [Fri, 5 Jul 2019 10:24:53 +0000 (10:24 +0000)]
s4/auth/kerberos: clang: Fix 'value stored to 'ret' is never read '

Fixes:

source4/auth/kerberos/kerberos_pac.c:116:2: warning: Value stored to 'ret' is never read <--[clang]
        ret = smb_krb5_make_pac_checksum(mem_ctx,
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>