From 3_0:
authorVolker Lendecke <vlendec@samba.org>
Fri, 7 Nov 2003 09:04:57 +0000 (09:04 +0000)
committerVolker Lendecke <vlendec@samba.org>
Fri, 7 Nov 2003 09:04:57 +0000 (09:04 +0000)
Simple rename of get_socket_addr to get_peer_addr and get_socket_name to
get_peer_name. This is to get closer to the getsockname/getpeername system
functions.

Next step will be the %i macro for the local IP address. I still want to play
%L-games in times of port 445.

Volker

source/lib/access.c
source/lib/util_sock.c
source/smbd/server.c
source/web/cgi.c
source/wrepld/process.c

index 62414726fb0c4217d941b361f39364457da21fb2..a642a92d7163ef97a64dd69e1c83ba122696e586 100644 (file)
@@ -311,21 +311,21 @@ BOOL check_access(int sock, const char **allow_list, const char **deny_list)
                if (only_ipaddrs_in_list(allow_list) && only_ipaddrs_in_list(deny_list)) {
                        only_ip = True;
                        DEBUG (3, ("check_access: no hostnames in host allow/deny list.\n"));
-                       ret = allow_access(deny_list,allow_list, "", get_socket_addr(sock));
+                       ret = allow_access(deny_list,allow_list, "", get_peer_addr(sock));
                } else {
                        DEBUG (3, ("check_access: hostnames in host allow/deny list.\n"));
-                       ret = allow_access(deny_list,allow_list, get_socket_name(sock,True),
-                                          get_socket_addr(sock));
+                       ret = allow_access(deny_list,allow_list, get_peer_name(sock,True),
+                                          get_peer_addr(sock));
                }
                
                if (ret) {
                        DEBUG(2,("Allowed connection from %s (%s)\n",
-                                only_ip ? "" : get_socket_name(sock,True),
-                                get_socket_addr(sock)));
+                                only_ip ? "" : get_peer_name(sock,True),
+                                get_peer_addr(sock)));
                } else {
                        DEBUG(0,("Denied connection from %s (%s)\n",
-                                only_ip ? "" : get_socket_name(sock,True),
-                                get_socket_addr(sock)));
+                                only_ip ? "" : get_peer_name(sock,True),
+                                get_peer_addr(sock)));
                }
        }
 
index b59d7aa7ebb51b8f823d2f07d4874b74d06dba0f..bdd167b04dd464aadb321deba3520fbbcc0f09c7 100644 (file)
@@ -794,12 +794,12 @@ void client_setfd(int fd)
 
 char *client_name(void)
 {
-       return get_socket_name(client_fd,False);
+       return get_peer_name(client_fd,False);
 }
 
 char *client_addr(void)
 {
-       return get_socket_addr(client_fd);
+       return get_peer_addr(client_fd);
 }
 
 struct in_addr *client_inaddr(struct sockaddr *sa)
@@ -866,7 +866,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, BOOL force_lookup)
+char *get_peer_name(int fd, BOOL force_lookup)
 {
        static pstring name_buf;
        static fstring addr_buf;
@@ -879,10 +879,10 @@ char *get_socket_name(int fd, BOOL force_lookup)
           with dns. To avoid the delay we avoid the lookup if
           possible */
        if (!lp_hostname_lookups() && (force_lookup == False)) {
-               return get_socket_addr(fd);
+               return get_peer_addr(fd);
        }
        
-       p = get_socket_addr(fd);
+       p = get_peer_addr(fd);
 
        /* it might be the same as the last one - save some DNS work */
        if (strcmp(p, addr_buf) == 0) return name_buf;
@@ -918,7 +918,7 @@ char *get_socket_name(int fd, BOOL force_lookup)
  Return the IP addr of the remote end of a socket as a string.
  ******************************************************************/
 
-char *get_socket_addr(int fd)
+char *get_peer_addr(int fd)
 {
        struct sockaddr sa;
        struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
index af39bcb757d601a01b5a63c9a3d046d23d7750fb..89d6f92e9831b3d051581baed0a789ad3887fef8 100644 (file)
@@ -398,7 +398,7 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_
                                
                                /* this is needed so that we get decent entries
                                   in smbstatus for port 445 connects */
-                               set_remote_machine_name(get_socket_addr(smbd_server_fd()), False);
+                               set_remote_machine_name(get_peer_addr(smbd_server_fd()), False);
                                
                                /* Reset global variables in util.c so
                                   that client substitutions will be
index 6778e5965695d93cca4b10ad03419c542d6b44a6..49a8fa92de4a937da3f44e6bfc344d54856c13c4 100644 (file)
@@ -578,7 +578,7 @@ return the hostname of the client
 char *cgi_remote_host(void)
 {
        if (inetd_server) {
-               return get_socket_name(1,False);
+               return get_peer_name(1,False);
        }
        return getenv("REMOTE_HOST");
 }
@@ -589,7 +589,7 @@ return the hostname of the client
 char *cgi_remote_addr(void)
 {
        if (inetd_server) {
-               return get_socket_addr(1);
+               return get_peer_addr(1);
        }
        return getenv("REMOTE_ADDR");
 }
index 1f96dc996cd79aecd917df7f264f805dd4fdd1fe..0e9a9b346104bcbfb4b01b5b1984da9f995b694f 100644 (file)
@@ -342,7 +342,7 @@ static void receive_version_number_map_table(GENERIC_PACKET *q, GENERIC_PACKET *
                return;
        }
 
-       fstrcpy(peer,get_socket_addr(q->fd));
+       fstrcpy(peer,get_peer_addr(q->fd));
        addr=*interpret_addr2(peer);
 
        get_our_last_id(&global_wins_table[0][0]);
@@ -842,7 +842,7 @@ void construct_reply(struct wins_packet_struct *p)
                fstring peer;
                struct in_addr addr;
                int i;
-               fstrcpy(peer,get_socket_addr(p->fd));
+               fstrcpy(peer,get_peer_addr(p->fd));
                addr=*interpret_addr2(peer);
 
                for (i=1; i<partner_count; i++)