Do the reverse DNS lookup, but only if 'hostname lookups = yes'
authorAndrew Bartlett <abartlet@samba.org>
Sat, 9 Feb 2002 03:29:36 +0000 (03:29 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 9 Feb 2002 03:29:36 +0000 (03:29 +0000)
Andrew Bartlett
(This used to be commit dfecd6a4534743a3e140eafc9836911286793951)

source3/smbd/session.c

index c8f77aaa61a65a60b21c94267637b0265765dbc3..6f9d62edfdb920c2711ea6cc2294a43befa72864 100644 (file)
@@ -77,12 +77,14 @@ BOOL session_claim(user_struct *vuser)
                return False;
        }
 
-        /* Don't resolve the hostname in smbd as we can pause for a long
-           time while waiting for DNS timeouts to occur.  The correct
-           place to do this is in the code that displays the session
-           information. */
+       /* If 'hostname lookup' == yes, then do the DNS lookup.  This is
+           needed becouse utmp and PAM both expect DNS names */
 
-        hostname = client_addr();
+       if (lp_hostname_lookups()) {
+               hostname = client_name();
+       } else {
+               hostname = client_addr();
+       }
 
        fstrcpy(sessionid.username, vuser->user.unix_name);
        fstrcpy(sessionid.hostname, hostname);