Loading source3/lib/util_sock.c +22 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,23 @@ static char *get_socket_addr(int fd) return addr_buf; } static int get_socket_port(int fd) { struct sockaddr sa; struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa); socklen_t length = sizeof(sa); if (fd == -1) return -1; if (getsockname(fd, &sa, &length) < 0) { DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) )); return -1; } return ntohs(sockin->sin_port); } /**************************************************************************** Determine if a file descriptor is in fact a socket. ****************************************************************************/ Loading Loading @@ -837,6 +854,11 @@ char *client_socket_addr(void) return get_socket_addr(client_fd); } int client_socket_port(void) { return get_socket_port(client_fd); } struct in_addr *client_inaddr(struct sockaddr *sa) { struct sockaddr_in *sockin = (struct sockaddr_in *) (sa); Loading source3/param/loadparm.c +4 −1 Original line number Diff line number Diff line Loading @@ -4262,7 +4262,10 @@ const char *get_called_name(void) extern fstring local_machine; static fstring called_name; if (!*local_machine) { if ( (!*local_machine) || (client_socket_port() == 445) ) { /* Everybody coming in on 445 should be able to live with the * IP address */ fstrcpy(called_name, client_socket_addr()); DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n", called_name)); Loading Loading
source3/lib/util_sock.c +22 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,23 @@ static char *get_socket_addr(int fd) return addr_buf; } static int get_socket_port(int fd) { struct sockaddr sa; struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa); socklen_t length = sizeof(sa); if (fd == -1) return -1; if (getsockname(fd, &sa, &length) < 0) { DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) )); return -1; } return ntohs(sockin->sin_port); } /**************************************************************************** Determine if a file descriptor is in fact a socket. ****************************************************************************/ Loading Loading @@ -837,6 +854,11 @@ char *client_socket_addr(void) return get_socket_addr(client_fd); } int client_socket_port(void) { return get_socket_port(client_fd); } struct in_addr *client_inaddr(struct sockaddr *sa) { struct sockaddr_in *sockin = (struct sockaddr_in *) (sa); Loading
source3/param/loadparm.c +4 −1 Original line number Diff line number Diff line Loading @@ -4262,7 +4262,10 @@ const char *get_called_name(void) extern fstring local_machine; static fstring called_name; if (!*local_machine) { if ( (!*local_machine) || (client_socket_port() == 445) ) { /* Everybody coming in on 445 should be able to live with the * IP address */ fstrcpy(called_name, client_socket_addr()); DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n", called_name)); Loading