]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: Add utility funtion dup_ip_service_array().
authorJeremy Allison <jra@samba.org>
Tue, 25 Aug 2020 17:22:10 +0000 (10:22 -0700)
committerNoel Power <npower@samba.org>
Mon, 7 Sep 2020 13:23:40 +0000 (13:23 +0000)
Preparing to return ip_service arrays as talloc, not
malloc. Commented out as not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/libsmb/namequery.c

index 2a91ec4e98d28579691384dca699b99a3774cc75..d1135e65d3d062979ce4e05573d9ba14b0aebaf3 100644 (file)
@@ -64,6 +64,31 @@ bool sockaddr_storage_to_samba_sockaddr(struct samba_sockaddr *sa,
        return true;
 }
 
+#if 0
+/*
+ * Utility function to convert a MALLOC'ed struct ip_serivce array
+ * to a talloc'ed one. This function will go away once all ip_service
+ * arrays are talloc'ed.
+ */
+
+static NTSTATUS dup_ip_service_array(TALLOC_CTX *ctx,
+                               struct ip_service **array_out,
+                               const struct ip_service *array_in,
+                               size_t count)
+{
+       struct ip_service *array_copy = NULL;
+
+       array_copy = talloc_memdup(ctx,
+                               array_in,
+                               count * sizeof(array_in[0]));
+       if (array_copy == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       *array_out = array_copy;
+       return NT_STATUS_OK;
+}
+#endif
+
 /****************************
  * SERVER AFFINITY ROUTINES *
  ****************************/