summaryrefslogtreecommitdiffstats
path: root/source3/nmbd/asyncdns.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-12-06 23:06:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:45 -0500
commit83b987befdbba857131102700d237728784b6f69 (patch)
treee2256666211d54b6781c1e48ab1ba95ad1b788c3 /source3/nmbd/asyncdns.c
parent436b3dd88a703c4f79c638d76cb0219fc8870bda (diff)
downloadsamba-83b987befdbba857131102700d237728784b6f69.tar.gz
samba-83b987befdbba857131102700d237728784b6f69.tar.xz
samba-83b987befdbba857131102700d237728784b6f69.zip
r12107: Move to a tdb-based wins database. At the moment we still
use it as though it were an in-memory db and dump out to a flat file every 2 mins, but that can now change. Jeremy. (This used to be commit a342681792724c1ae8561ba8d352c4ee6e2a5332)
Diffstat (limited to 'source3/nmbd/asyncdns.c')
-rw-r--r--source3/nmbd/asyncdns.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index 4db54ea198..c0626d1161 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -34,16 +34,18 @@ static struct name_record *add_dns_result(struct nmb_name *question, struct in_a
if (!addr.s_addr) {
/* add the fail to WINS cache of names. give it 1 hour in the cache */
DEBUG(3,("add_dns_result: Negative DNS answer for %s\n", qname));
- (void)add_name_to_subnet( wins_server_subnet, qname, name_type,
+ add_name_to_subnet( wins_server_subnet, qname, name_type,
NB_ACTIVE, 60*60, DNSFAIL_NAME, 1, &addr );
- return( NULL );
+ return NULL;
}
/* add it to our WINS cache of names. give it 2 hours in the cache */
DEBUG(3,("add_dns_result: DNS gave answer for %s of %s\n", qname, inet_ntoa(addr)));
- return( add_name_to_subnet( wins_server_subnet, qname, name_type,
- NB_ACTIVE, 2*60*60, DNS_NAME, 1, &addr ) );
+ add_name_to_subnet( wins_server_subnet, qname, name_type,
+ NB_ACTIVE, 2*60*60, DNS_NAME, 1, &addr);
+
+ return find_name_on_subnet(wins_server_subnet, question, FIND_ANY_NAME);
}
#ifndef SYNC_DNS
@@ -283,8 +285,7 @@ void run_dns_queue(void)
queue a DNS query
****************************************************************************/
-BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
- struct name_record **n)
+BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question)
{
if (in_dns || fd_in == -1)
return False;
@@ -316,9 +317,9 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
we use this when we can't do async DNS lookups
****************************************************************************/
-BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
- struct name_record **n)
+BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question)
{
+ struct name_record *namerec = NULL;
struct in_addr dns_ip;
unstring qname;
@@ -334,11 +335,12 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
/* Re-block TERM signal. */
BlockSignals(True, SIGTERM);
- *n = add_dns_result(question, dns_ip);
- if(*n == NULL)
+ namerec = add_dns_result(question, dns_ip);
+ if(namerec == NULL) {
send_wins_name_query_response(NAM_ERR, p, NULL);
- else
- send_wins_name_query_response(0, p, *n);
+ } else {
+ send_wins_name_query_response(0, p, namerec);
+ }
return False;
}