[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Wed Mar 5 10:35:04 MST 2014


The branch, master has been updated
       via  9ed7555 nsswitch: Remove fallback setting of WINBINDD_SOCKET_DIR
       via  f580a7c libcli: Add warning about flow control changing macros in ntstatus.h
       via  0b8213a Remove all uses of the NT_STATUS_NOT_OK_RETURN_AND_FREE macro from the codebase.
       via  856c74e Remove NT_STATUS_IS_ERR_RETURN macro from the codebase.
       via  4c9e0d5 Remove NT_STATUS_IS_OK_RETURN macro from the codebase.
       via  d2beff5 Remove the remaining uses of the macro NT_STATUS_HAVE_NO_MEMORY_AND_FREE in the codebase.
       via  952bc3c Remove a number of NT_STATUS_HAVE_NO_MEMORY_AND_FREE macros from the codebase.
       via  1f60aa8 winbind4: Remove unused winbind_get_idmap irpc operation
       via  13affa6 auth4: Remove unused wbc_context
       via  5f7b8e4 ntvfs_unixuid: No wbc_context required
       via  65c6daf ntvfs_posix: No wbc_context required
       via  2122163 dcesrv_unixinfo: No wbc_context required
       via  0aa080b unixuid: Use the tevent_context from the ntvfs_context
       via  d0dc6db pvfs: Use the tevent_context from the ntvfs_context
       via  aa048f6 auth4: Do not generate just a temporary wbc_context
       via  b2c1394 auth4: auth_session_info_fill_unix only needs a tevent_context
       via  6edf7a3 auth4: security_token_to_unix_token only needs a tevent_context
       via  dcf29a8 libwbclient4: Remove unused composite-based functions
       via  eb8f4b8 source4: Use wbc_xids_to_sids
       via  53b7665 libwbclient4: Add wbc_xids_to_sids
       via  7289d1c source4: Use wbc_sids_to_xids
       via  22dabda libwbclient4: Add wbc_sids_to_xids
      from  7a53bb9 rpc_server: change unsupported pipe error

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9ed7555c82b4c7c14e12ab08483707e68080e152
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Feb 19 11:39:46 2014 +1300

    nsswitch: Remove fallback setting of WINBINDD_SOCKET_DIR
    
    This is the original cause of the wbc NT_STATUS_OBJECT_NAME_NOT_FOUND issues in recent git master, as the
    build was able to progress without the correct path being set as an override.
    
    Andrew Bartlett
    
    Change-Id: I1dbc7350695756356e869199b589eb781eb5c673
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Wed Mar  5 18:34:48 CET 2014 on sn-devel-104

commit f580a7c4ffe6ba5e414cc6382e28751aab77277f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Mar 4 14:11:09 2014 +1300

    libcli: Add warning about flow control changing macros in ntstatus.h
    
    Change-Id: I49fec82e55b6bc59d5c0f157df90005f7d891c66
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 0b8213ae1cd0129b7a50cf7ba3605512a990520f
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Feb 14 18:04:22 2014 +1300

    Remove all uses of the NT_STATUS_NOT_OK_RETURN_AND_FREE macro from the codebase.
    
    Following the current coding guidelines, it is considered bad practice to return from
    within a macro and change control flow as they look like normal function calls.
    
    Change-Id: I421e169275fe323e2b019c6cc5d386289aec07f7
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 856c74e013eaa53902479b771e6c0cf1fea67745
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Feb 14 17:46:40 2014 +1300

    Remove NT_STATUS_IS_ERR_RETURN macro from the codebase.
    
    Following the current coding guidelines, it is considered bad practice to return from
    within a macro and change control flow as they look like normal function calls.
    
    Change-Id: I39b07b3a799331a5faa968629aa95b836cb78600
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 4c9e0d5addd626769123299b593ec937ee52a0b5
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Feb 14 17:43:25 2014 +1300

    Remove NT_STATUS_IS_OK_RETURN macro from the codebase.
    
    Following the current coding guidelines, it is considered bad practice to return from
    within a macro and change control flow as they look like normal function calls.
    
    Change-Id: I27e7597f4078f0a6c96b5dadd12454fffe33e6b2
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit d2beff59ecd50ef2e77684bd0043c3d943a3b245
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Thu Feb 13 18:08:56 2014 +1300

    Remove the remaining uses of the macro NT_STATUS_HAVE_NO_MEMORY_AND_FREE in the codebase.
    
    Following the current coding guidelines, it is considered bad practice to return from
    within a macro and change control flow as they look like normal function calls.
    
    Change-Id: Id1b540cde127395a7b27385a7c0fe79f3a145c73
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 952bc3cad05467959ba5aa08682d754bd80d543b
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Thu Feb 13 17:51:11 2014 +1300

    Remove a number of NT_STATUS_HAVE_NO_MEMORY_AND_FREE macros from the codebase.
    
    Following the current coding guidelines, it is considered bad practice to return from
    within a macro and change control flow as they look like normal function calls.
    
    Change-Id: I133eb5a699757ae57b87d3bd3ebbcf5b556b0268
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 1f60aa8ec2e685517235aadbc11324d3b4a1a74d
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Feb 4 10:22:25 2014 +0000

    winbind4: Remove unused winbind_get_idmap irpc operation
    
    Change-Id: Ia5e62d30b277f8a7074d451cfb8675eee8e9d21f
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 13affa61093d34a8c1bb33f400968f0eb6f5d019
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Feb 4 10:18:48 2014 +0000

    auth4: Remove unused wbc_context
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: I07d9f7d8028429564d91da39f8d1e73cc13a646c
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 5f7b8e42cfeb3e6d2651f14db63b07b884c839d3
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Feb 3 21:36:25 2014 +0100

    ntvfs_unixuid: No wbc_context required
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: I46f5d719005f3ac940482773404702368bbcfa4f
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 65c6daf1a54a94c0dfb4409f7d9919ff88e23627
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Feb 3 21:35:05 2014 +0100

    ntvfs_posix: No wbc_context required
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: Ibce7b25740cc14b0a60ad856f6b18c33115ea6fa
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 212216362b6b9635be5423613e527ce2c95a8f9f
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Feb 3 21:33:21 2014 +0100

    dcesrv_unixinfo: No wbc_context required
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: I58f01cf754e6f9a7715c0319a43ec87d8e5df194
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 0aa080b0f7c4950d29187c2f531e1018d545d007
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 2 15:54:53 2014 +0100

    unixuid: Use the tevent_context from the ntvfs_context
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: I4edb0ee4cefdc2f1b309202c9ec70c7c7bbac0b8
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit d0dc6dbb2b24f70a0ceb9595054ecaf12852c5d5
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 2 15:53:25 2014 +0100

    pvfs: Use the tevent_context from the ntvfs_context
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: Idb3ad8047d5161dd06800df611ea2a9cac84ecaa
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit aa048f6e16ef380622d453cb3286a1f6da73734a
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 2 15:50:08 2014 +0100

    auth4: Do not generate just a temporary wbc_context
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: I16e116d7f1fdaf165e1239c10723c51f3828126d
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit b2c1394e049852e0e879964dde9b011f66ed22b6
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 2 15:48:03 2014 +0100

    auth4: auth_session_info_fill_unix only needs a tevent_context
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: Id453d68f57bd1dd15aa5778b317d258a6132d3d6
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 6edf7a3746de4367f62796c967891b425a09de52
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 2 15:45:47 2014 +0100

    auth4: security_token_to_unix_token only needs a tevent_context
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: I27e5b38fcd3ac899c55c0632ea5d92fad686d9b1
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit dcf29a88bad40b4d22a71838d301e8a51a04d9e4
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 2 15:45:13 2014 +0100

    libwbclient4: Remove unused composite-based functions
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: Iff6169e35f7a82e31c42df7b2d30d122b5f67451
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit eb8f4b846fe2d1ebf7e5a6adc0622aefe54993cb
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 2 15:35:02 2014 +0100

    source4: Use wbc_xids_to_sids
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: Ib1b1a7fcd881510e3fb4e5da29391e3d9392fa17
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 53b7665fc2dc4db911e6245132b8f5799e63e3e9
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 1 20:46:28 2014 +0100

    libwbclient4: Add wbc_xids_to_sids
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: Ibb67f6aabd9a3fbd023ff9ec1a34d82ae599177c
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 7289d1c30b23bbc8552820aad7ec7f6740c305b4
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 30 20:12:07 2014 +0000

    source4: Use wbc_sids_to_xids
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: I86ea6587c436247ce66207c517f9c8d567ecac1d
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 22dabda4c64b9b6704b5411c1fb943f09033e9ab
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 30 19:05:09 2014 +0000

    libwbclient4: Add wbc_sids_to_xids
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Change-Id: I79f4b87a14e7074970bd024626e5838a4461cc2e
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 auth/auth_sam_reply.c                         |   15 +-
 dfs_server/dfs_server_ad.c                    |   40 ++-
 libcli/util/ntstatus.h                        |    8 +
 libgpo/gpo_util.c                             |   40 ++-
 nsswitch/winbind_struct_protocol.h            |   14 +-
 source3/auth/auth_samba4.c                    |   10 +-
 source3/auth/user_info.c                      |   55 +++-
 source3/passdb/pdb_samba_dsdb.c               |   30 ++-
 source3/wscript_build                         |    1 +
 source4/auth/auth.h                           |    1 -
 source4/auth/ntlm/auth.c                      |   12 +-
 source4/auth/sam.c                            |   92 ++++--
 source4/auth/session.c                        |   50 +++-
 source4/auth/unix_token.c                     |   12 +-
 source4/dsdb/common/util_groups.c             |    5 +-
 source4/dsdb/kcc/kcc_topology.c               |  143 ++++++--
 source4/dsdb/repl/drepl_out_helpers.c         |   20 +-
 source4/ldap_server/ldap_extended.c           |    4 +-
 source4/lib/policy/gp_filesys.c               |   30 ++-
 source4/lib/policy/gp_ldap.c                  |  165 +++++++--
 source4/lib/policy/gp_manage.c                |   55 +++-
 source4/libcli/wbclient/wbclient.c            |  455 ++++++++++++++++++-------
 source4/libcli/wbclient/wbclient.h            |   32 +--
 source4/libcli/wbclient/wscript_build         |    2 +-
 source4/libnet/libnet_samsync_ldb.c           |   15 +-
 source4/librpc/idl/winbind.idl                |   24 +--
 source4/ntvfs/posix/pvfs_acl.c                |   53 ++--
 source4/ntvfs/posix/pvfs_acl_nfs4.c           |   14 +-
 source4/ntvfs/posix/vfs_posix.c               |    7 -
 source4/ntvfs/posix/vfs_posix.h               |    1 -
 source4/ntvfs/unixuid/vfs_unixuid.c           |   12 +-
 source4/rpc_server/lsa/dcesrv_lsa.c           |   40 ++-
 source4/rpc_server/unixinfo/dcesrv_unixinfo.c |   52 +---
 source4/smbd/service_stream.c                 |    5 +-
 source4/torture/util_smb.c                    |    5 +-
 source4/winbind/wb_irpc.c                     |   72 ----
 source4/wrepl_server/wrepl_in_call.c          |   10 +-
 source4/wrepl_server/wrepl_in_connection.c    |    4 +-
 38 files changed, 1061 insertions(+), 544 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/auth_sam_reply.c b/auth/auth_sam_reply.c
index 00e04b9..4ede02c 100644
--- a/auth/auth_sam_reply.c
+++ b/auth/auth_sam_reply.c
@@ -154,7 +154,10 @@ NTSTATUS auth_convert_user_info_dc_saminfo3(TALLOC_CTX *mem_ctx,
 
 	sam3->sids = talloc_array(sam, struct netr_SidAttr,
 				  user_info_dc->num_sids);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sam3->sids, sam3);
+	if (sam3->sids == NULL) {
+		TALLOC_FREE(sam3);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	/* We don't put the user and group SIDs in there */
 	for (i=2; i<user_info_dc->num_sids; i++) {
@@ -162,7 +165,10 @@ NTSTATUS auth_convert_user_info_dc_saminfo3(TALLOC_CTX *mem_ctx,
 			continue;
 		}
 		sam3->sids[sam3->sidcount].sid = dom_sid_dup(sam3->sids, &user_info_dc->sids[i]);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sam3->sids[sam3->sidcount].sid, sam3);
+		if (sam3->sids[sam3->sidcount].sid == NULL) {
+			TALLOC_FREE(sam3);
+			return NT_STATUS_NO_MEMORY;
+		}
 		sam3->sids[sam3->sidcount].attributes =
 			SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED;
 		sam3->sidcount += 1;
@@ -429,7 +435,10 @@ NTSTATUS make_user_info_dc_pac(TALLOC_CTX *mem_ctx,
 		sidcount = user_info_dc->num_sids + pac_logon_info->res_groups.count;
 		user_info_dc->sids
 			= talloc_realloc(user_info_dc, user_info_dc->sids, struct dom_sid, sidcount);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info_dc->sids, user_info_dc);
+		if (user_info_dc->sids == NULL) {
+			TALLOC_FREE(user_info_dc);
+			return NT_STATUS_NO_MEMORY;
+		}
 
 		for (i = 0; pac_logon_info->res_group_dom_sid && i < pac_logon_info->res_groups.count; i++) {
 			user_info_dc->sids[user_info_dc->num_sids] = *pac_logon_info->res_group_dom_sid;
diff --git a/dfs_server/dfs_server_ad.c b/dfs_server/dfs_server_ad.c
index 062eb49..504ab79 100644
--- a/dfs_server/dfs_server_ad.c
+++ b/dfs_server/dfs_server_ad.c
@@ -198,11 +198,17 @@ static NTSTATUS get_dcs_insite(TALLOC_CTX *ctx, struct ldb_context *ldb,
 	 * Search all the object of class server in this site
 	 */
 	dc_list = talloc_array(r, const char *, r->count);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(dc_list, r);
+	if (dc_list == NULL) {
+		TALLOC_FREE(r);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	/* TODO put some random here in the order */
 	list->names = talloc_realloc(list, list->names, const char *, list->count + r->count);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(list->names, r);
+	if (list->names == NULL) {
+		TALLOC_FREE(r);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	for (i = 0; i<r->count; i++) {
 		struct ldb_dn  *dn;
@@ -230,7 +236,10 @@ static NTSTATUS get_dcs_insite(TALLOC_CTX *ctx, struct ldb_context *ldb,
 			}
 
 			list->names[list->count] = talloc_strdup(list->names, dns);
-			NT_STATUS_HAVE_NO_MEMORY_AND_FREE(list->names[list->count], r);
+			if (list->names[list->count] == NULL) {
+				TALLOC_FREE(r);
+				return NT_STATUS_NO_MEMORY;
+			}
 		} else {
 			char *tmp;
 			const char *aname = ldb_msg_find_attr_as_string(msg, "sAMAccountName", NULL);
@@ -242,7 +251,10 @@ static NTSTATUS get_dcs_insite(TALLOC_CTX *ctx, struct ldb_context *ldb,
 			}
 
 			tmp = talloc_strdup(list->names, aname);
-			NT_STATUS_HAVE_NO_MEMORY_AND_FREE(tmp, r);
+			if (tmp == NULL) {
+				TALLOC_FREE(r);
+				return NT_STATUS_NO_MEMORY;
+			}
 
 			/* Netbios name is also the sAMAccountName for
 			   computer but without the final $ */
@@ -335,10 +347,16 @@ static NTSTATUS get_dcs(TALLOC_CTX *ctx, struct ldb_context *ldb,
 		sitedn = r->msgs[0]->dn;
 
 		set_list = talloc_realloc(subctx, set_list, struct dc_set *, current_pos+1);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set_list, subctx);
+		if (set_list == NULL) {
+			TALLOC_FREE(subctx);
+			return NT_STATUS_NO_MEMORY;
+		}
 
 		set_list[current_pos] = talloc(set_list, struct dc_set);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set_list[current_pos], subctx);
+		if (set_list[current_pos] == NULL) {
+			TALLOC_FREE(subctx);
+			return NT_STATUS_NO_MEMORY;
+		}
 
 		set_list[current_pos]->names = NULL;
 		set_list[current_pos]->count = 0;
@@ -384,10 +402,16 @@ static NTSTATUS get_dcs(TALLOC_CTX *ctx, struct ldb_context *ldb,
 		 */
 		set_list = talloc_realloc(subctx, set_list, struct dc_set *,
 					  current_pos+2);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set_list, subctx);
+		if (set_list == NULL) {
+			TALLOC_FREE(subctx);
+			return NT_STATUS_NO_MEMORY;
+		}
 
 		set_list[current_pos] = talloc(ctx, struct dc_set);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set_list[current_pos], subctx);
+		if (set_list[current_pos] == NULL) {
+			TALLOC_FREE(subctx);
+			return NT_STATUS_NO_MEMORY;
+		}
 
 		set_list[current_pos]->names = NULL;
 		set_list[current_pos]->count = 0;
diff --git a/libcli/util/ntstatus.h b/libcli/util/ntstatus.h
index 22be74a..5407da0 100644
--- a/libcli/util/ntstatus.h
+++ b/libcli/util/ntstatus.h
@@ -674,6 +674,14 @@ NTSTATUS nt_status_string_to_code(const char *nt_status_str);
 #define NT_STATUS_IS_ERR(x) (unlikely((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000))
 #define NT_STATUS_EQUAL(x,y) (NT_STATUS_V(x) == NT_STATUS_V(y))
 
+/*
+ * These macros (with the embedded return) are considered poor coding
+ * style per README.Coding
+ *
+ * Please do not use them in new code, and do not rely on them in
+ * projects external to Samba as they will go away at some point.
+ */
+
 #define NT_STATUS_HAVE_NO_MEMORY(x) do { \
 	if (unlikely(!(x))) {		\
 		return NT_STATUS_NO_MEMORY;\
diff --git a/libgpo/gpo_util.c b/libgpo/gpo_util.c
index b846d3d..5b801c4 100644
--- a/libgpo/gpo_util.c
+++ b/libgpo/gpo_util.c
@@ -726,34 +726,58 @@ NTSTATUS gpo_copy(TALLOC_CTX *mem_ctx,
 	gpo->version		= gpo_src->version;
 
 	gpo->ds_path		= talloc_strdup(gpo, gpo_src->ds_path);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->ds_path, gpo);
+	if (gpo->ds_path == NULL) {
+		TALLOC_FREE(gpo);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	gpo->file_sys_path	= talloc_strdup(gpo, gpo_src->file_sys_path);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->file_sys_path, gpo);
+	if (gpo->file_sys_path == NULL) {
+		TALLOC_FREE(gpo);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	gpo->display_name	= talloc_strdup(gpo, gpo_src->display_name);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->display_name, gpo);
+	if (gpo->display_name == NULL) {
+		TALLOC_FREE(gpo);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	gpo->name		= talloc_strdup(gpo, gpo_src->name);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->name, gpo);
+	if (gpo->name == NULL) {
+		TALLOC_FREE(gpo);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	gpo->link		= talloc_strdup(gpo, gpo_src->link);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->link, gpo);
+	if (gpo->link == NULL) {
+		TALLOC_FREE(gpo);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	gpo->link_type		= gpo_src->link_type;
 
 	if (gpo_src->user_extensions) {
 		gpo->user_extensions = talloc_strdup(gpo, gpo_src->user_extensions);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->user_extensions, gpo);
+		if (gpo->user_extensions == NULL) {
+			TALLOC_FREE(gpo);
+			return NT_STATUS_NO_MEMORY;
+		}
 	}
 
 	if (gpo_src->machine_extensions) {
 		gpo->machine_extensions = talloc_strdup(gpo, gpo_src->machine_extensions);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->machine_extensions, gpo);
+		if (gpo->machine_extensions == NULL) {
+			TALLOC_FREE(gpo);
+			return NT_STATUS_NO_MEMORY;
+		}
 	}
 
 	gpo->security_descriptor = dup_sec_desc(gpo, gpo_src->security_descriptor);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->security_descriptor, gpo);
+	if (gpo->security_descriptor == NULL) {
+		TALLOC_FREE(gpo);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	gpo->next = gpo->prev = NULL;
 
diff --git a/nsswitch/winbind_struct_protocol.h b/nsswitch/winbind_struct_protocol.h
index 69728b6..fc7aa6c 100644
--- a/nsswitch/winbind_struct_protocol.h
+++ b/nsswitch/winbind_struct_protocol.h
@@ -25,12 +25,16 @@ typedef char fstring[FSTRING_LEN];
 
 #define WINBINDD_SOCKET_NAME "pipe"            /* Name of PF_UNIX socket */
 
-/* Let the build environment override the public winbindd socket location. This
- * is needed for launchd support -- jpeach.
+/* We let the build environment set the public winbindd socket
+ * location. Therefore we no longer set
+ *
+ * #define WINBINDD_SOCKET_DIR "/tmp/.winbindd"
+ *
+ * A number of different distributions set different paths, and so it
+ * needs to come from configure in Samba.  External users of this header will
+ * need to know where the path is on their system by some other
+ * mechanism.
  */
-#ifndef WINBINDD_SOCKET_DIR
-#define WINBINDD_SOCKET_DIR  "/tmp/.winbindd"  /* Name of PF_UNIX dir */
-#endif
 
 /*
  * when compiled with socket_wrapper support
diff --git a/source3/auth/auth_samba4.c b/source3/auth/auth_samba4.c
index 901acf9..0350fec 100644
--- a/source3/auth/auth_samba4.c
+++ b/source3/auth/auth_samba4.c
@@ -125,10 +125,16 @@ static NTSTATUS check_samba4_security(const struct auth_context *auth_context,
 	NT_STATUS_NOT_OK_RETURN(nt_status);
 		
 	nt_status = auth_context_set_challenge(auth4_context, auth_context->challenge.data, "auth_samba4");
-	NT_STATUS_NOT_OK_RETURN_AND_FREE(nt_status, auth4_context);
+	if (!NT_STATUS_IS_OK(nt_status)) {
+		TALLOC_FREE(auth4_context);
+		return nt_status;
+	}
 
 	nt_status = auth_check_password(auth4_context, auth4_context, user_info, &user_info_dc);
-	NT_STATUS_NOT_OK_RETURN_AND_FREE(nt_status, auth4_context);
+	if (!NT_STATUS_IS_OK(nt_status)) {
+		TALLOC_FREE(auth4_context);
+		return nt_status;
+	}
 	
 	nt_status = auth_convert_user_info_dc_saminfo3(mem_ctx,
 						       user_info_dc,
diff --git a/source3/auth/user_info.c b/source3/auth/user_info.c
index 6b98412..61367f9 100644
--- a/source3/auth/user_info.c
+++ b/source3/auth/user_info.c
@@ -72,36 +72,63 @@ NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
 	DEBUG(5,("making strings for %s's user_info struct\n", internal_username));
 
 	user_info->client.account_name = talloc_strdup(user_info, smb_name);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->client.account_name, user_info);
+	if (user_info->client.account_name == NULL) {
+		TALLOC_FREE(user_info);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	user_info->mapped.account_name = talloc_strdup(user_info, internal_username);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->mapped.account_name, user_info);
+	if (user_info->mapped.account_name == NULL) {
+		TALLOC_FREE(user_info);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	user_info->mapped.domain_name = talloc_strdup(user_info, domain);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->mapped.domain_name, user_info);
+	if (user_info->mapped.domain_name == NULL) {
+		TALLOC_FREE(user_info);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	user_info->client.domain_name = talloc_strdup(user_info, client_domain);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->client.domain_name, user_info);
+	if (user_info->client.domain_name == NULL) {
+		TALLOC_FREE(user_info);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	user_info->workstation_name = talloc_strdup(user_info, workstation_name);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->workstation_name, user_info);
+	if (user_info->workstation_name == NULL) {
+		TALLOC_FREE(user_info);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	user_info->remote_host = tsocket_address_copy(remote_address, user_info);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->remote_host, user_info);
+	if (user_info->remote_host == NULL) {
+		TALLOC_FREE(user_info);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	DEBUG(5,("making blobs for %s's user_info struct\n", internal_username));
 
 	if (lm_pwd && lm_pwd->data) {
 		user_info->password.response.lanman = data_blob_talloc(user_info, lm_pwd->data, lm_pwd->length);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.response.lanman.data, user_info);
+		if (user_info->password.response.lanman.data == NULL) {
+			TALLOC_FREE(user_info);
+			return NT_STATUS_NO_MEMORY;
+		}
 	}
 	if (nt_pwd && nt_pwd->data) {
 		user_info->password.response.nt = data_blob_talloc(user_info, nt_pwd->data, nt_pwd->length);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.response.nt.data, user_info);
+		if (user_info->password.response.nt.data == NULL) {
+			TALLOC_FREE(user_info);
+			return NT_STATUS_NO_MEMORY;
+		}
 	}
 	if (lm_interactive_pwd) {
 		user_info->password.hash.lanman = talloc(user_info, struct samr_Password);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.hash.lanman, user_info);
+		if (user_info->password.hash.lanman == NULL) {
+			TALLOC_FREE(user_info);
+			return NT_STATUS_NO_MEMORY;
+		}
 		memcpy(user_info->password.hash.lanman->hash, lm_interactive_pwd->hash,
 		       sizeof(user_info->password.hash.lanman->hash));
 		talloc_set_destructor(user_info->password.hash.lanman, clear_samr_Password);
@@ -109,7 +136,10 @@ NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
 
 	if (nt_interactive_pwd) {
 		user_info->password.hash.nt = talloc(user_info, struct samr_Password);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.hash.nt, user_info);
+		if (user_info->password.hash.nt == NULL) {
+			TALLOC_FREE(user_info);
+			return NT_STATUS_NO_MEMORY;
+		}
 		memcpy(user_info->password.hash.nt->hash, nt_interactive_pwd->hash,
 		       sizeof(user_info->password.hash.nt->hash));
 		talloc_set_destructor(user_info->password.hash.nt, clear_samr_Password);
@@ -117,7 +147,10 @@ NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
 
 	if (plaintext_password) {
 		user_info->password.plaintext = talloc_strdup(user_info, plaintext_password);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.plaintext, user_info);
+		if (user_info->password.plaintext == NULL) {
+			TALLOC_FREE(user_info);
+			return NT_STATUS_NO_MEMORY;
+		}
 		talloc_set_destructor(user_info->password.plaintext, clear_string);
 	}
 
diff --git a/source3/passdb/pdb_samba_dsdb.c b/source3/passdb/pdb_samba_dsdb.c
index 3fc266c..dee20ef 100644
--- a/source3/passdb/pdb_samba_dsdb.c
+++ b/source3/passdb/pdb_samba_dsdb.c
@@ -1172,7 +1172,10 @@ static NTSTATUS pdb_samba_dsdb_enum_group_members(struct pdb_methods *m,
 	}
 
 	*pmembers = members = talloc_array(mem_ctx, uint32_t, num_sids);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(*pmembers, tmp_ctx);
+	if (*pmembers == NULL) {
+		TALLOC_FREE(tmp_ctx);
+		return NT_STATUS_NO_MEMORY;
+	}
 	num_members = 0;
 
 	for (i = 0; i < num_sids; i++) {
@@ -1392,7 +1395,10 @@ static NTSTATUS pdb_samba_dsdb_mod_groupmem_by_sid(struct pdb_methods *m,
 	TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
 	NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
 	msg = ldb_msg_new(tmp_ctx);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, tmp_ctx);
+	if (msg == NULL) {
+		TALLOC_FREE(tmp_ctx);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	msg->dn = ldb_dn_new_fmt(msg, state->ldb, "<SID=%s>", dom_sid_string(tmp_ctx, groupsid));
 	if (!msg->dn || !ldb_dn_validate(msg->dn)) {
@@ -1441,9 +1447,15 @@ static NTSTATUS pdb_samba_dsdb_mod_groupmem(struct pdb_methods *m,
 	dom_sid = samdb_domain_sid(state->ldb);
 
 	groupsid = dom_sid_add_rid(tmp_ctx, dom_sid, grouprid);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(groupsid, tmp_ctx);
+	if (groupsid == NULL) {
+		TALLOC_FREE(tmp_ctx);
+		return NT_STATUS_NO_MEMORY;
+	}
 	membersid = dom_sid_add_rid(tmp_ctx, dom_sid, memberrid);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(membersid, tmp_ctx);
+	if (membersid == NULL) {
+		TALLOC_FREE(tmp_ctx);
+		return NT_STATUS_NO_MEMORY;
+	}
 	status = pdb_samba_dsdb_mod_groupmem_by_sid(m, tmp_ctx, groupsid, membersid, mod_op);
 	talloc_free(tmp_ctx);
 	return status;
@@ -1708,10 +1720,16 @@ static NTSTATUS pdb_samba_dsdb_enum_alias_memberships(struct pdb_methods *m,
 
 	for (i = 0; i < num_members; i++) {
 		sid_string = dom_sid_string(tmp_ctx, &members[i]);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sid_string, tmp_ctx);
+		if (sid_string == NULL) {
+			TALLOC_FREE(tmp_ctx);
+			return NT_STATUS_NO_MEMORY;
+		}
 
 		sid_dn = talloc_asprintf(tmp_ctx, "<SID=%s>", sid_string);
-		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sid_dn, tmp_ctx);
+		if (sid_dn == NULL) {
+			TALLOC_FREE(tmp_ctx);
+			return NT_STATUS_NO_MEMORY;
+		}
 
 		sid_blob = data_blob_string_const(sid_dn);
 
diff --git a/source3/wscript_build b/source3/wscript_build
index 9d3071a..ad83318 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -1231,6 +1231,7 @@ bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3,
                  NDR_OPEN_FILES
                  idmap
                  ''',
+                 cflags='-DWINBINDD_SOCKET_DIR=\"%s\"' % bld.env.WINBINDD_SOCKET_DIR,
                  install=False)
 
 bld.SAMBA3_BINARY('smbconftort',
diff --git a/source4/auth/auth.h b/source4/auth/auth.h
index 503bae9..129f58d 100644
--- a/source4/auth/auth.h
+++ b/source4/auth/auth.h
@@ -97,7 +97,6 @@ struct auth_critical_sizes {
 			   const struct auth_usersupplied_info *user_info_in,
 			   const struct auth_usersupplied_info **user_info_encrypted);
 
-struct wbc_context;
 #include "auth/session.h"
 #include "auth/unix_token_proto.h"
 #include "auth/system_session_proto.h"
diff --git a/source4/auth/ntlm/auth.c b/source4/auth/ntlm/auth.c
index 263dc80..ccfd20a 100644
--- a/source4/auth/ntlm/auth.c
+++ b/source4/auth/ntlm/auth.c
@@ -461,20 +461,12 @@ static NTSTATUS auth_generate_session_info_wrapper(struct auth4_context *auth_co
 
 	if ((session_info_flags & AUTH_SESSION_INFO_UNIX_TOKEN)
 	    && NT_STATUS_IS_OK(status)) {
-		struct wbc_context *wbc_ctx = wbc_init(auth_context,
-						       auth_context->msg_ctx,
-						       auth_context->event_ctx);
-		if (!wbc_ctx) {
-			TALLOC_FREE(*session_info);
-			DEBUG(1, ("Cannot contact winbind to provide unix token\n"));
-			return NT_STATUS_INVALID_SERVER_STATE;
-		}
-		status = auth_session_info_fill_unix(wbc_ctx, auth_context->lp_ctx,
+		status = auth_session_info_fill_unix(auth_context->event_ctx,
+						     auth_context->lp_ctx,
 						     original_user_name, *session_info);
 		if (!NT_STATUS_IS_OK(status)) {
 			TALLOC_FREE(*session_info);
 		}
-		TALLOC_FREE(wbc_ctx);
 	}
 	return status;
 }
diff --git a/source4/auth/sam.c b/source4/auth/sam.c
index 767e44c..ac19862 100644
--- a/source4/auth/sam.c
+++ b/source4/auth/sam.c
@@ -298,15 +298,24 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
 	NT_STATUS_HAVE_NO_MEMORY(user_info_dc);
 
 	tmp_ctx = talloc_new(user_info_dc);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info_dc, user_info_dc);
+	if (user_info_dc == NULL) {
+		TALLOC_FREE(user_info_dc);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	sids = talloc_array(user_info_dc, struct dom_sid, 2);
-	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sids, user_info_dc);
+	if (sids == NULL) {
+		TALLOC_FREE(user_info_dc);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list