From d5cca8d0fcb063d39572ca88903a4582c2425175 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 17 Jul 2020 12:55:53 +0200 Subject: [PATCH] lib: Remove unused client_socket_addr() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- lib/util/util_net.c | 38 -------------------------------------- lib/util/util_net.h | 1 - source3/include/proto.h | 1 - 3 files changed, 40 deletions(-) diff --git a/lib/util/util_net.c b/lib/util/util_net.c index ad6ee792084..8b416455a9f 100644 --- a/lib/util/util_net.c +++ b/lib/util/util_net.c @@ -927,44 +927,6 @@ int get_socket_port(int fd) return -1; } -/**************************************************************************** - Return the string of an IP address (IPv4 or IPv6). -****************************************************************************/ - -static const char *get_socket_addr(int fd, char *addr_buf, size_t addr_len) -{ - struct sockaddr_storage sa; - socklen_t length = sizeof(sa); - - /* Ok, returning a hard coded IPv4 address - * is bogus, but it's just as bogus as a - * zero IPv6 address. No good choice here. - */ - - if (strlcpy(addr_buf, "0.0.0.0", addr_len) >= addr_len) { - /* Truncate ! */ - return NULL; - } - - if (fd == -1) { - return addr_buf; - } - - if (getsockname(fd, (struct sockaddr *)&sa, &length) < 0) { - DEBUG(0,("getsockname failed. Error was %s\n", - strerror(errno) )); - return addr_buf; - } - - return print_sockaddr_len(addr_buf, addr_len, (struct sockaddr *)&sa, length); -} - -const char *client_socket_addr(int fd, char *addr, size_t addr_len) -{ - return get_socket_addr(fd, addr, addr_len); -} - - enum SOCK_OPT_TYPES {OPT_BOOL,OPT_INT,OPT_ON}; typedef struct smb_socket_option { diff --git a/lib/util/util_net.h b/lib/util/util_net.h index a14f9a95171..6e991b8f904 100644 --- a/lib/util/util_net.h +++ b/lib/util/util_net.h @@ -121,7 +121,6 @@ char *print_sockaddr(char *dest, char *print_canonical_sockaddr(TALLOC_CTX *ctx, const struct sockaddr_storage *pss); int get_socket_port(int fd); -const char *client_socket_addr(int fd, char *addr, size_t addr_len); void set_socket_options(int fd, const char *options); diff --git a/source3/include/proto.h b/source3/include/proto.h index 0717e4c3f4f..1027d4e091a 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -520,7 +520,6 @@ char *print_sockaddr(char *dest, char *print_canonical_sockaddr(TALLOC_CTX *ctx, const struct sockaddr_storage *pss); int get_socket_port(int fd); -const char *client_socket_addr(int fd, char *addr, size_t addr_len); int client_socket_port(int fd); bool is_a_socket(int fd); void set_socket_options(int fd, const char *options); -- 2.47.2