summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_sock.c8
-rw-r--r--source3/param/loadparm.c7
2 files changed, 15 insertions, 0 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 47f1d507ed..9d7e5df303 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -984,6 +984,14 @@ char *get_socket_name(int fd)
struct hostent *hp;
struct in_addr addr;
char *p;
+
+ /* reverse lookups can be *very* expensive, and in many
+ situations won't work because many networks don't link dhcp
+ with dns. To avoid the delay we avoid the lookup if
+ possible */
+ if (!lp_hostname_lookups()) {
+ return get_socket_addr(fd);
+ }
p = get_socket_addr(fd);
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 5e7bb60f69..951bfa5ec2 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -265,6 +265,7 @@ typedef struct
BOOL bHideLocalUsers;
BOOL bUnicode;
BOOL bUseMmap;
+ BOOL bHostnameLookups;
}
global;
@@ -812,6 +813,7 @@ static struct parm_struct parm_table[] = {
{"strict sync", P_BOOL, P_LOCAL, &sDefault.bStrictSync, NULL, NULL, FLAG_SHARE},
{"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL, NULL, FLAG_SHARE},
{"use mmap", P_BOOL, P_GLOBAL, &Globals.bUseMmap, NULL, NULL, 0},
+ {"hostname lookups", P_BOOL, P_GLOBAL, &Globals.bHostnameLookups, NULL, NULL, 0},
{"write cache size", P_INTEGER, P_LOCAL, &sDefault.iWriteCacheSize, NULL, NULL, FLAG_SHARE},
{"Printing Options", P_SEP, P_SEPARATOR},
@@ -1289,6 +1291,10 @@ static void init_globals(void)
Globals.bUseMmap = True;
#endif
+ /* hostname lookups can be very expensive and are broken on
+ a large number of sites (tridge) */
+ Globals.bHostnameLookups = False;
+
#ifdef WITH_LDAP
/* default values for ldap */
string_set(&Globals.szLdapServer, "localhost");
@@ -1565,6 +1571,7 @@ FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
+FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)