summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-05-14 18:04:49 +0200
committerVolker Lendecke <vlendec@samba.org>2011-05-14 18:57:57 +0200
commit30be9fe554af0f63e1c5fe0b3dd60b8a084cf2c8 (patch)
tree02901e569dc0bcb683a1b8fb5c4b3b21bd090a0b /source3
parent115d0ecf88a5cae2d684264f570892fb763d54d2 (diff)
downloadsamba-30be9fe554af0f63e1c5fe0b3dd60b8a084cf2c8.tar.gz
samba-30be9fe554af0f63e1c5fe0b3dd60b8a084cf2c8.tar.bz2
samba-30be9fe554af0f63e1c5fe0b3dd60b8a084cf2c8.zip
s3: Make&use set_socket_addr_v4
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sat May 14 18:57:57 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/namequery.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 417d4ffc95..1cd5eb79bb 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -197,6 +197,17 @@ char *saf_fetch( const char *domain )
return server;
}
+static void set_socket_addr_v4(struct sockaddr_storage *addr)
+{
+ if (!interpret_string_addr(addr, lp_socket_address(),
+ AI_NUMERICHOST|AI_PASSIVE)) {
+ zero_sockaddr(addr);
+ }
+ if (addr->ss_family != AF_INET) {
+ zero_sockaddr(addr);
+ }
+}
+
/****************************************************************************
Generate a random trn_id.
****************************************************************************/
@@ -705,10 +716,7 @@ struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
in_addr = (struct sockaddr_in *)(void *)&state->addr;
in_addr->sin_port = htons(NMB_PORT);
- if (!interpret_string_addr(&state->my_addr, lp_socket_address(),
- AI_NUMERICHOST|AI_PASSIVE)) {
- zero_sockaddr(&state->my_addr);
- }
+ set_socket_addr_v4(&state->my_addr);
ZERO_STRUCT(p);
nmb->header.name_trn_id = generate_trn_id();
@@ -892,10 +900,7 @@ bool name_status_find(const char *q_name,
return false;
}
- if (!interpret_string_addr(&ss, lp_socket_address(),
- AI_NUMERICHOST|AI_PASSIVE)) {
- zero_sockaddr(&ss);
- }
+ set_socket_addr_v4(&ss);
/* W2K PDC's seem not to respond to '*'#0. JRA */
make_nmb_name(&nname, q_name, q_type);
@@ -1202,10 +1207,7 @@ struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
in_addr = (struct sockaddr_in *)(void *)&state->addr;
in_addr->sin_port = htons(NMB_PORT);
- if (!interpret_string_addr(&state->my_addr, lp_socket_address(),
- AI_NUMERICHOST|AI_PASSIVE)) {
- zero_sockaddr(&state->my_addr);
- }
+ set_socket_addr_v4(&state->my_addr);
ZERO_STRUCT(p);
nmb->header.name_trn_id = generate_trn_id();