From: "flichtenheld (Code Review)" Date: Fri, 12 Jan 2024 14:14:08 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <57157c23530a1bdd1e4e62d97ecf23369cd3159e-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="vCI7bLkr02k="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: --http-proxy-user-pass: allow to specify in either order with --http-... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --vCI7bLkr02k= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/499?usp=3Demail to review the following change. Change subject: --http-proxy-user-pass: allow to specify in either order wi= th --http-proxy ...................................................................... --http-proxy-user-pass: allow to specify in either order with --http-proxy Previously, when using a third argument to --http-proxy other than auto/auto-nct, order did matter between --http-proxy and --http-proxy-user-pass. Always prefer --http-proxy-user-pass when given. Change-Id: I6f402db2fb73f1206fbc1139c47d2bf4378376fa Signed-off-by: Frank Lichtenheld --- M src/openvpn/options.c M src/openvpn/proxy.c M src/openvpn/proxy.h 3 files changed, 11 insertions(+), 3 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/99/499/1 diff --git a/src/openvpn/options.c b/src/openvpn/options.c index f54f276..e393511 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1649,6 +1649,8 @@ SHOW_STR(port); SHOW_STR(auth_method_string); SHOW_STR(auth_file); + SHOW_STR(auth_file_up); + SHOW_BOOL(inline_creds); SHOW_STR(http_version); SHOW_STR(user_agent); for (i =3D 0; i < MAX_CUSTOM_HTTP_HEADER && o->custom_headers[i].name= ; i++) @@ -6824,7 +6826,7 @@ struct http_proxy_options *ho; VERIFY_PERMISSION(OPT_P_GENERAL|OPT_P_INLINE); ho =3D init_http_proxy_options_once(&options->ce.http_proxy_option= s, &options->gc); - ho->auth_file =3D p[1]; + ho->auth_file_up =3D p[1]; ho->inline_creds =3D is_inline; } else if (streq(p[0], "http-proxy-retry") || streq(p[0], "socks-proxy-r= etry")) diff --git a/src/openvpn/proxy.c b/src/openvpn/proxy.c index e081532..e2324f4 100644 --- a/src/openvpn/proxy.c +++ b/src/openvpn/proxy.c @@ -271,6 +271,11 @@ if (!static_proxy_user_pass.defined) { unsigned int flags =3D GET_USER_PASS_MANAGEMENT; + const char *auth_file =3D p->options.auth_file; + if (p->options.auth_file_up) + { + auth_file =3D p->options.auth_file_up; + } if (p->queried_creds) { flags |=3D GET_USER_PASS_PREVIOUS_CREDS_FAILED; @@ -280,7 +285,7 @@ flags |=3D GET_USER_PASS_INLINE_CREDS; } get_user_pass(&static_proxy_user_pass, - p->options.auth_file, + auth_file, UP_TYPE_PROXY, flags); p->queried_creds =3D true; diff --git a/src/openvpn/proxy.h b/src/openvpn/proxy.h index 7900244..4e78772 100644 --- a/src/openvpn/proxy.h +++ b/src/openvpn/proxy.h @@ -52,10 +52,11 @@ const char *auth_method_string; const char *auth_file; + const char *auth_file_up; /* specified with --http-proxy-user-pass */ const char *http_version; const char *user_agent; struct http_custom_header custom_headers[MAX_CUSTOM_HTTP_HEADER]; - bool inline_creds; + bool inline_creds; /* auth_file_up is inline credentials */ }; struct http_proxy_options_simple { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/499?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6f402db2fb73f1206fbc1139c47d2bf4378376fa Gerrit-Change-Number: 499 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange --vCI7bLkr02k= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

Vi= ew Change

--http-proxy-user-pass: allow to specify in either order with=
 --http-proxy

Previously, when using a third argument to --http-prox= y other
than auto/auto-nct, order did matter between --http-proxy and--http-proxy-user-pass. Always prefer --http-proxy-user-pass
when given= .

Change-Id: I6f402db2fb73f1206fbc1139c47d2bf4378376fa
Signed-off= -by: Frank Lichtenheld <frank@...2641...>
---
M src/openvpn/opt= ions.c
M src/openvpn/proxy.c
M src/openvpn/proxy.h
3 files changed= , 11 insertions(+), 3 deletions(-)

git pull ssh://gerrit.openvpn.=
net:29418/openvpn refs/changes/99/499/1
diff --git a/src/openvpn/op=
tions.c b/src/openvpn/options.c
index f54f276..e393511 1006= 44
--- a/src/openvpn/options.c
+++ b/src/op= envpn/options.c
@@ -1649,6 +1649,8 @@
= SHOW_STR(port);
SHOW_STR(auth_method_string); SHOW_STR(auth_file);
+ SHOW_STR(auth_file_up);
+ SHOW_BOOL(inline_creds);
SHO= W_STR(http_version);
SHOW_STR(user_agent);
<= span> for (i =3D 0; i < MAX_CUSTOM_HTTP_HEADER && o->cus= tom_headers[i].name; i++)
@@ -6824,7 +6826,7 @@
<= span> struct http_proxy_options *ho;
VERIF= Y_PERMISSION(OPT_P_GENERAL|OPT_P_INLINE);
ho =3D i= nit_http_proxy_options_once(&options->ce.http_proxy_options, &op= tions->gc);
- = ho->auth_file =3D p[1];
+ ho->auth_file_up =3D p[1];
ho-&= gt;inline_creds =3D is_inline;
}
= else if (streq(p[0], "http-proxy-retry") || streq(p[0], "soc= ks-proxy-retry"))
diff --git a/src/openvpn/proxy.c b/s= rc/openvpn/proxy.c
index e081532..e2324f4 100644
= --- a/src/openvpn/proxy.c
+++ b/src/openvpn/proxy.c
@@ -271,6 +271,11 @@
if (!static_proxy_= user_pass.defined)
{
unsigned= int flags =3D GET_USER_PASS_MANAGEMENT;
+ const char *auth_file =3D p->options.auth_f= ile;
+ if (p-&= gt;options.auth_file_up)
+ {
+ = auth_file =3D p->options.auth_file_up;
+ }
if (p->q= ueried_creds)
{
flags= |=3D GET_USER_PASS_PREVIOUS_CREDS_FAILED;
@@ -280,7 +285,7= @@
flags |=3D GET_USER_PASS_INLINE_CREDS;
}
get_user_pass(&static_= proxy_user_pass,
- = p->options.auth_file,
+ auth_file,
= UP_TYPE_PROXY,
fl= ags);
p->queried_creds =3D true;
diff --git a/src/openvpn/proxy.h b/src/openvpn/proxy.h

in= dex 7900244..4e78772 100644
--- a/src/openvpn/proxy.h
+++ b/src/openvpn/proxy.h
@@ -52,10 +52,11 @@

const char *auth_method_string;=
const char *auth_file;
+ const char *auth_file_up; /* specified with --http-pr= oxy-user-pass */
const char *http_version;
<= span> const char *user_agent;

struct http_custom_h= eader custom_headers[MAX_CUSTOM_HTTP_HEADER];
- bool inline_creds;
+ bool inline_creds; /* auth_file_up is inline= credentials */
};

stru= ct http_proxy_options_simple {

To view,= visit ch= ange 499. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6f402db2fb73f1206fbc1139c47= d2bf4378376fa
Gerrit-Change-Number: 499
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-MessageType: newchange
--vCI7bLkr02k=--