From 9b02d2391443c3c56d607d034d9d200703aa840b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 4 Aug 2009 14:36:14 +1000 Subject: [PATCH 1/1] 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 --- source4/rpc_server/netlogon/dcerpc_netlogon.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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", -- 2.34.1