From c95e727267fed5211f8c88a6708ff21a7f57eed2 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 21 Sep 2013 16:21:44 +0200 Subject: Update to v3 of custom header patch --- openvpn/src/openvpn/options.c | 14 +++++++++++--- openvpn/src/openvpn/proxy.c | 7 +++---- src/de/blinkt/openvpn/fragments/Settings_Basic.java | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/openvpn/src/openvpn/options.c b/openvpn/src/openvpn/options.c index 01960f23..d1c5583f 100644 --- a/openvpn/src/openvpn/options.c +++ b/openvpn/src/openvpn/options.c @@ -1296,6 +1296,7 @@ option_iroute_ipv6 (struct options *o, static void show_http_proxy_options (const struct http_proxy_options *o) { + int i; msg (D_SHOW_PARMS, "BEGIN http_proxy"); SHOW_STR (server); SHOW_STR (port); @@ -1305,6 +1306,15 @@ show_http_proxy_options (const struct http_proxy_options *o) SHOW_INT (timeout); SHOW_STR (http_version); SHOW_STR (user_agent); + for (i=0; i < MAX_CUSTOM_HTTP_HEADER && o->custom_headers[i].name;i++) + { + if (o->custom_headers[i].content) + msg (D_SHOW_PARMS, " custom_header[%d] = %s: %s", i, + o->custom_headers[i].name, o->custom_headers[i].content); + else + msg (D_SHOW_PARMS, " custom_header[%d] = %s", i, + o->custom_headers[i].name); + } msg (D_SHOW_PARMS, "END http_proxy"); } #endif @@ -4984,10 +4994,9 @@ add_option (struct options *options, { /* In the wild patched versions use both EXT1/2 and CUSTOM-HEADER with either two * argument or one */ + struct http_custom_header *custom_header =NULL; int i; - - /* Find the first free header */ for (i=0; i < MAX_CUSTOM_HTTP_HEADER; i++) { if (!ho->custom_headers[i].name) { @@ -5006,7 +5015,6 @@ add_option (struct options *options, custom_header->name = p[2]; custom_header->content = p[3]; } - } else { diff --git a/openvpn/src/openvpn/proxy.c b/openvpn/src/openvpn/proxy.c index 80f5b87a..db26994c 100644 --- a/openvpn/src/openvpn/proxy.c +++ b/openvpn/src/openvpn/proxy.c @@ -501,7 +501,7 @@ add_proxy_header (struct http_proxy_info *p, /* Check if any of the custom headers already provides Host: */ i=0; - while (p->options.custom_headers[i].name) + for (i=0; i < MAX_CUSTOM_HTTP_HEADER && p->options.custom_headers[i].name;i++) { if( ((!strcasecmp(p->options.custom_headers[i].name, "Host")) && @@ -532,12 +532,11 @@ add_proxy_header (struct http_proxy_info *p, return false; } - /* + /* * Send custom headers if provided * If content is NULL whole header is in name */ - i=0; - while (p->options.custom_headers[i].name) + for (i=0; i < MAX_CUSTOM_HTTP_HEADER && p->options.custom_headers[i].name;i++) { if (p->options.custom_headers[i].content) openvpn_snprintf (buf, sizeof(buf), "%s: %s", diff --git a/src/de/blinkt/openvpn/fragments/Settings_Basic.java b/src/de/blinkt/openvpn/fragments/Settings_Basic.java index a93cc833..88941bea 100644 --- a/src/de/blinkt/openvpn/fragments/Settings_Basic.java +++ b/src/de/blinkt/openvpn/fragments/Settings_Basic.java @@ -95,7 +95,7 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On certstr+=X509Utils.getCertificateFriendlyName(cert); } catch (Exception e) { - certstr="Could not get certificate from Keystore"; + certstr="Could not get certificate from Keystore: " +e.getLocalizedMessage(); } final String certStringCopy=certstr; -- cgit v1.2.3