tinyproxy: Update to 1.11.1
authorZhang Rui <[email protected]>
Tue, 28 Mar 2023 08:45:52 +0000 (16:45 +0800)
committerTianling Shen <[email protected]>
Wed, 5 Apr 2023 15:47:30 +0000 (23:47 +0800)
Signed-off-by: Zhang Rui <[email protected]>
net/tinyproxy/Makefile
net/tinyproxy/files/tinyproxy.config
net/tinyproxy/files/tinyproxy.init
net/tinyproxy/patches/120-fix_INET6.patch

index 89a4bd0c95e10b4a3e4a7ed9a1ea0a3ad4d52a3e..b1ac9cf19d3dad6b2a346cb0c778790bf0ac5772 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=tinyproxy
-PKG_VERSION:=1.10.0
+PKG_VERSION:=1.11.1
 PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://github.com/tinyproxy/tinyproxy/releases/download/$(PKG_VERSION)
-PKG_HASH:=59be87689c415ba0d9c9bc6babbdd3df3b372d60b21e526b118d722dbc995682
+PKG_HASH:=d66388448215d0aeb90d0afdd58ed00386fb81abc23ebac9d80e194fceb40f7c
 
 PKG_MAINTAINER:=Jo-Philipp Wich <[email protected]>
 PKG_LICENSE:=GPL-2.0-or-later
index ac7b46ff0cc42e8d98549c9e55334a03ba843dfb..e62ce1cf03d4a01c56e393d293c7ebb07dd6d5fe 100644 (file)
@@ -63,6 +63,13 @@ option DefaultErrorFile "/usr/share/tinyproxy/default.html"
 #
 option StatFile "/usr/share/tinyproxy/stats.html"
 
+#
+# BasicAuth: Tinyproxy server operators may want to not run an "open" proxy 
+# for the whole world, but rather limit usage to a smaller goup 
+# of users. They then put the line.
+#
+#option BasicAuth "username password"
+
 #
 # Where to log the information. Either LogFile or Syslog should be set,
 # but not both.
index 1feac669c3d1433ed78404e8a72f0740e4822c2e..4afdae6aa22cce4fe8b04e77af1e8cec2112dc13 100644 (file)
@@ -55,6 +55,14 @@ proxy_string() {
        }
 }
 
+proxy_m_string() {
+       local SECTION=$1
+       local OPTION=$2
+
+       config_get _value "$SECTION" "$OPTION"
+       [ -n "$_value" ] && echo "${ALIAS:-${OPTION}} ""$_value"
+}
+
 proxy_flag() {
        local SECTION=$1
        local OPTION=$2
@@ -108,6 +116,8 @@ start_proxy() {
        proxy_string "$1" StatFile
        proxy_string "$1" LogFile
 
+       proxy_m_string "$1" BasicAuth
+
        proxy_flag "$1" Syslog
 
        proxy_atom "$1" LogLevel
index 3911c18f0b3857b13e3cd5292245f0930883c69e..6281a422390746128124b2cbfacff34d690f1391 100644 (file)
@@ -1,16 +1,15 @@
 --- a/src/sock.c
 +++ b/src/sock.c
-@@ -39,8 +39,7 @@
-  * returned if the bind succeeded.  Otherwise, -1 is returned
+@@ -63,7 +63,7 @@ static const char * family_string (int a
   * to indicate an error.
   */
--static int
+ static int
 -bind_socket (int sockfd, const char *addr, int family)
-+static int bind_socket (int sockfd, const char *addr)
++bind_socket (int sockfd, const char *addr)
  {
          struct addrinfo hints, *res, *ressave;
-@@ -48,7 +47,7 @@ bind_socket (int sockfd, const char *add
+         int n;
+@@ -72,14 +72,14 @@ bind_socket (int sockfd, const char *add
          assert (addr != NULL && strlen (addr) != 0);
  
          memset (&hints, 0, sizeof (struct addrinfo));
 +        hints.ai_family = AF_UNSPEC;
          hints.ai_socktype = SOCK_STREAM;
  
-         /* The local port it not important */
-@@ -112,14 +111,12 @@ int opensock (const char *host, int port
+         /* The local port is not important */
+         n = getaddrinfo (addr, NULL, &hints, &res);
+         if (n != 0) {
+                 log_message (LOG_INFO,
+-                        "bind_socket: getaddrinfo failed for %s: %s (af: %s)", addr, get_gai_error (n), family_string(family));
++                        "bind_socket: getaddrinfo failed for %s: %s", addr, get_gai_error (n));
+                 return -1;
+         }
+@@ -102,14 +102,14 @@ bind_socket (int sockfd, const char *add
+  * Try binding the given socket to supplied addresses, stopping when one succeeds.
+  */
+ static int
+-bind_socket_list (int sockfd, sblist *addresses, int family)
++bind_socket_list (int sockfd, sblist *addresses)
+ {
+         size_t nb_addresses = sblist_getsize(addresses);
+         size_t i;
+         for (i = 0; i < nb_addresses; i++) {
+                 const char *address = *(const char **)sblist_get(addresses, i);
+-                if (bind_socket(sockfd, address, family) >= 0) {
++                if (bind_socket(sockfd, address) >= 0) {
+                         log_message(LOG_INFO, "Bound to %s", address);
+                         return 0;
+                 }
+@@ -170,14 +170,12 @@ int opensock (const char *host, int port
  
                  /* Bind to the specified address */
                  if (bind_to) {
                                  close (sockfd);
                                  continue;       /* can't bind, so try again */
                          }
-                 } else if (config.bind_address) {
--                        if (bind_socket (sockfd, config.bind_address,
--                                         res->ai_family) < 0) {
-+                        if (bind_socket (sockfd, config.bind_address) < 0) {
+                 } else if (config->bind_addrs) {
+-                        if (bind_socket_list (sockfd, config->bind_addrs,
+-                                              res->ai_family) < 0) {
++                        if (bind_socket_list (sockfd, config->bind_addrs) < 0) {
                                  close (sockfd);
                                  continue;       /* can't bind, so try again */
                          }