s4:netlogon Fix warnings and segfault in GetDomainInfo call
authorAndrew Bartlett <abartlet@samba.org>
Tue, 4 Aug 2009 04:36:14 +0000 (14:36 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 4 Aug 2009 06:10:39 +0000 (16:10 +1000)
 - 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

index 4fedf54fbc0baa150f6cbe7802c8ee67c1eb512e..cee94d8ea6959d7fd8fee07ca9c741b1a21ed8ef 100644 (file)
@@ -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",