summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-09-13 00:30:47 +0000
committerAndrew Tridgell <tridge@samba.org>2001-09-13 00:30:47 +0000
commit5366c4c542b2a1c7bcc268daba02af25ce6eab6e (patch)
tree3c80b79714c09b01abe0fc45a8c2d441f16e5c9e /source3
parent544d0cf82988e270dbf91e0d3ee18efcbb452567 (diff)
downloadsamba-5366c4c542b2a1c7bcc268daba02af25ce6eab6e.tar.gz
samba-5366c4c542b2a1c7bcc268daba02af25ce6eab6e.tar.bz2
samba-5366c4c542b2a1c7bcc268daba02af25ce6eab6e.zip
added a new global option "hostname lookups = yes/no"
This should finally kill off the remaining places where we attempt reverse lookups of the IP of the client. It may be that some pam modules called via the session code will need "hostname lookups = yes" but I've left it off by default as most sites don't need it and so many sites have broken reverse maps (This used to be commit 2b83ad03965d00bba88fe56452d2990099b75ef1)
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)