From: Andrew Bartlett Date: Tue, 4 Aug 2009 04:36:14 +0000 (+1000) Subject: s4:netlogon Fix warnings and segfault in GetDomainInfo call X-Git-Tag: talloc-2.0.0~483 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b02d2391443c3c56d607d034d9d200703aa840b;p=thirdparty%2Fsamba.git s4:netlogon Fix warnings and segfault in GetDomainInfo call - Correctly use samdb_search_string to do a 'base' search (this needs a NULL, not a "" argument for the format string) - There is no need (and it caused a security hole) to use talloc_asprintf() with the only argument being the string to duplicate. Andrew Bartlett --- diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index 4fedf54fbc0..cee94d8ea69 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -1157,8 +1157,9 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal NT_STATUS_HAVE_NO_MEMORY(workstation_dn); /* Gets the old DNS hostname */ - old_dns_hostname = samdb_search_string_v(sam_ctx, mem_ctx, - workstation_dn, "dNSHostName", "", NULL); + old_dns_hostname = samdb_search_string(sam_ctx, mem_ctx, + workstation_dn, "dNSHostName", + NULL); /* Gets host informations and put them in our directory */ new_msg = ldb_msg_new(mem_ctx); @@ -1197,8 +1198,8 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal os_version = &r->in.query->workstation_info->os_version.os->os; samdb_msg_set_string(sam_ctx, mem_ctx, new_msg, - "operatingSystemServicePack", - talloc_asprintf(mem_ctx, os_version->CSDVersion)); + "operatingSystemServicePack", + os_version->CSDVersion); samdb_msg_set_string(sam_ctx, mem_ctx, new_msg, "operatingSystemVersion",