mirror of
				https://github.com/samba-team/samba.git
				synced 2025-11-04 00:23:49 +03:00 
			
		
		
		
	r25175: Change to talloc_asprintf_append_buffer().
Jeremy.
This commit is contained in:
		
				
					committed by
					
						
						Gerald (Jerry) Carter
					
				
			
			
				
	
			
			
			
						parent
						
							82383a6c12
						
					
				
				
					commit
					0844dbf597
				
			@@ -536,26 +536,26 @@ struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
 | 
			
		||||
				 ldap_encode_ndr_uint32(tmp_ctx, io->in.version));
 | 
			
		||||
	if (filter == NULL) goto failed;
 | 
			
		||||
	if (io->in.user) {
 | 
			
		||||
		filter = talloc_asprintf_append(filter, "(User=%s)", io->in.user);
 | 
			
		||||
		filter = talloc_asprintf_append_buffer(filter, "(User=%s)", io->in.user);
 | 
			
		||||
		if (filter == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
	if (io->in.host) {
 | 
			
		||||
		filter = talloc_asprintf_append(filter, "(Host=%s)", io->in.host);
 | 
			
		||||
		filter = talloc_asprintf_append_buffer(filter, "(Host=%s)", io->in.host);
 | 
			
		||||
		if (filter == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
	if (io->in.realm) {
 | 
			
		||||
		filter = talloc_asprintf_append(filter, "(DnsDomain=%s)", io->in.realm);
 | 
			
		||||
		filter = talloc_asprintf_append_buffer(filter, "(DnsDomain=%s)", io->in.realm);
 | 
			
		||||
		if (filter == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
	if (io->in.acct_control != -1) {
 | 
			
		||||
		filter = talloc_asprintf_append(filter, "(AAC=%s)", 
 | 
			
		||||
		filter = talloc_asprintf_append_buffer(filter, "(AAC=%s)", 
 | 
			
		||||
						ldap_encode_ndr_uint32(tmp_ctx, io->in.acct_control));
 | 
			
		||||
		if (filter == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
	if (io->in.domain_sid) {
 | 
			
		||||
		struct dom_sid *sid = dom_sid_parse_talloc(tmp_ctx, io->in.domain_sid);
 | 
			
		||||
		if (sid == NULL) goto failed;
 | 
			
		||||
		filter = talloc_asprintf_append(filter, "(domainSid=%s)",
 | 
			
		||||
		filter = talloc_asprintf_append_buffer(filter, "(domainSid=%s)",
 | 
			
		||||
						ldap_encode_ndr_dom_sid(tmp_ctx, sid));
 | 
			
		||||
		if (filter == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
@@ -564,11 +564,11 @@ struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
 | 
			
		||||
		NTSTATUS status;
 | 
			
		||||
		status = GUID_from_string(io->in.domain_guid, &guid);
 | 
			
		||||
		if (!NT_STATUS_IS_OK(status)) goto failed;
 | 
			
		||||
		filter = talloc_asprintf_append(filter, "(DomainGuid=%s)",
 | 
			
		||||
		filter = talloc_asprintf_append_buffer(filter, "(DomainGuid=%s)",
 | 
			
		||||
						ldap_encode_ndr_GUID(tmp_ctx, &guid));
 | 
			
		||||
		if (filter == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
	filter = talloc_asprintf_append(filter, ")");
 | 
			
		||||
	filter = talloc_asprintf_append_buffer(filter, ")");
 | 
			
		||||
	if (filter == NULL) goto failed;
 | 
			
		||||
 | 
			
		||||
	search.in.dest_address = io->in.dest_address;
 | 
			
		||||
 
 | 
			
		||||
@@ -111,7 +111,7 @@ _PUBLIC_ NTSTATUS ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const
 | 
			
		||||
		NT_STATUS_NOT_OK_RETURN(status);
 | 
			
		||||
		if (component == NULL) break;
 | 
			
		||||
		if (name) {
 | 
			
		||||
			name = talloc_asprintf_append(name, ".%s", component);
 | 
			
		||||
			name = talloc_asprintf_append_buffer(name, ".%s", component);
 | 
			
		||||
			NT_STATUS_HAVE_NO_MEMORY(name);
 | 
			
		||||
		} else {
 | 
			
		||||
			name = (char *)component;
 | 
			
		||||
 
 | 
			
		||||
@@ -405,7 +405,7 @@ static char *sddl_flags_to_string(TALLOC_CTX *mem_ctx, const struct flag_map *ma
 | 
			
		||||
	/* now by bits */
 | 
			
		||||
	for (i=0;map[i].name;i++) {
 | 
			
		||||
		if ((flags & map[i].flag) != 0) {
 | 
			
		||||
			s = talloc_asprintf_append(s, "%s", map[i].name);
 | 
			
		||||
			s = talloc_asprintf_append_buffer(s, "%s", map[i].name);
 | 
			
		||||
			if (s == NULL) goto failed;
 | 
			
		||||
			flags &= ~map[i].flag;
 | 
			
		||||
		}
 | 
			
		||||
@@ -532,7 +532,7 @@ static char *sddl_encode_acl(TALLOC_CTX *mem_ctx, const struct security_acl *acl
 | 
			
		||||
	for (i=0;i<acl->num_aces;i++) {
 | 
			
		||||
		char *ace = sddl_encode_ace(sddl, &acl->aces[i], domain_sid);
 | 
			
		||||
		if (ace == NULL) goto failed;
 | 
			
		||||
		sddl = talloc_asprintf_append(sddl, "(%s)", ace);
 | 
			
		||||
		sddl = talloc_asprintf_append_buffer(sddl, "(%s)", ace);
 | 
			
		||||
		if (sddl == NULL) goto failed;
 | 
			
		||||
		talloc_free(ace);
 | 
			
		||||
	}
 | 
			
		||||
@@ -563,28 +563,28 @@ char *sddl_encode(TALLOC_CTX *mem_ctx, const struct security_descriptor *sd,
 | 
			
		||||
	if (sd->owner_sid != NULL) {
 | 
			
		||||
		char *sid = sddl_encode_sid(tmp_ctx, sd->owner_sid, domain_sid);
 | 
			
		||||
		if (sid == NULL) goto failed;
 | 
			
		||||
		sddl = talloc_asprintf_append(sddl, "O:%s", sid);
 | 
			
		||||
		sddl = talloc_asprintf_append_buffer(sddl, "O:%s", sid);
 | 
			
		||||
		if (sddl == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (sd->group_sid != NULL) {
 | 
			
		||||
		char *sid = sddl_encode_sid(tmp_ctx, sd->group_sid, domain_sid);
 | 
			
		||||
		if (sid == NULL) goto failed;
 | 
			
		||||
		sddl = talloc_asprintf_append(sddl, "G:%s", sid);
 | 
			
		||||
		sddl = talloc_asprintf_append_buffer(sddl, "G:%s", sid);
 | 
			
		||||
		if (sddl == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((sd->type & SEC_DESC_DACL_PRESENT) && sd->dacl != NULL) {
 | 
			
		||||
		char *acl = sddl_encode_acl(tmp_ctx, sd->dacl, sd->type, domain_sid);
 | 
			
		||||
		if (acl == NULL) goto failed;
 | 
			
		||||
		sddl = talloc_asprintf_append(sddl, "D:%s", acl);
 | 
			
		||||
		sddl = talloc_asprintf_append_buffer(sddl, "D:%s", acl);
 | 
			
		||||
		if (sddl == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((sd->type & SEC_DESC_SACL_PRESENT) && sd->sacl != NULL) {
 | 
			
		||||
		char *acl = sddl_encode_acl(tmp_ctx, sd->sacl, sd->type>>1, domain_sid);
 | 
			
		||||
		if (acl == NULL) goto failed;
 | 
			
		||||
		sddl = talloc_asprintf_append(sddl, "S:%s", acl);
 | 
			
		||||
		sddl = talloc_asprintf_append_buffer(sddl, "S:%s", acl);
 | 
			
		||||
		if (sddl == NULL) goto failed;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -514,13 +514,13 @@ BOOL ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID)
 | 
			
		||||
 | 
			
		||||
	tmp_oid = talloc_asprintf(mem_ctx, "%u",  b[0]/40);
 | 
			
		||||
	if (!tmp_oid) goto nomem;
 | 
			
		||||
	tmp_oid = talloc_asprintf_append(tmp_oid, ".%u",  b[0]%40);
 | 
			
		||||
	tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u",  b[0]%40);
 | 
			
		||||
	if (!tmp_oid) goto nomem;
 | 
			
		||||
 | 
			
		||||
	for(i = 1, v = 0; i < blob.length; i++) {
 | 
			
		||||
		v = (v<<7) | (b[i]&0x7f);
 | 
			
		||||
		if ( ! (b[i] & 0x80)) {
 | 
			
		||||
			tmp_oid = talloc_asprintf_append(tmp_oid, ".%u",  v);
 | 
			
		||||
			tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u",  v);
 | 
			
		||||
			v = 0;
 | 
			
		||||
		}
 | 
			
		||||
		if (!tmp_oid) goto nomem;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user