jlayton/samba.git
11 years agos3-rpc_server: Fix a possible null pointer dereference.
Andreas Schneider [Mon, 17 Dec 2012 14:31:21 +0000 (15:31 +0100)]
s3-rpc_server: Fix a possible null pointer dereference.

This variable can be set to NULL in an earlier function call.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-vfs: Fix typo in readonly_connect().
Andreas Schneider [Mon, 17 Dec 2012 14:21:10 +0000 (15:21 +0100)]
s3-vfs: Fix typo in readonly_connect().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agolibcli: Fix smb2cli_ioctl_send() if clause.
Andreas Schneider [Mon, 17 Dec 2012 14:17:45 +0000 (15:17 +0100)]
libcli: Fix smb2cli_ioctl_send() if clause.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agolibwbclient: Fix null check in process_domain_info_string().
Andreas Schneider [Mon, 17 Dec 2012 13:17:59 +0000 (14:17 +0100)]
libwbclient: Fix null check in process_domain_info_string().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-rpc_server: Fix useless check if we still have a valid string.
Andreas Schneider [Mon, 17 Dec 2012 13:40:17 +0000 (14:40 +0100)]
s3-rpc_server: Fix useless check if we still have a valid string.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-libads: Fix copy&paste error in ads_keytab_add_entry().
Andreas Schneider [Mon, 17 Dec 2012 13:33:45 +0000 (14:33 +0100)]
s3-libads: Fix copy&paste error in ads_keytab_add_entry().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-lib: Fix push_ucs2() for-loop.
Andreas Schneider [Mon, 17 Dec 2012 13:25:31 +0000 (14:25 +0100)]
s3-lib: Fix push_ucs2() for-loop.

ret is a bool and size is what we are looking for here, else the
statement can never be true.

Jeremy please check!

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-tldap: Fix dead code in tldap_sasl_bind_send().
Andreas Schneider [Mon, 17 Dec 2012 13:21:01 +0000 (14:21 +0100)]
s3-tldap: Fix dead code in tldap_sasl_bind_send().

dn can't be NULL cause it is set to "" in that case.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos4-librpc: Remove dead code in smb_send_request().
Andreas Schneider [Mon, 17 Dec 2012 13:08:59 +0000 (14:08 +0100)]
s4-librpc: Remove dead code in smb_send_request().

If trigger_read we return earlier.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agokrb5_wrap: Remove dead code in smb_krb5_renew_ticket().
Andreas Schneider [Mon, 17 Dec 2012 13:03:50 +0000 (14:03 +0100)]
krb5_wrap: Remove dead code in smb_krb5_renew_ticket().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agonsswitch: Fix wbclient BAIL macros.
Andreas Schneider [Mon, 17 Dec 2012 09:39:10 +0000 (10:39 +0100)]
nsswitch: Fix wbclient BAIL macros.

In the code you normally use:

BAIL_ON_WBC_ERROR;

but the last ; is statement never reached, so dead code.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agolibcli: Check schannel state return value of tdb_transaction_commit().
Andreas Schneider [Fri, 14 Dec 2012 17:21:26 +0000 (18:21 +0100)]
libcli: Check schannel state return value of tdb_transaction_commit().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-utils: Check return value of secrets_init().
Andreas Schneider [Fri, 14 Dec 2012 17:14:34 +0000 (18:14 +0100)]
s3-utils: Check return value of secrets_init().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-net: Check return values of push_reg_sz().
Andreas Schneider [Fri, 14 Dec 2012 17:07:10 +0000 (18:07 +0100)]
s3-net: Check return values of push_reg_sz().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agoparam: Correctly create directory and create common function.
Andreas Schneider [Fri, 14 Dec 2012 16:54:13 +0000 (17:54 +0100)]
param: Correctly create directory and create common function.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agolibrpc: Check return codes of ndr functions.
Andreas Schneider [Fri, 14 Dec 2012 16:43:36 +0000 (17:43 +0100)]
librpc: Check return codes of ndr functions.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agondr: Check return code of ndr_pull_advance().
Andreas Schneider [Fri, 14 Dec 2012 16:09:34 +0000 (17:09 +0100)]
ndr: Check return code of ndr_pull_advance().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos4-libnet: Checkr return codes in samsync_ldb_handle_domain().
Andreas Schneider [Fri, 14 Dec 2012 16:02:48 +0000 (17:02 +0100)]
s4-libnet: Checkr return codes in samsync_ldb_handle_domain().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-nmbd: Check if we created the directories correctly.
Andreas Schneider [Thu, 13 Dec 2012 17:16:34 +0000 (18:16 +0100)]
s3-nmbd: Check if we created the directories correctly.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-eventlog: Make sure the eventlog directory exists.
Andreas Schneider [Thu, 13 Dec 2012 16:50:55 +0000 (17:50 +0100)]
s3-eventlog: Make sure the eventlog directory exists.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos4-regsitry: Check return value of ldb_msg_add_empty().
Andreas Schneider [Thu, 13 Dec 2012 16:48:45 +0000 (17:48 +0100)]
s4-regsitry: Check return value of ldb_msg_add_empty().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-winbind: Check if we created the directories correctly.
Andreas Schneider [Thu, 13 Dec 2012 16:29:39 +0000 (17:29 +0100)]
s3-winbind: Check if we created the directories correctly.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos4-lib: Use directory_create_or_exist() to create messaging dir.
Andreas Schneider [Thu, 13 Dec 2012 15:10:38 +0000 (16:10 +0100)]
s4-lib: Use directory_create_or_exist() to create messaging dir.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-smbd: Check return code of SMB_VFS_{L}STAT.
Andreas Schneider [Thu, 13 Dec 2012 13:26:40 +0000 (14:26 +0100)]
s3-smbd: Check return code of SMB_VFS_{L}STAT.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos4-client: Check return codes in do_connect().
Andreas Schneider [Thu, 13 Dec 2012 13:11:29 +0000 (14:11 +0100)]
s4-client: Check return codes in do_connect().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agotdb: Add a comment explaining the "check"
Volker Lendecke [Fri, 14 Dec 2012 15:07:11 +0000 (16:07 +0100)]
tdb: Add a comment explaining the "check"

I had to ask git blame to find why we have to do it here...

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Dec 21 13:54:39 CET 2012 on sn-devel-104

11 years agotdb: Make tdb_new_database() follow a more conventional style
Volker Lendecke [Fri, 14 Dec 2012 14:53:08 +0000 (15:53 +0100)]
tdb: Make tdb_new_database() follow a more conventional style

We usually "goto fail" on every error and then in normal flow set the
return variable to success. This patch removes a comment which from my
point of view is now obsolete. It violates the {} rule from README.Coding
here in favor of the style used in this function.

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Fix a typo
Volker Lendecke [Fri, 14 Dec 2012 13:50:08 +0000 (14:50 +0100)]
tdb: Fix a typo

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Fix a typo
Volker Lendecke [Fri, 14 Dec 2012 13:48:31 +0000 (14:48 +0100)]
tdb: Fix a typo

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Use tdb_lock_covered_by_allrecord_lock in tdb_unlock
Volker Lendecke [Fri, 14 Dec 2012 08:24:06 +0000 (09:24 +0100)]
tdb: Use tdb_lock_covered_by_allrecord_lock in tdb_unlock

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Factor out tdb_lock_covered_by_allrecord_lock from tdb_lock_list
Volker Lendecke [Fri, 14 Dec 2012 08:21:42 +0000 (09:21 +0100)]
tdb: Factor out tdb_lock_covered_by_allrecord_lock from tdb_lock_list

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Simplify logic in tdb_lock_list slightly
Volker Lendecke [Thu, 13 Dec 2012 21:14:34 +0000 (22:14 +0100)]
tdb: Simplify logic in tdb_lock_list slightly

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Slightly simplify tdb_lock_list
Volker Lendecke [Thu, 13 Dec 2012 20:58:00 +0000 (21:58 +0100)]
tdb: Slightly simplify tdb_lock_list

Avoid an else {} branch when we can do an early return

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Fix blank line endings
Volker Lendecke [Thu, 13 Dec 2012 12:31:59 +0000 (13:31 +0100)]
tdb: Fix blank line endings

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Fix a comment
Volker Lendecke [Fri, 14 Dec 2012 07:01:12 +0000 (08:01 +0100)]
tdb: Fix a comment

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Fix a typo
Volker Lendecke [Thu, 13 Dec 2012 11:36:29 +0000 (12:36 +0100)]
tdb: Fix a typo

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotdb: Fix a missing CONVERT
Volker Lendecke [Tue, 11 Dec 2012 20:04:58 +0000 (21:04 +0100)]
tdb: Fix a missing CONVERT

methods->tdb_write expects data in on-disk format. For reading that
record, methods->tdb_read() has taken care of the on-disk to in-memory
representation according to the DOCONV() flag passed down. tdb_rec_write()
is a wrapper around methods->tdb_write just doing the CONVERT() on the
way to disk.

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agoFix bug #9196 - defer_open is triggered multiple times on the same request.
Jeremy Allison [Fri, 14 Dec 2012 16:39:26 +0000 (08:39 -0800)]
Fix bug #9196 - defer_open is triggered multiple times on the same request.

get_deferred_open_message_state_smb2() is buggy in that it is checking
the wrong things to determine if an open is in the deferred state.

It checks if (smb2req->async_te == NULL) which is incorrect,
as we're not always async in a deferred open - remove this.

It should check instead state->open_was_deferred as this
is explicity set to 'true' when an open is going deferred,
so add this check.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Dec 18 14:19:13 CET 2012 on sn-devel-104

11 years agos4-rpc_server: use netlogon_creds_encrypt_samlogon().
Günther Deschner [Tue, 11 Dec 2012 22:53:22 +0000 (23:53 +0100)]
s4-rpc_server: use netlogon_creds_encrypt_samlogon().

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Sun Dec 16 01:34:01 CET 2012 on sn-devel-104

11 years agos3-rpc_server: use netlogon_creds_encrypt_samlogon().
Günther Deschner [Tue, 11 Dec 2012 22:52:59 +0000 (23:52 +0100)]
s3-rpc_server: use netlogon_creds_encrypt_samlogon().

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 years agolibcli/auth: add netlogon_creds_encrypt_samlogon_validation().
Günther Deschner [Fri, 14 Dec 2012 13:18:40 +0000 (14:18 +0100)]
libcli/auth: add netlogon_creds_encrypt_samlogon_validation().

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 years agolibcli/auth: rename netlogon_creds_decrypt_samlogon() to netlogon_creds_decrypt_samlo...
Günther Deschner [Fri, 14 Dec 2012 13:17:22 +0000 (14:17 +0100)]
libcli/auth: rename netlogon_creds_decrypt_samlogon() to netlogon_creds_decrypt_samlogon_validation().

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 years agos3fs: make the log warning go away
Ricky Nance [Fri, 14 Dec 2012 02:52:46 +0000 (20:52 -0600)]
s3fs: make the log warning go away

standard input is not a socket, assuming -D option

Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date(master): Sat Dec 15 17:50:23 CET 2012 on sn-devel-104

11 years agotdr: Strip trailing whitespace.
Jelmer Vernooij [Fri, 26 Oct 2012 14:55:04 +0000 (06:55 -0800)]
tdr: Strip trailing whitespace.

11 years agos4-libnet: Fix setting the group handle and return codes.
Andreas Schneider [Thu, 6 Dec 2012 13:45:24 +0000 (14:45 +0100)]
s4-libnet: Fix setting the group handle and return codes.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Dec 13 01:01:14 CET 2012 on sn-devel-104

11 years agoutil: Remove unused fde_stdin in samba_runcmd.
Andreas Schneider [Wed, 12 Dec 2012 18:15:58 +0000 (19:15 +0100)]
util: Remove unused fde_stdin in samba_runcmd.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-lib: Don't close the listener twice if we goto failed.
Andreas Schneider [Thu, 6 Dec 2012 10:11:15 +0000 (11:11 +0100)]
s3-lib: Don't close the listener twice if we goto failed.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3: Fix a typo in a debug message
Volker Lendecke [Wed, 12 Dec 2012 11:55:45 +0000 (12:55 +0100)]
s3: Fix a typo in a debug message

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Dec 12 16:40:23 CET 2012 on sn-devel-104

11 years agos3-printing: Correctly create the printing cache path.
Andreas Schneider [Mon, 10 Dec 2012 16:52:50 +0000 (17:52 +0100)]
s3-printing: Correctly create the printing cache path.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-registry: Fix counters_directory() dir creation.
Andreas Schneider [Mon, 10 Dec 2012 16:45:15 +0000 (17:45 +0100)]
s3-registry: Fix counters_directory() dir creation.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos4-socket: Make sure unix socket addresses are null terminated.
Andreas Schneider [Mon, 10 Dec 2012 16:14:12 +0000 (17:14 +0100)]
s4-socket: Make sure unix socket addresses are null terminated.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-ctdb: Make sure addr.sun_path is null terminated.
Andreas Schneider [Mon, 10 Dec 2012 16:07:24 +0000 (17:07 +0100)]
s3-ctdb: Make sure addr.sun_path is null terminated.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agotorture: Make sure we use the correct size for cxd.
Andreas Schneider [Mon, 10 Dec 2012 16:06:39 +0000 (17:06 +0100)]
torture: Make sure we use the correct size for cxd.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-libsmb: Fix possible comparsion problems.
Andreas Schneider [Mon, 10 Dec 2012 14:11:23 +0000 (15:11 +0100)]
s3-libsmb: Fix possible comparsion problems.

This makes the code also easier to understand.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos4-libcli: Fix comparison of chosen_oid.
Andreas Schneider [Mon, 10 Dec 2012 14:02:43 +0000 (15:02 +0100)]
s4-libcli: Fix comparison of chosen_oid.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-utils: Correctly handle getenv() for the later system() call.
Andreas Schneider [Mon, 10 Dec 2012 13:06:32 +0000 (14:06 +0100)]
s3-utils: Correctly handle getenv() for the later system() call.

The returned string of getenv() has an unknown size. You need to store
the result always in a char array with a certain size to make sure we
don't feed tainted data to the next function call.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos4-client: Make sure we have a valid count if we goto cleanup.
Andreas Schneider [Thu, 6 Dec 2012 17:04:41 +0000 (18:04 +0100)]
s4-client: Make sure we have a valid count if we goto cleanup.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-utils: Cleanup code in wait_replies().
Andreas Schneider [Thu, 6 Dec 2012 14:40:29 +0000 (15:40 +0100)]
s3-utils: Cleanup code in wait_replies().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agonsswitch: Fix pam_get_{item,data} build warnings.
Andreas Schneider [Thu, 6 Dec 2012 14:28:03 +0000 (15:28 +0100)]
nsswitch: Fix pam_get_{item,data} build warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agonsswitch: Remove unused variable in _pam_winbind_change_pwd().
Andreas Schneider [Thu, 6 Dec 2012 14:16:52 +0000 (15:16 +0100)]
nsswitch: Remove unused variable in _pam_winbind_change_pwd().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agonsswitch: Cleanup code in parse_wbinfo_domain_user().
Andreas Schneider [Thu, 6 Dec 2012 14:14:07 +0000 (15:14 +0100)]
nsswitch: Cleanup code in parse_wbinfo_domain_user().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos4-libnet: Don't call talloc_get_type() for the same struct twice.
Andreas Schneider [Thu, 6 Dec 2012 14:11:09 +0000 (15:11 +0100)]
s4-libnet: Don't call talloc_get_type() for the same struct twice.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-nmbd: Cleanup code to make it more readable.
Andreas Schneider [Thu, 6 Dec 2012 14:06:06 +0000 (15:06 +0100)]
s3-nmbd: Cleanup code to make it more readable.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agos3-lib: Remove unsused variable from sys_get_nfs_quota().
Andreas Schneider [Thu, 6 Dec 2012 13:35:48 +0000 (14:35 +0100)]
s3-lib: Remove unsused variable from sys_get_nfs_quota().

testpath is the same a few lines later.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agowinbind: Use talloc in resolve_username_to_alias().
Andreas Schneider [Thu, 6 Dec 2012 10:40:35 +0000 (11:40 +0100)]
winbind: Use talloc in resolve_username_to_alias().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agowinbind: Use talloc in resolve_alias_to_username().
Andreas Schneider [Thu, 6 Dec 2012 10:24:17 +0000 (11:24 +0100)]
winbind: Use talloc in resolve_alias_to_username().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agotdb: Improve the documentation of tdb_reopen() and tdb_close().
Andreas Schneider [Tue, 11 Dec 2012 16:11:58 +0000 (17:11 +0100)]
tdb: Improve the documentation of tdb_reopen() and tdb_close().

Reviewed-by: Simo Sorce <idra@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Dec 12 14:58:50 CET 2012 on sn-devel-104

11 years agotdb: Fix possible crash bugs in the python tdb code.
Andreas Schneider [Tue, 11 Dec 2012 15:51:01 +0000 (16:51 +0100)]
tdb: Fix possible crash bugs in the python tdb code.

You can't call tdb_error() for tdb_reopen() or tdb_close(), both return
the error code of close(2) and not a TDB_ERROR!

Reviewed-by: Simo Sorce <idra@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
11 years agomisc: Add a config for clang complete.
Andreas Schneider [Thu, 6 Dec 2012 14:06:57 +0000 (15:06 +0100)]
misc: Add a config for clang complete.

See https://github.com/Rip-Rip/clang_complete

11 years agos4-selftest: make sure to test rpc.samr.passwords.validate over ncacn_ip_tcp.
Günther Deschner [Tue, 11 Dec 2012 15:43:12 +0000 (16:43 +0100)]
s4-selftest: make sure to test rpc.samr.passwords.validate over ncacn_ip_tcp.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Dec 12 13:13:47 CET 2012 on sn-devel-104

11 years agos3-selftest: make sure to test rpc.samr.passwords.validate over ncacn_ip_tcp.
Günther Deschner [Tue, 11 Dec 2012 15:42:53 +0000 (16:42 +0100)]
s3-selftest: make sure to test rpc.samr.passwords.validate over ncacn_ip_tcp.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agos4-rpc_server: limit allowed transports for samr_ValidatePassword().
Günther Deschner [Tue, 11 Dec 2012 13:43:07 +0000 (14:43 +0100)]
s4-rpc_server: limit allowed transports for samr_ValidatePassword().

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agos3-rpc_server: limit allowed transports for samr_ValidatePassword().
Günther Deschner [Tue, 11 Dec 2012 13:41:34 +0000 (14:41 +0100)]
s3-rpc_server: limit allowed transports for samr_ValidatePassword().

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agos4-torture: move samr_ValidatePassword test out of main samr test.
Günther Deschner [Tue, 11 Dec 2012 08:25:53 +0000 (09:25 +0100)]
s4-torture: move samr_ValidatePassword test out of main samr test.

Makes it easier to call with ncacn_ip_tcp transport (Windows does not allow
other transports).

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agodfs_server: Don't allocate a subcontext twice.
Andreas Schneider [Thu, 6 Dec 2012 13:37:21 +0000 (14:37 +0100)]
dfs_server: Don't allocate a subcontext twice.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Dec 12 11:28:39 CET 2012 on sn-devel-104

11 years agoutil: Don't use the pid ret value uninitialized.
Andreas Schneider [Thu, 6 Dec 2012 15:02:57 +0000 (16:02 +0100)]
util: Don't use the pid ret value uninitialized.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3-netapi: Initialize group_handle of NetGroupSetUsers_r().
Andreas Schneider [Thu, 6 Dec 2012 16:04:47 +0000 (17:04 +0100)]
s3-netapi: Initialize group_handle of NetGroupSetUsers_r().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos4-netapi: Initialize group_handle of NetGroupGetUsers_r().
Andreas Schneider [Thu, 6 Dec 2012 17:06:59 +0000 (18:06 +0100)]
s4-netapi: Initialize group_handle of NetGroupGetUsers_r().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3-auth: Make sure we work on valid data_blobs.
Andreas Schneider [Thu, 6 Dec 2012 17:13:23 +0000 (18:13 +0100)]
s3-auth: Make sure we work on valid data_blobs.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3-netapi: Initialize group_handle of NetUserSetGroups_r.
Andreas Schneider [Thu, 6 Dec 2012 17:15:12 +0000 (18:15 +0100)]
s3-netapi: Initialize group_handle of NetUserSetGroups_r.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agotorture: Fix torture_rpc_spoolss_printer_teardown_common().
Andreas Schneider [Mon, 10 Dec 2012 12:22:52 +0000 (13:22 +0100)]
torture: Fix torture_rpc_spoolss_printer_teardown_common().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3-netapi: Fix zeroing policy handles in NetLocalGroupAdd_r().
Andreas Schneider [Mon, 10 Dec 2012 12:24:46 +0000 (13:24 +0100)]
s3-netapi: Fix zeroing policy handles in NetLocalGroupAdd_r().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agovfs: Make sure we don't call talloc_free on an uninitialized pointer.
Andreas Schneider [Mon, 10 Dec 2012 12:35:27 +0000 (13:35 +0100)]
vfs: Make sure we don't call talloc_free on an uninitialized pointer.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3-printing: Don't call talloc_free on an uninitialized pointer.
Andreas Schneider [Mon, 10 Dec 2012 12:42:37 +0000 (13:42 +0100)]
s3-printing: Don't call talloc_free on an uninitialized pointer.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agoidl: Fix spoolss check for the size of the struct.
Andreas Schneider [Mon, 10 Dec 2012 14:48:28 +0000 (15:48 +0100)]
idl: Fix spoolss check for the size of the struct.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3-net: Check the return value of strlower_m().
Andreas Schneider [Mon, 10 Dec 2012 16:36:39 +0000 (17:36 +0100)]
s3-net: Check the return value of strlower_m().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3-net: Check return value of string_to_sid().
Andreas Schneider [Mon, 10 Dec 2012 16:39:03 +0000 (17:39 +0100)]
s3-net: Check return value of string_to_sid().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3-rpcclient: Check return value of add_string_to_array().
Andreas Schneider [Mon, 10 Dec 2012 16:41:46 +0000 (17:41 +0100)]
s3-rpcclient: Check return value of add_string_to_array().

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3-registry: Check return code of push_reg_sz().
Andreas Schneider [Mon, 10 Dec 2012 16:47:15 +0000 (17:47 +0100)]
s3-registry: Check return code of push_reg_sz().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 years agos3:auth: Tidy up some of the API confusion in create_token_from_XXX() calls.
Jeremy Allison [Mon, 10 Dec 2012 21:22:10 +0000 (13:22 -0800)]
s3:auth: Tidy up some of the API confusion in create_token_from_XXX() calls.

Based on Michaels example, split out the return of NT_STATUS_NO_MEMORY
on talloc fail from other possible errors. Allow the NTSTATUS return
to be the only valid indication of success in these calls.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Dec 11 20:04:25 CET 2012 on sn-devel-104

11 years agos3:auth: fix dereference level in talloc checks in create_token_from_sid()
Michael Adam [Tue, 11 Dec 2012 17:05:31 +0000 (18:05 +0100)]
s3:auth: fix dereference level in talloc checks in  create_token_from_sid()

Commit c5b150b33fc54ed97dbd0736cc6f4c15977d6e70 introduced these checks.
The current check "found_username == NULL" is wrong (we would segfault earlier
in this case). We need to check *found_username == NULL instead as
noted by Günter.

Reported-by: Günter Kukkukk <linux@kukkukk.com>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoselftest: skip the samba4.rpc.samr.passwords test in ncacn_np(dc) and s4member enviro...
Michael Adam [Tue, 11 Dec 2012 15:13:39 +0000 (16:13 +0100)]
selftest: skip the samba4.rpc.samr.passwords test in ncacn_np(dc) and s4member environments

These currently fail in a corner case.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Karolin Seeger <kseeger@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Dec 11 17:56:01 CET 2012 on sn-devel-104

11 years agos4:torture:rpc:samr: fix password age calculation in test_ChangePasswordUser3()
Michael Adam [Tue, 11 Dec 2012 12:34:49 +0000 (13:34 +0100)]
s4:torture:rpc:samr: fix password age calculation in test_ChangePasswordUser3()

The min_password_age field is the negative of the age.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:torture/samr: allow STATUS_PASSWORD_RESTRICTIONS from ChangePasswordUser
Michael Adam [Tue, 11 Dec 2012 12:21:11 +0000 (13:21 +0100)]
s4:torture/samr: allow STATUS_PASSWORD_RESTRICTIONS from ChangePasswordUser

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:rpc_server/samr: do WRONG_PASSWORD checks after the complexity checks
Michael Adam [Tue, 11 Dec 2012 12:18:00 +0000 (13:18 +0100)]
s4:rpc_server/samr: do WRONG_PASSWORD checks after the complexity checks

This matches the windows behavior.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:dsdb/password_hash: do the min password age checks first
Michael Adam [Tue, 11 Dec 2012 12:04:22 +0000 (13:04 +0100)]
s4:dsdb/password_hash: do the min password age checks first

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:dsdb/common: only pass the DSDB_CONTROL_PASSWORD_HASH_VALUES_OID if required
Stefan Metzmacher [Mon, 10 Dec 2012 22:56:47 +0000 (23:56 +0100)]
s4:dsdb/common: only pass the DSDB_CONTROL_PASSWORD_HASH_VALUES_OID if required

This should give the password_hash module a chance to detect if the called
was the cleartext password or not.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
11 years agos4:torture:rpc:samr: add debugging of result of (many) dcerpc_samr_* calls
Michael Adam [Tue, 11 Dec 2012 10:42:11 +0000 (11:42 +0100)]
s4:torture:rpc:samr: add debugging of result of (many) dcerpc_samr_* calls

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:dsdb/password_hash: Honor password complexity settings.
Stefan Metzmacher [Fri, 23 Nov 2012 10:49:05 +0000 (11:49 +0100)]
s4:dsdb/password_hash: Honor password complexity settings.

Honor password complexity settings when creating new users.
Without this patch, you could set simple passwords although the complexity
settings were enabled. This was an issue with 'samba-tool user add' and also
when adding new users via Windows' "Active Directory Users and Computers"
MMC Snap-In.

The following scenarios were tested successfully after applying the patch:
-'samba-tool user add' against s4
-'samba-tool user add -H' against a Windows DC
-Adding a new user on a s4 DC using Windows' "Active Directory Users and
 Computers" MMC Snap-In.

Please note that this bug was caused by a mistake in the documentation.

Fix bug #9414 - 'samba-tool user add' ignores password complexity settings.

Pair-programmed-with: Karolin Seeger <kseeger@samba.org>
Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
11 years agoRevert "s4:dsdb/password_hash: Honor password complexity settings."
Stefan Metzmacher [Tue, 11 Dec 2012 12:08:28 +0000 (13:08 +0100)]
Revert "s4:dsdb/password_hash: Honor password complexity settings."

This reverts commit f8056b7a6998e002f473b0ad79eee046236a7032.

A better fix will follow.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>