diff options
author | Samuel Cabrero <scabrero@samba.org> | 2020-01-14 17:12:33 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2020-01-15 21:25:34 +0000 |
commit | 2198da1b9bf79e86112aeeb8e9653f6a82f69e8d (patch) | |
tree | 2e3088c313eb4a31300e4d61ca160ef14c20375e /source3/libsmb/namequery.c | |
parent | 0fcc2e93192b8737b0a711ed2ca118e4e833f3fe (diff) | |
download | samba-2198da1b9bf79e86112aeeb8e9653f6a82f69e8d.tar.gz |
s3:libsmb: Fix querying all names registered within broadcast area
Wait for additional replies until timeout when '*' is given to nmblookup
as name.
Introduced by 8da8c36b53cc115f0d446b666fc24fc9423d808e.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=8927
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libsmb/namequery.c')
-rw-r--r-- | source3/libsmb/namequery.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 5d4fca70b20..e27b60b0398 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1221,6 +1221,7 @@ struct name_query_state { struct sockaddr_storage my_addr; struct sockaddr_storage addr; bool bcast; + bool bcast_star_query; uint8_t buf[1024]; @@ -1288,6 +1289,16 @@ struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx, nmb->header.nscount = 0; nmb->header.arcount = 0; + if (bcast && (strcmp(name, "*")==0)) { + /* + * We're doing a broadcast query for all + * names in the area. Remember this so + * we will wait for all names within + * the timeout period. + */ + state->bcast_star_query = true; + } + make_nmb_name(&nmb->question.question_name,name,name_type); nmb->question.question_type = 0x20; @@ -1445,9 +1456,12 @@ static bool name_query_validator(struct packet_struct *p, void *private_data) if (state->bcast) { /* * We have to collect all entries coming in from broadcast - * queries. If we got a unique name, we're done. + * queries. If we got a unique name and we are not querying + * all names registered within broadcast area (query + * for the name '*', so state->bcast_star_query is set), + * we're done. */ - return got_unique_netbios_name; + return (got_unique_netbios_name && !state->bcast_star_query); } /* * WINS responses are accepted when they are received |