[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sat Jan 23 06:36:06 MST 2010


The branch, master has been updated
       via  a771c18... libreplace: Fix a C++ warning
       via  dbf9017... s3: Remove string_sid_talloc
       via  2002b4e... s3: Remove a call to string_sid_talloc
       via  c2c71b8... s3: Fix sending NULL sids to lookupsids3
       via  9fcbe3a... s3: Remove some pointless uses of string_sid_talloc
       via  3e1a161... s3: Use global_sid_Builtin in net_groupmap_memberships
       via  8905b59... s3: Fix some nonempty blank lines
      from  4c54804... s4:kdc Simplify header files

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


- Log -----------------------------------------------------------------
commit a771c184b19cfabfebd77d61ea2d5c51b5f61ef7
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 3 18:46:21 2010 +0100

    libreplace: Fix a C++ warning

commit dbf9017a807f317333596092fc3493d7c5a96c65
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 23 13:31:27 2010 +0100

    s3: Remove string_sid_talloc
    
    All but one call were pointless, so I think this API should go

commit 2002b4e4c23d1a5392c4c09ecfb9b0e9f34487ae
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 23 13:30:04 2010 +0100

    s3: Remove a call to string_sid_talloc

commit c2c71b8e053ea5a619c94d9dc30a01ae3627da91
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 23 13:26:55 2010 +0100

    s3: Fix sending NULL sids to lookupsids3

commit 9fcbe3a65c6f30754f3f705c3e0b4a4ae150c679
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 23 13:18:00 2010 +0100

    s3: Remove some pointless uses of string_sid_talloc

commit 3e1a1616ec2b51993e988e43ecf0c0f78b1607e5
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 23 13:17:28 2010 +0100

    s3: Use global_sid_Builtin in net_groupmap_memberships

commit 8905b599b467f0595cf5874b7e36d9a650f8544a
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 23 13:33:10 2010 +0100

    s3: Fix some nonempty blank lines

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

Summary of changes:
 lib/replace/replace.c           |    4 ++--
 source3/include/proto.h         |    1 -
 source3/lib/eventlog/eventlog.c |    2 +-
 source3/lib/util_sid.c          |   35 +++++++++++------------------------
 source3/librpc/ndr/sid.c        |   10 +++++-----
 source3/passdb/pdb_ldap.c       |   14 ++++++--------
 source3/rpcclient/cmd_lsarpc.c  |   26 ++++++++++++++++----------
 source3/smbd/process.c          |    6 +++---
 source3/utils/net_groupmap.c    |    7 +++----
 9 files changed, 47 insertions(+), 58 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index 17fd46b..df29185 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -691,8 +691,8 @@ void *rep_memmem(const void *haystack, size_t haystacklen,
 		return discard_const(haystack);
 	}
 	while (haystacklen >= needlelen) {
-		char *p = memchr(haystack, *(const char *)needle,
-				 haystacklen-(needlelen-1));
+		char *p = (char *)memchr(haystack, *(const char *)needle,
+					 haystacklen-(needlelen-1));
 		if (!p) return NULL;
 		if (memcmp(p, needle, needlelen) == 0) {
 			return p;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c3f0dff..01372c2 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1317,7 +1317,6 @@ char *sid_string_talloc(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
 char *sid_string_dbg(const DOM_SID *sid);
 char *sid_string_tos(const DOM_SID *sid);
 bool string_to_sid(DOM_SID *sidout, const char *sidstr);
-DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr);
 bool sid_append_rid(DOM_SID *sid, uint32 rid);
 bool sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid);
 bool sid_split_rid(DOM_SID *sid, uint32 *rid);
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c
index 42b2a06..1c0dba9 100644
--- a/source3/lib/eventlog/eventlog.c
+++ b/source3/lib/eventlog/eventlog.c
@@ -940,7 +940,7 @@ NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx,
 			return NT_STATUS_INVALID_SID;
 		}
 		if (len > 0) {
-			e->UserSid = *string_sid_talloc(mem_ctx, sid_str);
+			string_to_sid(&e->UserSid, sid_str);
 		}
 	}
 
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 1f47bf3..20c2663 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -7,17 +7,17 @@
    Copyright (C) Stefan (metze) Metzmacher 	2002
    Copyright (C) Simo Sorce 			2002
    Copyright (C) Jim McDonough <jmcd at us.ibm.com> 2005
-      
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -216,14 +216,14 @@ char *sid_string_tos(const DOM_SID *sid)
 /*****************************************************************
  Convert a string to a SID. Returns True on success, False on fail.
 *****************************************************************/  
-   
+
 bool string_to_sid(DOM_SID *sidout, const char *sidstr)
 {
 	const char *p;
 	char *q;
 	/* BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 */
 	uint32 conv;
-  
+
 	if ((sidstr[0] != 'S' && sidstr[0] != 's') || sidstr[1] != '-') {
 		DEBUG(3,("string_to_sid: Sid %s does not start with 'S-'.\n", sidstr));
 		return False;
@@ -267,21 +267,8 @@ bool string_to_sid(DOM_SID *sidout, const char *sidstr)
 			break;
 		q++;
 	}
-		
-	return True;
-}
-
-DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr)
-{
-	DOM_SID *result = TALLOC_P(mem_ctx, DOM_SID);
-
-	if (result == NULL)
-		return NULL;
-
-	if (!string_to_sid(result, sidstr))
-		return NULL;
 
-	return result;
+	return True;
 }
 
 /*****************************************************************
@@ -325,7 +312,7 @@ bool sid_peek_rid(const DOM_SID *sid, uint32 *rid)
 {
 	if (!sid || !rid)
 		return False;		
-	
+
 	if (sid->num_auths > 0) {
 		*rid = sid->sub_auths[sid->num_auths - 1];
 		return True;
@@ -342,7 +329,7 @@ bool sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *
 {
 	if (!exp_dom_sid || !sid || !rid)
 		return False;
-			
+
 	if (sid->num_auths != (exp_dom_sid->num_auths+1)) {
 		return False;
 	}
@@ -351,7 +338,7 @@ bool sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *
 		*rid=(-1);
 		return False;
 	}
-	
+
 	return sid_peek_rid(sid, rid);
 }
 
@@ -635,7 +622,7 @@ void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, size_t *num)
 
 	for ( ; i<*num; i++ ) 
 		sid_copy( &sid_list[i], &sid_list[i+1] );
-	
+
 	return;
 }
 
@@ -648,7 +635,7 @@ bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx,
 		if ((*pp_rids)[i] == rid)
 			return True;
 	}
-	
+
 	*pp_rids = TALLOC_REALLOC_ARRAY(mem_ctx, *pp_rids, uint32, *p_num+1);
 
 	if (*pp_rids == NULL) {
diff --git a/source3/librpc/ndr/sid.c b/source3/librpc/ndr/sid.c
index 252da85..eb5c2c4 100644
--- a/source3/librpc/ndr/sid.c
+++ b/source3/librpc/ndr/sid.c
@@ -4,17 +4,17 @@
    libndr interface
 
    Copyright (C) Andrew Tridgell 2003
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -29,7 +29,7 @@ char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
 	int i, ofs, maxlen;
 	uint32_t ia;
 	char *ret;
-	
+
 	if (!sid) {
 		return talloc_strdup(mem_ctx, "(NULL SID)");
 	}
@@ -54,6 +54,6 @@ char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
 	for (i = 0; i < sid->num_auths; i++) {
 		ofs += snprintf(ret + ofs, maxlen - ofs, "-%lu", (unsigned long)sid->sub_auths[i]);
 	}
-	
+
 	return ret;
 }
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 758701b..68e0c22 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -5012,7 +5012,7 @@ static bool ldapsam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
 	LDAPMessage *entry = NULL;
 	bool ret = false;
 	char *user_sid_string;
-	DOM_SID *user_sid;
+	struct dom_sid user_sid;
 	int rc;
 	TALLOC_CTX *tmp_ctx = talloc_stackframe();
 
@@ -5051,14 +5051,13 @@ static bool ldapsam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
 		goto done;
 	}
 
-	user_sid = string_sid_talloc(tmp_ctx, user_sid_string);
-	if (user_sid == NULL) {
+	if (!string_to_sid(&user_sid, user_sid_string)) {
 		DEBUG(3, ("Error calling sid_string_talloc for sid '%s'\n",
 			  user_sid_string));
 		goto done;
 	}
 
-	sid_copy(sid, user_sid);
+	sid_copy(sid, &user_sid);
 
 	store_uid_sid_cache(sid, uid);
 	idmap_cache_set_sid2uid(sid, uid);
@@ -6048,18 +6047,17 @@ static bool ldapsam_get_trusteddom_pw(struct pdb_methods *methods,
 	/* domain sid */
 	if (sid != NULL) {
 		char *sid_str;
-		DOM_SID *dom_sid;
+		struct dom_sid dom_sid;
 		sid_str = smbldap_talloc_single_attribute(priv2ld(ldap_state),
 							  entry, "sambaSID",
 							  talloc_tos());
 		if (sid_str == NULL) {
 			return False;
 		}
-		dom_sid = string_sid_talloc(talloc_tos(), sid_str);
-		if (dom_sid == NULL) {
+		if (!string_to_sid(&dom_sid, sid_str)) {
 			return False;
 		}
-		sid_copy(sid, dom_sid);
+		sid_copy(sid, &dom_sid);
 	}
 
 	return True;
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index e0f4ac4..04aec66 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -10,12 +10,12 @@
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -173,7 +173,7 @@ static NTSTATUS cmd_lsa_query_info_policy(struct rpc_pipe_client *cli,
 
 		if (!NT_STATUS_IS_OK(result))
 			goto done;
-			
+
 		result = rpccli_lsa_QueryInfoPolicy2(cli, mem_ctx,
 						     &pol,
 						     info_class,
@@ -186,7 +186,7 @@ static NTSTATUS cmd_lsa_query_info_policy(struct rpc_pipe_client *cli,
 
 		if (!NT_STATUS_IS_OK(result))
 			goto done;
-		
+
 		result = rpccli_lsa_QueryInfoPolicy(cli, mem_ctx,
 						    &pol,
 						    info_class,
@@ -451,8 +451,12 @@ static NTSTATUS cmd_lsa_lookup_sids3(struct rpc_pipe_client *cli,
 	}
 
 	for (i = 0; i < sids.num_sids; i++) {
-		sids.sids[0].sid = string_sid_talloc(sids.sids, argv[i + 1]);
-		if (!sids.sids[0].sid) {
+		sids.sids[i].sid = talloc(sids.sids, struct dom_sid);
+		if (sids.sids[i].sid == NULL) {
+			result = NT_STATUS_NO_MEMORY;
+			goto done;
+		}
+		if (!string_to_sid(sids.sids[i].sid, argv[i+1])) {
 			result = NT_STATUS_INVALID_SID;
 			goto done;
 		}
@@ -726,7 +730,7 @@ static NTSTATUS cmd_lsa_create_account(struct rpc_pipe_client *cli,
 	struct policy_handle user_pol;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
 	uint32 des_access = 0x000f000f;
-	
+
 	DOM_SID sid;
 
 	if (argc != 2 ) {
@@ -1072,14 +1076,14 @@ static void display_trust_dom_info_4(struct lsa_TrustDomainInfoPassword *p,
 				     uint8_t session_key[16])
 {
 	char *pwd, *pwd_old;
-	
+
 	DATA_BLOB data 	   = data_blob_const(p->password->data, p->password->length);
 	DATA_BLOB data_old = data_blob_const(p->old_password->data, p->old_password->length);
 	DATA_BLOB session_key_blob = data_blob_const(session_key, sizeof(session_key));
 
 	pwd 	= sess_decrypt_string(talloc_tos(), &data, &session_key_blob);
 	pwd_old = sess_decrypt_string(talloc_tos(), &data_old, &session_key_blob);
-	
+
 	d_printf("Password:\t%s\n", pwd);
 	d_printf("Old Password:\t%s\n", pwd_old);
 
@@ -1843,6 +1847,7 @@ static NTSTATUS cmd_lsa_create_trusted_domain(struct rpc_pipe_client *cli,
 {
 	NTSTATUS status;
 	struct policy_handle handle, trustdom_handle;
+	struct dom_sid sid;
 	struct lsa_DomainInfo info;
 
 	if (argc < 3) {
@@ -1859,7 +1864,8 @@ static NTSTATUS cmd_lsa_create_trusted_domain(struct rpc_pipe_client *cli,
 	}
 
 	init_lsa_StringLarge(&info.name, argv[1]);
-	info.sid = string_sid_talloc(mem_ctx, argv[2]);
+	info.sid = &sid;
+	string_to_sid(&sid, argv[2]);
 
 	status = rpccli_lsa_CreateTrustedDomain(cli, mem_ctx,
 						&handle,
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 6783308..65bb25d 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1552,7 +1552,7 @@ static void construct_reply_common(struct smb_request *req, const char *inbuf,
 				   char *outbuf)
 {
 	srv_set_message(outbuf,0,0,false);
-	
+
 	SCVAL(outbuf, smb_com, req->cmd);
 	SIVAL(outbuf,smb_rcls,0);
 	SCVAL(outbuf,smb_flg, FLAG_REPLY | (CVAL(inbuf,smb_flg) & FLAG_CASELESS_PATHNAMES)); 
@@ -2059,11 +2059,11 @@ void check_reload(time_t t)
 	}
 
 	/* 'printcap cache time = 0' disable the feature */
-	
+
 	if ( printcap_cache_time != 0 )
 	{ 
 		/* see if it's time to reload or if the clock has been set back */
-		
+
 		if ( (t >= last_printer_reload_time+printcap_cache_time) 
 			|| (t-last_printer_reload_time  < 0) ) 
 		{
diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c
index 94576d3..b39a52e 100644
--- a/source3/utils/net_groupmap.c
+++ b/source3/utils/net_groupmap.c
@@ -813,7 +813,7 @@ static bool print_alias_memberships(TALLOC_CTX *mem_ctx,
 static int net_groupmap_memberships(struct net_context *c, int argc, const char **argv)
 {
 	TALLOC_CTX *mem_ctx;
-	DOM_SID *domain_sid, *builtin_sid, member;
+	DOM_SID *domain_sid, member;
 
 	if ( (argc != 1) ||
 	     c->display_usage ||
@@ -831,14 +831,13 @@ static int net_groupmap_memberships(struct net_context *c, int argc, const char
 	}
 
 	domain_sid = get_global_sam_sid();
-	builtin_sid = string_sid_talloc(mem_ctx, "S-1-5-32");
-	if ((domain_sid == NULL) || (builtin_sid == NULL)) {
+	if (domain_sid == NULL) {
 		d_fprintf(stderr, _("Could not get domain sid\n"));
 		return -1;
 	}
 
 	if (!print_alias_memberships(mem_ctx, domain_sid, &member) ||
-	    !print_alias_memberships(mem_ctx, builtin_sid, &member))
+	    !print_alias_memberships(mem_ctx, &global_sid_Builtin, &member))
 		return -1;
 
 	talloc_destroy(mem_ctx);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list