Another patch from Steve Langasek <vorlon@netexpress.net>, again from the
authorAndrew Bartlett <abartlet@samba.org>
Thu, 3 Oct 2002 03:31:41 +0000 (03:31 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 3 Oct 2002 03:31:41 +0000 (03:31 +0000)
Debian patchset.

The idea is to still allow DNS domains to be specified in 'hosts allow' and
'hosts deny' without making the admin set 'hostname lookups' in their smb.conf.
His concern is about upgrades.

This has been designed not to change the value of %M.

Andrew Bartlett
(This used to be commit f428ee98d83a55922c991b0eeddd47891b80d918)

source3/lib/access.c
source3/lib/util_sock.c
source3/web/cgi.c

index 4e524735e49cb48394aefcd30fc17617fc5a1db2..a39bc6df763c035921c06397cdbf20ce7caa0a26 100644 (file)
@@ -316,20 +316,20 @@ BOOL check_access(int sock, char **allow_list, char **deny_list)
                else
                {
                        DEBUG (3, ("check_access: hostnames in host allow/deny list.\n"));
-                       ret = allow_access(deny_list,allow_list, get_socket_name(sock),
+                       ret = allow_access(deny_list,allow_list, get_socket_name(sock,True),
                                           get_socket_addr(sock));
                }
                
                if (ret) 
                {
                        DEBUG(2,("Allowed connection from %s (%s)\n",
-                                only_ip ? "" : get_socket_name(sock),
+                                only_ip ? "" : get_socket_name(sock,True),
                                 get_socket_addr(sock)));
                } 
                else 
                {
                        DEBUG(0,("Denied connection from %s (%s)\n",
-                                only_ip ? "" : get_socket_name(sock),
+                                only_ip ? "" : get_socket_name(sock,True),
                                 get_socket_addr(sock)));
                }
        }
index fc2abf976f45512b299c5a7152e000e3127ff9de..04c20f65967c58b56d375ce1561116fa187adda8 100644 (file)
@@ -832,7 +832,7 @@ void client_setfd(int fd)
 
 char *client_name(void)
 {
-       return get_socket_name(client_fd);
+       return get_socket_name(client_fd,False);
 }
 
 char *client_addr(void)
@@ -890,7 +890,7 @@ static BOOL matchname(char *remotehost,struct in_addr  addr)
 /*******************************************************************
  return the DNS name of the remote end of a socket
  ******************************************************************/
-char *get_socket_name(int fd)
+char *get_socket_name(int fd, BOOL force_lookup)
 {
        static pstring name_buf;
        static fstring addr_buf;
@@ -902,7 +902,7 @@ char *get_socket_name(int fd)
           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()) {
+       if (!lp_hostname_lookups() && (force_lookup == False)) {
                return get_socket_addr(fd);
        }
        
index 7415fbe3f15ce1e179aa0864ea4cf14faf20558b..27cc932abe75488adb6afb4efc51f3b1f46aef3a 100644 (file)
@@ -636,7 +636,7 @@ return the hostname of the client
 char *cgi_remote_host(void)
 {
        if (inetd_server) {
-               return get_socket_name(1);
+               return get_socket_name(1,False);
        }
        return getenv("REMOTE_HOST");
 }