summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-13 23:08:28 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-15 15:39:35 +1000
commitdbc9b185afa2fe59f73526b081ef6acff7d61aaa (patch)
tree04da1059562f51d84d5e1dfaabaec80a158e3212 /source4/libcli
parentfa7fd4f261955753edfa3a415dcbf1f206200504 (diff)
downloadsamba-dbc9b185afa2fe59f73526b081ef6acff7d61aaa.tar.gz
samba-dbc9b185afa2fe59f73526b081ef6acff7d61aaa.tar.bz2
samba-dbc9b185afa2fe59f73526b081ef6acff7d61aaa.zip
s4-resolve: added resolve_name_multiple_recv()
this allows for multiple replies to a SRV lookup Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/resolve/resolve.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c
index d9352b4226..c17e93a1f6 100644
--- a/source4/libcli/resolve/resolve.c
+++ b/source4/libcli/resolve/resolve.c
@@ -267,6 +267,40 @@ NTSTATUS resolve_name_recv(struct composite_context *c,
}
/*
+ receive multiple responses from resolve_name_send()
+ */
+NTSTATUS resolve_name_multiple_recv(struct composite_context *c,
+ TALLOC_CTX *mem_ctx,
+ const char ***reply_addrs)
+{
+ NTSTATUS status;
+ struct socket_address **addrs = NULL;
+ int i;
+
+ status = resolve_name_all_recv(c, mem_ctx, &addrs, NULL);
+ NT_STATUS_NOT_OK_RETURN(status);
+
+ /* count the addresses */
+ for (i=0; addrs[i]; i++) ;
+
+ *reply_addrs = talloc_array(mem_ctx, const char *, i+1);
+ NT_STATUS_HAVE_NO_MEMORY(*reply_addrs);
+
+ for (i=0; addrs[i]; i++) {
+ struct tsocket_address *t_addr = socket_address_to_tsocket_address(addrs, addrs[i]);
+ NT_STATUS_HAVE_NO_MEMORY(t_addr);
+
+ (*reply_addrs)[i] = tsocket_address_inet_addr_string(t_addr, *reply_addrs);
+ NT_STATUS_HAVE_NO_MEMORY((*reply_addrs)[i]);
+ }
+ (*reply_addrs)[i] = NULL;
+
+ talloc_free(addrs);
+
+ return status;
+}
+
+/*
general name resolution - sync call
*/
NTSTATUS resolve_name_ex(struct resolve_context *ctx,