summaryrefslogtreecommitdiff
path: root/source3/libsmb/namecache.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-06-25 17:41:05 +0000
committerGerald Carter <jerry@samba.org>2003-06-25 17:41:05 +0000
commitf51d769dd303027a3dbf46fc89a482933988e866 (patch)
tree5bb400a9df1f6fb27f2b045a6521e2995de8c686 /source3/libsmb/namecache.c
parenteb61c8238298e97644202139e6d7f55e46eb9c26 (diff)
downloadsamba-f51d769dd303027a3dbf46fc89a482933988e866.tar.gz
samba-f51d769dd303027a3dbf46fc89a482933988e866.tar.bz2
samba-f51d769dd303027a3dbf46fc89a482933988e866.zip
large change:
*) consolidates the dc location routines again (dns and netbios) get_dc_list() or get_sorted_dc_list() is the authoritative means of locating DC's again. (also inludes a flag to get_dc_list() to define if this should be a DNS only lookup or not) (however, if you set "name resolve order = hosts wins" you could still get DNS queries for domain name IFF ldap_domain2hostlist() fails. The answer? Fix your DNS setup) *) enabled DOMAIN<0x1c> lookups to be funneled through resolve_hosts resulting in a call to ldap_domain2hostlist() if lp_security() == SEC_ADS *) enables name cache for winbind ADS backend *) enable the negative connection cache for winbind ADS backend *) removes some old dead code *) consolidates some duplicate code *) moves the internal_name_resolve() to use an IP/port pair to deal with SRV RR dns replies. The namecache code also supports the IP:port syntax now as well. *) removes 'ads server' and moves the functionality back into 'password server' (which can support "hostname:port" syntax now but works fine with defaults depending on the value of lp_security()) (This used to be commit d7f7fcda425bef380441509734eca33da943c091)
Diffstat (limited to 'source3/libsmb/namecache.c')
-rw-r--r--source3/libsmb/namecache.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/source3/libsmb/namecache.c b/source3/libsmb/namecache.c
index 7a0eb5212a..e3e7ac4e3c 100644
--- a/source3/libsmb/namecache.c
+++ b/source3/libsmb/namecache.c
@@ -113,7 +113,7 @@ static char* namecache_key(const char *name, int name_type)
**/
BOOL namecache_store(const char *name, int name_type,
- int num_names, struct in_addr *ip_list)
+ int num_names, struct ip_service *ip_list)
{
time_t expiry;
char *key, *value_string;
@@ -126,35 +126,18 @@ BOOL namecache_store(const char *name, int name_type,
*/
if (!gencache_init()) return False;
- DEBUG(5, ("namecache_store: storing %d address%s for %s#%02x: ",
- num_names, num_names == 1 ? "": "es", name, name_type));
-
- for (i = 0; i < num_names; i++)
- DEBUGADD(5, ("%s%s", inet_ntoa(ip_list[i]),
- i == (num_names - 1) ? "" : ", "));
-
- DEBUGADD(5, ("\n"));
+ if ( DEBUGLEVEL >= 5 ) {
+ DEBUG(5, ("namecache_store: storing %d address%s for %s#%02x: ",
+ num_names, num_names == 1 ? "": "es", name, name_type));
+ for (i = 0; i < num_names; i++)
+ DEBUGADD(5, ("%s:%d%s", inet_ntoa(ip_list[i].ip),
+ ip_list[i].port, (i == (num_names - 1) ? "" : ",")));
+
+ DEBUGADD(5, ("\n"));
+ }
+
key = namecache_key(name, name_type);
-
- /*
- * Cache pdc location or dc lists for only a little while
- * otherwise if we lock on to a bad DC we can potentially be
- * out of action for the entire cache timeout time!
- */
-
-#if 0
- /*
- * I don't think we need to do this. We are
- * checking at a higher level for failed DC
- * connections. JRA.
- */
-
- if (name_type == 0x1b || name_type == 0x1c)
- expiry = time(NULL) + 10;
- else
- expiry = time(NULL) + lp_name_cache_timeout();
-#endif
expiry = time(NULL) + lp_name_cache_timeout();
/*
@@ -189,7 +172,7 @@ BOOL namecache_store(const char *name, int name_type,
* false if name isn't found in the cache or has expired
**/
-BOOL namecache_fetch(const char *name, int name_type, struct in_addr **ip_list,
+BOOL namecache_fetch(const char *name, int name_type, struct ip_service **ip_list,
int *num_names)
{
char *key, *value;
@@ -224,7 +207,8 @@ BOOL namecache_fetch(const char *name, int name_type, struct in_addr **ip_list,
*num_names = ipstr_list_parse(value, ip_list);
SAFE_FREE(key);
- SAFE_FREE(value);
+ SAFE_FREE(value);
+
return *num_names > 0; /* true only if some ip has been fetched */
}