Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37046100
en ru br
Репозитории ALT

Группа :: Безопасность/Сети
Пакет: LibreSSL

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: 0002-ALT-netcat-proxy_pass.patch
Скачать


From 3e6549ec544da943f54680ff057ae934b123f56d Mon Sep 17 00:00:00 2001
From: "Vladimir D. Seleznev" <vseleznv@altlinux.org>
Date: Mon, 6 Nov 2017 18:42:39 +0300
Subject: [PATCH] ALT: netcat proxy_pass
---
 libressl/apps/nc/nc.1     | 16 +++++++++++++---
 libressl/apps/nc/netcat.c |  2 +-
 libressl/apps/nc/socks.c  | 12 ++++++++----
 3 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/libressl/apps/nc/nc.1 b/libressl/apps/nc/nc.1
index 4f12508..8f7d154 100644
--- a/libressl/apps/nc/nc.1
+++ b/libressl/apps/nc/nc.1
@@ -44,7 +44,10 @@
 .Op Fl m Ar minttl
 .Op Fl O Ar length
 .Op Fl o Ar staplefile
-.Op Fl P Ar proxy_username
+.Oo Xo
+.Fl P Ar proxy_username Ns Oo : Ns
+.Ar proxy_password Oc Oc
+.Xc
 .Op Fl p Ar source_port
 .Op Fl R Ar CAfile
 .Op Fl s Ar sourceaddr
@@ -207,9 +210,16 @@ Requires
 .Fl c
 and
 .Fl C .
-.It Fl P Ar proxy_username
-Specifies a username to present to a proxy server that requires authentication.
+.It Xo
+.Fl P Ar proxy_username Ns Oo : Ns
+.Ar proxy_password Oc
+.Xc
+Specifies a username and, optionally, password to present to a proxy
+server that requires authentication.
 If no username is specified then authentication will not be attempted.
+If no password is specified then
+.Nm
+will request it.
 Proxy authentication is only supported for HTTP CONNECT proxies at present.
 .It Fl p Ar source_port
 Specify the source port
diff --git a/libressl/apps/nc/netcat.c b/libressl/apps/nc/netcat.c
index 1aa4b6a..442cf7c 100644
--- a/libressl/apps/nc/netcat.c
+++ b/libressl/apps/nc/netcat.c
@@ -1908,7 +1908,7 @@ help(void)
 	\t-n		Suppress name/port resolutions\n\
 	\t-O length	TCP send buffer length\n\
 	\t-o staplefile	Staple file\n\
-	\t-P proxyuser\tUsername for proxy authentication\n\
+	\t-P proxyuser[:pass]\tUsername and optionally password for proxy authentication\n\
 	\t-p port\t	Specify local port for remote connects\n\
 	\t-R CAfile	CA bundle\n\
 	\t-r		Randomize remote ports\n"
diff --git a/libressl/apps/nc/socks.c b/libressl/apps/nc/socks.c
index 7c7448c..80c18ef 100644
--- a/libressl/apps/nc/socks.c
+++ b/libressl/apps/nc/socks.c
@@ -346,10 +346,14 @@ socks_connect(const char *host, const char *port,
 			char proxypass[256];
 			char resp[1024];
 
-			getproxypass(proxyuser, proxyhost,
-			    proxypass, sizeof proxypass);
-			r = snprintf(buf, sizeof(buf), "%s:%s",
-			    proxyuser, proxypass);
+			if (strchr(proxyuser, ':'))
+			    r = snprintf(buf, sizeof(buf), "%s", proxyuser);
+			else {
+			    getproxypass(proxyuser, proxyhost,
+			        proxypass, sizeof proxypass);
+			    r = snprintf(buf, sizeof(buf), "%s:%s",
+				proxyuser, proxypass);
+			}
 			explicit_bzero(proxypass, sizeof proxypass);
 			if (r == -1 || (size_t)r >= sizeof(buf) ||
 			    b64_ntop(buf, strlen(buf), resp,
-- 
2.33.7
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin