From: Samuli S. <sa...@op...> - 2012-04-27 11:13:51
|
> Hello Samuli, > > Curios: Did you manage to get it work using master without my patch? Nope, although I only tested it briefly. I'll try that again just in case. > If not, to make it easy... > > Use Windows Explorer and rename the key file to something non-ascii. > Then open openvpn configuration using UTF-8 editor and modify key file there. > This should work, as we do not use unicode/conversion command-line. > > Next step would be to remove the key from configuration and use it in > command-line. > > Alon. Thanks, I'll try that. Samuli > > 2012/4/27 Samuli Seppänen <sa...@op...>: >> Hi, >> >> As promised in yesterday's IRC meeting (summary coming today), I tested >> this patch on Windows 7 (64-bit). So far I've had no luck, but don't >> think the problems have anything to do with this patch. >> >> Anyways, I cross-compiled latest "master" with this patch applied and >> "bin" and "lib" directories on top of an existing openvpn-2.3-alpha1 >> install. The old "bin" directory was renamed to make sure none of it was >> used. I then renamed "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to >> "ääliö.key" using Windows Explorer. Then I updated the configuration >> file to point to these files using Notepad (and later Wordpad). >> >> OpenVPN-GUI (Heiko's new version) detected the configuration file >> properly, showing "ääliö" as one available connection option. However, >> it output the following when trying to connect: >> >> Options error: --tls-auth fails with 'ääliö.key': No such file or >> directory >> >> Git Bash showed the file as ??li?.key, which could mean Windows Explorer >> is using a single-byte character set. >> >> Windows command prompt shows the characters properly, but issuing >> "openvpn --config ääliö.ovpn" gives the same error as OpenVPN-GUI above, >> except that 'ääliö.key' shows faulty glyphs[1]. This also triggers an >> interesting bug in the command prompt[2] >> >> Anyways, as the Windows 7 install is English-language, I suspect it's >> using a single-byte character set instead of UCS-2. I'll continue >> debugging, but any pointers are obviously much appreciated! >> >> Samuli >> >> [1] <http://users.utu.fi/sjsepp/cmd.png> >> [2] Typing an "ä" or "ö" moves the (invisible) cursor forward one >> character, but each backspace will delete two characters instead of one. >> This does not happen until openvpn has been (unsuccessfully) started. >> >> >>> Discussed at [1]. >>> >>> Use wmain under windows, drop the custom parsing and shell32 linkage. >>> >>> There is no need for gc magic as this allocation is static. >>> >>> [1] http://permalink.gmane.org/gmane.network.openvpn.devel/5433 >>> >>> Signed-off-by: Alon Bar-Lev <alo...@gm...> >>> --- >>> src/openvpn/Makefile.am | 6 +++++- >>> src/openvpn/openvpn.c | 37 ++++++++++++++++++++++++++++++++++++- >>> src/openvpn/openvpn.vcxproj | 10 ++++++---- >>> src/openvpn/options.c | 27 --------------------------- >>> 4 files changed, 47 insertions(+), 33 deletions(-) >>> mode change 100644 => 100755 src/openvpn/openvpn.vcxproj >>> >>> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am >>> index 4e485e7..0506b11 100644 >>> --- a/src/openvpn/Makefile.am >>> +++ b/src/openvpn/Makefile.am >>> @@ -27,6 +27,10 @@ AM_CFLAGS = \ >>> $(OPTIONAL_CRYPTO_CFLAGS) \ >>> $(OPTIONAL_LZO_CFLAGS) \ >>> $(OPTIONAL_PKCS11_HELPER_CFLAGS) >>> +if WIN32 >>> +# we want unicode entry point but not the macro >>> +AM_CFLAGS += -municode -UUNICODE >>> +endif >>> >>> sbin_PROGRAMS = openvpn >>> >>> @@ -118,5 +122,5 @@ openvpn_LDADD = \ >>> $(OPTIONAL_DL_LIBS) >>> if WIN32 >>> openvpn_SOURCES += openvpn_win32_resources.rc >>> -openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32 >>> +openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm >>> endif >>> diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c >>> index 3db1b86..6e70a58 100644 >>> --- a/src/openvpn/openvpn.c >>> +++ b/src/openvpn/openvpn.c >>> @@ -127,8 +127,9 @@ tunnel_point_to_point (struct context *c) >>> * @param argc - Commandline argument count. >>> * @param argv - Commandline argument values. >>> */ >>> +static >>> int >>> -main (int argc, char *argv[]) >>> +openvpn_main (int argc, char *argv[]) >>> { >>> struct context c; >>> >>> @@ -289,3 +290,37 @@ main (int argc, char *argv[]) >>> openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */ >>> return 0; /* NOTREACHED */ >>> } >>> + >>> +#ifdef WIN32 >>> +int >>> +wmain (int argc, wchar_t *wargv[]) { >>> + char **argv; >>> + int ret; >>> + int i; >>> + >>> + if ((argv = calloc(argc+1, sizeof(char*))) == NULL) >>> + return 1; >>> + >>> + for (i = 0; i < argc; i++) >>> + { >>> + int n = WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, NULL, 0, NULL, NULL); >>> + argv[i] = malloc (n); >>> + WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, argv[i], n, NULL, NULL); >>> + } >>> + >>> + ret = openvpn_main(argc, argv); >>> + >>> + for (i=0; i < argc; i++ ) >>> + { >>> + free (argv[i]); >>> + } >>> + free(argv); >>> + >>> + return ret; >>> +} >>> +#else >>> +int >>> +main (int argc, char *argv[]) { >>> + return openvpn_main(argc, argv); >>> +} >>> +#endif >>> diff --git a/src/openvpn/openvpn.vcxproj b/src/openvpn/openvpn.vcxproj >>> old mode 100644 >>> new mode 100755 >>> index 51e19af..452876f >>> --- a/src/openvpn/openvpn.vcxproj >>> +++ b/src/openvpn/openvpn.vcxproj >>> @@ -18,12 +18,12 @@ >>> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> >>> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> >>> <ConfigurationType>Application</ConfigurationType> >>> - <CharacterSet>MultiByte</CharacterSet> >>> <WholeProgramOptimization>true</WholeProgramOptimization> >>> + <CharacterSet>Unicode</CharacterSet> >>> </PropertyGroup> >>> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> >>> <ConfigurationType>Application</ConfigurationType> >>> - <CharacterSet>MultiByte</CharacterSet> >>> + <CharacterSet>Unicode</CharacterSet> >>> </PropertyGroup> >>> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> >>> <ImportGroup Label="ExtensionSettings"> >>> @@ -56,12 +56,13 @@ >>> </PrecompiledHeader> >>> <WarningLevel>Level3</WarningLevel> >>> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> >>> + <UndefinePreprocessorDefinitions>UNICODE</UndefinePreprocessorDefinitions> >>> </ClCompile> >>> <ResourceCompile> >>> <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> >>> </ResourceCompile> >>> <Link> >>> - <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies> >>> + <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> >>> <AdditionalLibraryDirectories>$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> >>> <GenerateDebugInformation>true</GenerateDebugInformation> >>> <SubSystem>Console</SubSystem> >>> @@ -80,12 +81,13 @@ >>> </PrecompiledHeader> >>> <WarningLevel>Level3</WarningLevel> >>> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> >>> + <UndefinePreprocessorDefinitions>UNICODE</UndefinePreprocessorDefinitions> >>> </ClCompile> >>> <ResourceCompile> >>> <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> >>> </ResourceCompile> >>> <Link> >>> - <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies> >>> + <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> >>> <AdditionalLibraryDirectories>$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> >>> <GenerateDebugInformation>true</GenerateDebugInformation> >>> <SubSystem>Console</SubSystem> >>> diff --git a/src/openvpn/options.c b/src/openvpn/options.c >>> index 25786f6..66241b4 100644 >>> --- a/src/openvpn/options.c >>> +++ b/src/openvpn/options.c >>> @@ -3832,33 +3832,6 @@ parse_argv (struct options *options, >>> { >>> int i, j; >>> >>> -#ifdef WIN32 >>> - /* >>> - * Windows replaces Unicode characters in argv[] that are not present >>> - * in the current codepage with '?'. Get the wide char command line and >>> - * convert it to UTF-8 ourselves. >>> - */ >>> - int wargc; >>> - WCHAR **wargv; >>> - char **uargv; >>> - >>> - wargv = CommandLineToArgvW (GetCommandLineW (), &wargc); >>> - if (wargv == NULL || wargc != argc) >>> - usage (); >>> - >>> - uargv = gc_malloc (wargc * sizeof (*uargv), false, &options->gc); >>> - >>> - for (i = 0; i < wargc; i++) >>> - { >>> - int n = WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, NULL, 0, NULL, NULL); >>> - uargv[i] = gc_malloc (n, false, &options->gc); >>> - WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, uargv[i], n, NULL, NULL); >>> - } >>> - >>> - LocalFree (wargv); >>> - argv = uargv; >>> -#endif >>> - >>> /* usage message */ >>> if (argc <= 1) >>> usage (); |
From: Alon Bar-L. <alo...@gm...> - 2012-04-27 11:25:08
|
Hello, Here is a simple program that will make it easier for you.... The file in ca and pkcs12 parameters is found when using Hebrew. Alon. --- #include <Windows.h> int main(void) { WCHAR cmdline[] = L"s:\\Temp\\openvpn\\build-win32\\src\\openvpn\\.libs\\openvpn.exe --dev tap --tls-client --ca c:\\temp\\עברית\\ניסוי.txt --pkcs12 c:\\temp\\עברית\\ניסוי.txt"; STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi)); CreateProcessW( NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi ); return 0; } --- 2012/4/27 Samuli Seppänen <sa...@op...>: > >> Hello Samuli, >> >> Curios: Did you manage to get it work using master without my patch? > > Nope, although I only tested it briefly. I'll try that again just in case. > >> If not, to make it easy... >> >> Use Windows Explorer and rename the key file to something non-ascii. >> Then open openvpn configuration using UTF-8 editor and modify key file there. >> This should work, as we do not use unicode/conversion command-line. >> >> Next step would be to remove the key from configuration and use it in >> command-line. >> >> Alon. > > Thanks, I'll try that. > > Samuli > >> >> 2012/4/27 Samuli Seppänen <sa...@op...>: >>> Hi, >>> >>> As promised in yesterday's IRC meeting (summary coming today), I tested >>> this patch on Windows 7 (64-bit). So far I've had no luck, but don't >>> think the problems have anything to do with this patch. >>> >>> Anyways, I cross-compiled latest "master" with this patch applied and >>> "bin" and "lib" directories on top of an existing openvpn-2.3-alpha1 >>> install. The old "bin" directory was renamed to make sure none of it was >>> used. I then renamed "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to >>> "ääliö.key" using Windows Explorer. Then I updated the configuration >>> file to point to these files using Notepad (and later Wordpad). >>> >>> OpenVPN-GUI (Heiko's new version) detected the configuration file >>> properly, showing "ääliö" as one available connection option. However, >>> it output the following when trying to connect: >>> >>> Options error: --tls-auth fails with 'ääliö.key': No such file or >>> directory >>> >>> Git Bash showed the file as ??li?.key, which could mean Windows Explorer >>> is using a single-byte character set. >>> >>> Windows command prompt shows the characters properly, but issuing >>> "openvpn --config ääliö.ovpn" gives the same error as OpenVPN-GUI above, >>> except that 'ääliö.key' shows faulty glyphs[1]. This also triggers an >>> interesting bug in the command prompt[2] >>> >>> Anyways, as the Windows 7 install is English-language, I suspect it's >>> using a single-byte character set instead of UCS-2. I'll continue >>> debugging, but any pointers are obviously much appreciated! >>> >>> Samuli >>> >>> [1] <http://users.utu.fi/sjsepp/cmd.png> >>> [2] Typing an "ä" or "ö" moves the (invisible) cursor forward one >>> character, but each backspace will delete two characters instead of one. >>> This does not happen until openvpn has been (unsuccessfully) started. >>> >>> >>>> Discussed at [1]. >>>> >>>> Use wmain under windows, drop the custom parsing and shell32 linkage. >>>> >>>> There is no need for gc magic as this allocation is static. >>>> >>>> [1] http://permalink.gmane.org/gmane.network.openvpn.devel/5433 >>>> >>>> Signed-off-by: Alon Bar-Lev <alo...@gm...> >>>> --- >>>> src/openvpn/Makefile.am | 6 +++++- >>>> src/openvpn/openvpn.c | 37 ++++++++++++++++++++++++++++++++++++- >>>> src/openvpn/openvpn.vcxproj | 10 ++++++---- >>>> src/openvpn/options.c | 27 --------------------------- >>>> 4 files changed, 47 insertions(+), 33 deletions(-) >>>> mode change 100644 => 100755 src/openvpn/openvpn.vcxproj >>>> >>>> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am >>>> index 4e485e7..0506b11 100644 >>>> --- a/src/openvpn/Makefile.am >>>> +++ b/src/openvpn/Makefile.am >>>> @@ -27,6 +27,10 @@ AM_CFLAGS = \ >>>> $(OPTIONAL_CRYPTO_CFLAGS) \ >>>> $(OPTIONAL_LZO_CFLAGS) \ >>>> $(OPTIONAL_PKCS11_HELPER_CFLAGS) >>>> +if WIN32 >>>> +# we want unicode entry point but not the macro >>>> +AM_CFLAGS += -municode -UUNICODE >>>> +endif >>>> >>>> sbin_PROGRAMS = openvpn >>>> >>>> @@ -118,5 +122,5 @@ openvpn_LDADD = \ >>>> $(OPTIONAL_DL_LIBS) >>>> if WIN32 >>>> openvpn_SOURCES += openvpn_win32_resources.rc >>>> -openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32 >>>> +openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm >>>> endif >>>> diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c >>>> index 3db1b86..6e70a58 100644 >>>> --- a/src/openvpn/openvpn.c >>>> +++ b/src/openvpn/openvpn.c >>>> @@ -127,8 +127,9 @@ tunnel_point_to_point (struct context *c) >>>> * @param argc - Commandline argument count. >>>> * @param argv - Commandline argument values. >>>> */ >>>> +static >>>> int >>>> -main (int argc, char *argv[]) >>>> +openvpn_main (int argc, char *argv[]) >>>> { >>>> struct context c; >>>> >>>> @@ -289,3 +290,37 @@ main (int argc, char *argv[]) >>>> openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */ >>>> return 0; /* NOTREACHED */ >>>> } >>>> + >>>> +#ifdef WIN32 >>>> +int >>>> +wmain (int argc, wchar_t *wargv[]) { >>>> + char **argv; >>>> + int ret; >>>> + int i; >>>> + >>>> + if ((argv = calloc(argc+1, sizeof(char*))) == NULL) >>>> + return 1; >>>> + >>>> + for (i = 0; i < argc; i++) >>>> + { >>>> + int n = WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, NULL, 0, NULL, NULL); >>>> + argv[i] = malloc (n); >>>> + WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, argv[i], n, NULL, NULL); >>>> + } >>>> + >>>> + ret = openvpn_main(argc, argv); >>>> + >>>> + for (i=0; i < argc; i++ ) >>>> + { >>>> + free (argv[i]); >>>> + } >>>> + free(argv); >>>> + >>>> + return ret; >>>> +} >>>> +#else >>>> +int >>>> +main (int argc, char *argv[]) { >>>> + return openvpn_main(argc, argv); >>>> +} >>>> +#endif >>>> diff --git a/src/openvpn/openvpn.vcxproj b/src/openvpn/openvpn.vcxproj >>>> old mode 100644 >>>> new mode 100755 >>>> index 51e19af..452876f >>>> --- a/src/openvpn/openvpn.vcxproj >>>> +++ b/src/openvpn/openvpn.vcxproj >>>> @@ -18,12 +18,12 @@ >>>> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> >>>> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> >>>> <ConfigurationType>Application</ConfigurationType> >>>> - <CharacterSet>MultiByte</CharacterSet> >>>> <WholeProgramOptimization>true</WholeProgramOptimization> >>>> + <CharacterSet>Unicode</CharacterSet> >>>> </PropertyGroup> >>>> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> >>>> <ConfigurationType>Application</ConfigurationType> >>>> - <CharacterSet>MultiByte</CharacterSet> >>>> + <CharacterSet>Unicode</CharacterSet> >>>> </PropertyGroup> >>>> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> >>>> <ImportGroup Label="ExtensionSettings"> >>>> @@ -56,12 +56,13 @@ >>>> </PrecompiledHeader> >>>> <WarningLevel>Level3</WarningLevel> >>>> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> >>>> + <UndefinePreprocessorDefinitions>UNICODE</UndefinePreprocessorDefinitions> >>>> </ClCompile> >>>> <ResourceCompile> >>>> <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> >>>> </ResourceCompile> >>>> <Link> >>>> - <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies> >>>> + <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> >>>> <AdditionalLibraryDirectories>$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> >>>> <GenerateDebugInformation>true</GenerateDebugInformation> >>>> <SubSystem>Console</SubSystem> >>>> @@ -80,12 +81,13 @@ >>>> </PrecompiledHeader> >>>> <WarningLevel>Level3</WarningLevel> >>>> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> >>>> + <UndefinePreprocessorDefinitions>UNICODE</UndefinePreprocessorDefinitions> >>>> </ClCompile> >>>> <ResourceCompile> >>>> <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> >>>> </ResourceCompile> >>>> <Link> >>>> - <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies> >>>> + <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> >>>> <AdditionalLibraryDirectories>$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> >>>> <GenerateDebugInformation>true</GenerateDebugInformation> >>>> <SubSystem>Console</SubSystem> >>>> diff --git a/src/openvpn/options.c b/src/openvpn/options.c >>>> index 25786f6..66241b4 100644 >>>> --- a/src/openvpn/options.c >>>> +++ b/src/openvpn/options.c >>>> @@ -3832,33 +3832,6 @@ parse_argv (struct options *options, >>>> { >>>> int i, j; >>>> >>>> -#ifdef WIN32 >>>> - /* >>>> - * Windows replaces Unicode characters in argv[] that are not present >>>> - * in the current codepage with '?'. Get the wide char command line and >>>> - * convert it to UTF-8 ourselves. >>>> - */ >>>> - int wargc; >>>> - WCHAR **wargv; >>>> - char **uargv; >>>> - >>>> - wargv = CommandLineToArgvW (GetCommandLineW (), &wargc); >>>> - if (wargv == NULL || wargc != argc) >>>> - usage (); >>>> - >>>> - uargv = gc_malloc (wargc * sizeof (*uargv), false, &options->gc); >>>> - >>>> - for (i = 0; i < wargc; i++) >>>> - { >>>> - int n = WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, NULL, 0, NULL, NULL); >>>> - uargv[i] = gc_malloc (n, false, &options->gc); >>>> - WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, uargv[i], n, NULL, NULL); >>>> - } >>>> - >>>> - LocalFree (wargv); >>>> - argv = uargv; >>>> -#endif >>>> - >>>> /* usage message */ >>>> if (argc <= 1) >>>> usage (); > > |
From: Samuli S. <sa...@op...> - 2012-04-27 11:55:32
|
Il 27.04.2012 12:18, Heiko Hund ha scritto: > On Friday 27 April 2012 09:54:15 Samuli Seppänen wrote: >> Anyways, I cross-compiled latest "master" with this patch applied and >> "bin" and "lib" directories on top of an existing openvpn-2.3-alpha1 >> install. The old "bin" directory was renamed to make sure none of it was >> used. I then renamed "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to >> "ääliö.key" using Windows Explorer. Then I updated the configuration >> file to point to these files using Notepad (and later Wordpad). > Notepad saves UTF-8 files with BOM, which is very uncommon. Maybe that was the > problem. I ran into that when I was testing my patch. You might want to try > using Notepad++ and save it as UTF-8 without BOM. > > HTH > Heiko Saved the configuration file to UTF-8 without BOM - after this I got no complaints from OpenVPN-GUI. Launching OpenVPN from the command prompt also worked... tls-auth was undefined in the config, and openvpn called like this: > openvpn --config ääliö.ovpn --tls-auth ääliö.key 1 Only minor issue was that the command prompt displayed funky characters instead of the proper ones: <http://users.utu.fi/sjsepp/cmd2.png> Thanks for the tip, Heiko! -- Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock |
From: Samuli S. <sa...@op...> - 2012-04-27 12:00:07
|
> Il 27.04.2012 12:18, Heiko Hund ha scritto: >> On Friday 27 April 2012 09:54:15 Samuli Seppänen wrote: >>> Anyways, I cross-compiled latest "master" with this patch applied and >>> "bin" and "lib" directories on top of an existing openvpn-2.3-alpha1 >>> install. The old "bin" directory was renamed to make sure none of it was >>> used. I then renamed "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to >>> "ääliö.key" using Windows Explorer. Then I updated the configuration >>> file to point to these files using Notepad (and later Wordpad). >> Notepad saves UTF-8 files with BOM, which is very uncommon. Maybe that was the >> problem. I ran into that when I was testing my patch. You might want to try >> using Notepad++ and save it as UTF-8 without BOM. >> >> HTH >> Heiko > Saved the configuration file to UTF-8 without BOM - after this I got no > complaints from OpenVPN-GUI. Launching OpenVPN from the command prompt > also worked... tls-auth was undefined in the config, and openvpn called > like this: > >> openvpn --config ääliö.ovpn --tls-auth ääliö.key 1 > Only minor issue was that the command prompt displayed funky characters > instead of the proper ones: > > <http://users.utu.fi/sjsepp/cmd2.png> > > Thanks for the tip, Heiko! > OpenVPN 2.3-alpha1 also behaves in the exactly same way. Is that to be expected? -- Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock |
From: Alon Bar-L. <alo...@gm...> - 2012-04-27 12:16:05
|
2012/4/27 Samuli Seppänen <sa...@op...>: > Il 27.04.2012 12:18, Heiko Hund ha scritto: >> On Friday 27 April 2012 09:54:15 Samuli Seppänen wrote: >>> Anyways, I cross-compiled latest "master" with this patch applied and >>> "bin" and "lib" directories on top of an existing openvpn-2.3-alpha1 >>> install. The old "bin" directory was renamed to make sure none of it was >>> used. I then renamed "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to >>> "ääliö.key" using Windows Explorer. Then I updated the configuration >>> file to point to these files using Notepad (and later Wordpad). >> Notepad saves UTF-8 files with BOM, which is very uncommon. Maybe that was the >> problem. I ran into that when I was testing my patch. You might want to try >> using Notepad++ and save it as UTF-8 without BOM. >> >> HTH >> Heiko > Saved the configuration file to UTF-8 without BOM - after this I got no > complaints from OpenVPN-GUI. Launching OpenVPN from the command prompt > also worked... tls-auth was undefined in the config, and openvpn called > like this: if bom is a problem we should handle it properly in options.c, as we cannot expect users to understand bom issues. > >> openvpn --config ääliö.ovpn --tls-auth ääliö.key 1 > > Only minor issue was that the command prompt displayed funky characters > instead of the proper ones: > > <http://users.utu.fi/sjsepp/cmd2.png> Yes. this is OK. Alon. |
From: Alon Bar-L. <alo...@gm...> - 2012-05-02 09:18:40
|
News? On Fri, Apr 27, 2012 at 3:15 PM, Alon Bar-Lev <alo...@gm...> wrote: > 2012/4/27 Samuli Seppänen <sa...@op...>: >> Il 27.04.2012 12:18, Heiko Hund ha scritto: >>> On Friday 27 April 2012 09:54:15 Samuli Seppänen wrote: >>>> Anyways, I cross-compiled latest "master" with this patch applied and >>>> "bin" and "lib" directories on top of an existing openvpn-2.3-alpha1 >>>> install. The old "bin" directory was renamed to make sure none of it was >>>> used. I then renamed "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to >>>> "ääliö.key" using Windows Explorer. Then I updated the configuration >>>> file to point to these files using Notepad (and later Wordpad). >>> Notepad saves UTF-8 files with BOM, which is very uncommon. Maybe that was the >>> problem. I ran into that when I was testing my patch. You might want to try >>> using Notepad++ and save it as UTF-8 without BOM. >>> >>> HTH >>> Heiko >> Saved the configuration file to UTF-8 without BOM - after this I got no >> complaints from OpenVPN-GUI. Launching OpenVPN from the command prompt >> also worked... tls-auth was undefined in the config, and openvpn called >> like this: > > if bom is a problem we should handle it properly in options.c, as we > cannot expect users to understand bom issues. > >> >>> openvpn --config ääliö.ovpn --tls-auth ääliö.key 1 >> >> Only minor issue was that the command prompt displayed funky characters >> instead of the proper ones: >> >> <http://users.utu.fi/sjsepp/cmd2.png> > > Yes. this is OK. > > Alon. |
From: David S. <ope...@to...> - 2012-05-03 07:26:56
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 27/04/12 14:15, Alon Bar-Lev wrote: > 2012/4/27 Samuli Seppänen <sa...@op...>: >> Il 27.04.2012 12:18, Heiko Hund ha scritto: >>> On Friday 27 April 2012 09:54:15 Samuli Seppänen wrote: >>>> Anyways, I cross-compiled latest "master" with this patch >>>> applied and "bin" and "lib" directories on top of an existing >>>> openvpn-2.3-alpha1 install. The old "bin" directory was >>>> renamed to make sure none of it was used. I then renamed >>>> "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to "ääliö.key" >>>> using Windows Explorer. Then I updated the configuration file >>>> to point to these files using Notepad (and later Wordpad). >>> Notepad saves UTF-8 files with BOM, which is very uncommon. >>> Maybe that was the problem. I ran into that when I was testing >>> my patch. You might want to try using Notepad++ and save it as >>> UTF-8 without BOM. >>> >>> HTH Heiko >> Saved the configuration file to UTF-8 without BOM - after this I >> got no complaints from OpenVPN-GUI. Launching OpenVPN from the >> command prompt also worked... tls-auth was undefined in the >> config, and openvpn called like this: > > if bom is a problem we should handle it properly in options.c, as > we cannot expect users to understand bom issues. > >> >>> openvpn --config ääliö.ovpn --tls-auth ääliö.key 1 >> >> Only minor issue was that the command prompt displayed funky >> characters instead of the proper ones: >> >> <http://users.utu.fi/sjsepp/cmd2.png> > > Yes. this is OK. Just so that I understand this more properly. The reason this is okay, is that because cmd.exe is not UTF-8 capable when displaying the log data? kind regards, David Sommerseth -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEUEARECAAYFAk+iMy8ACgkQDC186MBRfrp8LACeNRzTrcdd8JWyzTEJ3B5Kv1ye iFsAmNM0T3LgxrlJeg3I+7F1aoMSqpw= =PhBy -----END PGP SIGNATURE----- |
From: Alon Bar-L. <alo...@gm...> - 2012-05-03 07:41:53
|
On Thu, May 3, 2012 at 10:26 AM, David Sommerseth <ope...@to...> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 27/04/12 14:15, Alon Bar-Lev wrote: > > 2012/4/27 Samuli Seppänen <sa...@op...>: > >> Il 27.04.2012 12:18, Heiko Hund ha scritto: > >>> On Friday 27 April 2012 09:54:15 Samuli Seppänen wrote: > >>>> Anyways, I cross-compiled latest "master" with this patch > >>>> applied and "bin" and "lib" directories on top of an existing > >>>> openvpn-2.3-alpha1 install. The old "bin" directory was > >>>> renamed to make sure none of it was used. I then renamed > >>>> "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to "ääliö.key" > >>>> using Windows Explorer. Then I updated the configuration file > >>>> to point to these files using Notepad (and later Wordpad). > >>> Notepad saves UTF-8 files with BOM, which is very uncommon. > >>> Maybe that was the problem. I ran into that when I was testing > >>> my patch. You might want to try using Notepad++ and save it as > >>> UTF-8 without BOM. > >>> > >>> HTH Heiko > >> Saved the configuration file to UTF-8 without BOM - after this I > >> got no complaints from OpenVPN-GUI. Launching OpenVPN from the > >> command prompt also worked... tls-auth was undefined in the > >> config, and openvpn called like this: > > > > if bom is a problem we should handle it properly in options.c, as > > we cannot expect users to understand bom issues. > > > >> > >>> openvpn --config ääliö.ovpn --tls-auth ääliö.key 1 > >> > >> Only minor issue was that the command prompt displayed funky > >> characters instead of the proper ones: > >> > >> <http://users.utu.fi/sjsepp/cmd2.png> > > > > Yes. this is OK. > > Just so that I understand this more properly. The reason this is > okay, is that because cmd.exe is not UTF-8 capable when displaying the > log data? Yes. The cmd uses the plain old DOS code page, and needs special fonts. If you add --log parameter you will see this correctly. Alon. |
From: Samuli S. <sa...@op...> - 2012-05-03 10:53:55
|
> On Thu, May 3, 2012 at 10:26 AM, David Sommerseth > <ope...@to...> wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> On 27/04/12 14:15, Alon Bar-Lev wrote: >>> 2012/4/27 Samuli Seppänen <sa...@op...>: >>>> Il 27.04.2012 12:18, Heiko Hund ha scritto: >>>>> On Friday 27 April 2012 09:54:15 Samuli Seppänen wrote: >>>>>> Anyways, I cross-compiled latest "master" with this patch >>>>>> applied and "bin" and "lib" directories on top of an existing >>>>>> openvpn-2.3-alpha1 install. The old "bin" directory was >>>>>> renamed to make sure none of it was used. I then renamed >>>>>> "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to "ääliö.key" >>>>>> using Windows Explorer. Then I updated the configuration file >>>>>> to point to these files using Notepad (and later Wordpad). >>>>> Notepad saves UTF-8 files with BOM, which is very uncommon. >>>>> Maybe that was the problem. I ran into that when I was testing >>>>> my patch. You might want to try using Notepad++ and save it as >>>>> UTF-8 without BOM. >>>>> >>>>> HTH Heiko >>>> Saved the configuration file to UTF-8 without BOM - after this I >>>> got no complaints from OpenVPN-GUI. Launching OpenVPN from the >>>> command prompt also worked... tls-auth was undefined in the >>>> config, and openvpn called like this: >>> if bom is a problem we should handle it properly in options.c, as >>> we cannot expect users to understand bom issues. >>> >>>>> openvpn --config ääliö.ovpn --tls-auth ääliö.key 1 >>>> Only minor issue was that the command prompt displayed funky >>>> characters instead of the proper ones: >>>> >>>> <http://users.utu.fi/sjsepp/cmd2.png> >>> Yes. this is OK. >> Just so that I understand this more properly. The reason this is >> okay, is that because cmd.exe is not UTF-8 capable when displaying the >> log data? > Yes. > The cmd uses the plain old DOS code page, and needs special fonts. > If you add --log parameter you will see this correctly. > > Alon. > Tested with --log parameter. The logfile[1] seems to use the UTF-8 encoding, and with proper viewers/editors the Scandinavian characters (a/o umlauts, ä/ö) look just fine. On Windows most editors/viewers[3] display funky two-byte characters, but that's probably expected. [1] An example log file is available here, search for "tls_auth_file": <http://users.utu.fi/sjsepp/openvpn-log.txt> [2] E.g. less and vi (in Git Bash), Wordpad, etc. -- Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock |
From: Alon Bar-L. <alo...@gm...> - 2012-05-03 18:17:57
|
On Thu, May 3, 2012 at 1:53 PM, Samuli Seppänen <sa...@op...> wrote: > >> On Thu, May 3, 2012 at 10:26 AM, David Sommerseth >> <ope...@to...> wrote: >>> -----BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA1 >>> >>> On 27/04/12 14:15, Alon Bar-Lev wrote: >>>> 2012/4/27 Samuli Seppänen <sa...@op...>: >>>>> Il 27.04.2012 12:18, Heiko Hund ha scritto: >>>>>> On Friday 27 April 2012 09:54:15 Samuli Seppänen wrote: >>>>>>> Anyways, I cross-compiled latest "master" with this patch >>>>>>> applied and "bin" and "lib" directories on top of an existing >>>>>>> openvpn-2.3-alpha1 install. The old "bin" directory was >>>>>>> renamed to make sure none of it was used. I then renamed >>>>>>> "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to "ääliö.key" >>>>>>> using Windows Explorer. Then I updated the configuration file >>>>>>> to point to these files using Notepad (and later Wordpad). >>>>>> Notepad saves UTF-8 files with BOM, which is very uncommon. >>>>>> Maybe that was the problem. I ran into that when I was testing >>>>>> my patch. You might want to try using Notepad++ and save it as >>>>>> UTF-8 without BOM. >>>>>> >>>>>> HTH Heiko >>>>> Saved the configuration file to UTF-8 without BOM - after this I >>>>> got no complaints from OpenVPN-GUI. Launching OpenVPN from the >>>>> command prompt also worked... tls-auth was undefined in the >>>>> config, and openvpn called like this: >>>> if bom is a problem we should handle it properly in options.c, as >>>> we cannot expect users to understand bom issues. >>>> >>>>>> openvpn --config ääliö.ovpn --tls-auth ääliö.key 1 >>>>> Only minor issue was that the command prompt displayed funky >>>>> characters instead of the proper ones: >>>>> >>>>> <http://users.utu.fi/sjsepp/cmd2.png> >>>> Yes. this is OK. >>> Just so that I understand this more properly. The reason this is >>> okay, is that because cmd.exe is not UTF-8 capable when displaying the >>> log data? >> Yes. >> The cmd uses the plain old DOS code page, and needs special fonts. >> If you add --log parameter you will see this correctly. >> >> Alon. >> > Tested with --log parameter. The logfile[1] seems to use the UTF-8 > encoding, and with proper viewers/editors the Scandinavian characters > (a/o umlauts, ä/ö) look just fine. On Windows most editors/viewers[3] > display funky two-byte characters, but that's probably expected. > > [1] An example log file is available here, search for "tls_auth_file": > <http://users.utu.fi/sjsepp/openvpn-log.txt> > [2] E.g. less and vi (in Git Bash), Wordpad, etc. > So I guess now we are good. Is anything else missing? Alon. |
From: Alon Bar-L. <alo...@gm...> - 2012-06-26 10:20:36
|
Please apply. https://github.com/alonbl/openvpn/compare/master...unicode On Thu, May 3, 2012 at 8:47 PM, Alon Bar-Lev <alo...@gm...> wrote: > On Thu, May 3, 2012 at 1:53 PM, Samuli Seppänen <sa...@op...> wrote: >> >>> On Thu, May 3, 2012 at 10:26 AM, David Sommerseth >>> <ope...@to...> wrote: >>>> -----BEGIN PGP SIGNED MESSAGE----- >>>> Hash: SHA1 >>>> >>>> On 27/04/12 14:15, Alon Bar-Lev wrote: >>>>> 2012/4/27 Samuli Seppänen <sa...@op...>: >>>>>> Il 27.04.2012 12:18, Heiko Hund ha scritto: >>>>>>> On Friday 27 April 2012 09:54:15 Samuli Seppänen wrote: >>>>>>>> Anyways, I cross-compiled latest "master" with this patch >>>>>>>> applied and "bin" and "lib" directories on top of an existing >>>>>>>> openvpn-2.3-alpha1 install. The old "bin" directory was >>>>>>>> renamed to make sure none of it was used. I then renamed >>>>>>>> "openvpn.ovpn" to "ääliö.ovpn" and "ta.key" to "ääliö.key" >>>>>>>> using Windows Explorer. Then I updated the configuration file >>>>>>>> to point to these files using Notepad (and later Wordpad). >>>>>>> Notepad saves UTF-8 files with BOM, which is very uncommon. >>>>>>> Maybe that was the problem. I ran into that when I was testing >>>>>>> my patch. You might want to try using Notepad++ and save it as >>>>>>> UTF-8 without BOM. >>>>>>> >>>>>>> HTH Heiko >>>>>> Saved the configuration file to UTF-8 without BOM - after this I >>>>>> got no complaints from OpenVPN-GUI. Launching OpenVPN from the >>>>>> command prompt also worked... tls-auth was undefined in the >>>>>> config, and openvpn called like this: >>>>> if bom is a problem we should handle it properly in options.c, as >>>>> we cannot expect users to understand bom issues. >>>>> >>>>>>> openvpn --config ääliö.ovpn --tls-auth ääliö.key 1 >>>>>> Only minor issue was that the command prompt displayed funky >>>>>> characters instead of the proper ones: >>>>>> >>>>>> <http://users.utu.fi/sjsepp/cmd2.png> >>>>> Yes. this is OK. >>>> Just so that I understand this more properly. The reason this is >>>> okay, is that because cmd.exe is not UTF-8 capable when displaying the >>>> log data? >>> Yes. >>> The cmd uses the plain old DOS code page, and needs special fonts. >>> If you add --log parameter you will see this correctly. >>> >>> Alon. >>> >> Tested with --log parameter. The logfile[1] seems to use the UTF-8 >> encoding, and with proper viewers/editors the Scandinavian characters >> (a/o umlauts, ä/ö) look just fine. On Windows most editors/viewers[3] >> display funky two-byte characters, but that's probably expected. >> >> [1] An example log file is available here, search for "tls_auth_file": >> <http://users.utu.fi/sjsepp/openvpn-log.txt> >> [2] E.g. less and vi (in Git Bash), Wordpad, etc. >> > > So I guess now we are good. > Is anything else missing? > > Alon. |
From: David S. <ope...@to...> - 2012-02-17 10:14:33
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 16/02/12 18:30, Heiko Hund wrote: > Hi, > > this patch series fixes several issues when building for Windows with > the MSVC buildsystem discovered today: > > [PATCH 1/4] replace check for TARGET_WIN32 with WIN32 [PATCH 2/4] do > not use mode_t on Windows [PATCH 3/4] use the underscore version of > stat on Windows [PATCH 4/4] make MSVC link against shell32 as well > > For details check the commit messages of the individual patches. All patches applied to master on -testing and -stable trees. For patch 3/4, a v2 patch was applied. commit 76a3c405549bf02902846a9bd0e7d0f3a25a5b4d Author: Heiko Hund <hei...@so...> Date: Thu Feb 16 18:30:38 2012 +0100 replace check for TARGET_WIN32 with WIN32 Use of TARGET_WIN32 breaks MSVC builds as it is only defined for mingw builds done with the autotools buildsystem. Signed-off-by: Heiko Hund <hei...@so...> Acked-by: Gert Doering <ge...@gr...> Signed-off-by: David Sommerseth <da...@re...> commit d0109cbf459409a84963668c78f444c97ec2b349 Author: Heiko Hund <hei...@so...> Date: Thu Feb 16 18:30:39 2012 +0100 do not use mode_t on Windows The MSVC headers do not define mode_t. open() uses an int for the permissions instead. Fixes building with the MSVC based buildsystem. Signed-off-by: Heiko Hund <hei...@so...> Acked-by: Gert Doering <ge...@gr...> Signed-off-by: David Sommerseth <da...@re...> commit a13cd253ca1ce987e4feca7d80bd19ff749f7787 Author: Heiko Hund <hei...@so...> Date: Thu Feb 16 18:30:40 2012 +0100 use the underscore version of stat on Windows MSVC does not know wstat(). Instead _wstat() must be used here. Unfortunately _wstat() takes a 'struct _stat'. A type 'stat_t' is introduced to handle this situation in a portable way. [v2: Use openvpn_stat_t instead of stat_t (David Sommerseth)] Signed-off-by: Heiko Hund <hei...@so...> Signed-off-by: David Sommerseth <da...@re...> Acked-by: Gert Doering <ge...@gr...> commit 67fe36f888d72d2c9c2b8dac849159a229400367 Author: Heiko Hund <hei...@so...> Date: Thu Feb 16 18:30:41 2012 +0100 make MSVC link against shell32 as well Windows API CommandLineToArgvW(), introduced in Windows unicode path commit 71bbbd76c62630c88441237d72fe5b61f0b45b2a, is defined therein. Signed-off-by: Heiko Hund <hei...@so...> Acked-by: Gert Doering <ge...@gr...> Signed-off-by: David Sommerseth <da...@re...> kind regards, David Sommerseth -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8+KHgACgkQDC186MBRfrrEQwCfSZXxIf3+E+iR3+0h+HI6R5KV utwAn36V2rzrGZvdeStrp6rjG/mOtZME =XnhK -----END PGP SIGNATURE----- |
From: James Y. <ja...@op...> - 2013-07-28 22:05:55
|
Fixes to allow compilation with Microsoft Visual Studio 2008 * Fixed several instances of declarations after statements. * In socket.c, fixed issue where uninitialized value (err) is being passed to to gai_strerror. * ssl.c is trying to access multi_output_peer_info_env function in multi.c, causing an undefined symbol warning at compile time. ssl.c is strictly a client of multi.c (but not the other way around), therefore ssl.c does not include multi.h and should not depend on multi.h API. To fix, moved validate_peer_info_line and multi_output_peer_info_env from multi.c to misc.c. * MSVC doesn't support %z as a printf format specifier for size_t * MSVC doesn't support a const variable being used to dimension an array. * Explicitly cast the third parameter to setsockopt to const void * --- src/openvpn/init.c | 10 ++++---- src/openvpn/misc.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ src/openvpn/misc.h | 7 ++++++ src/openvpn/multi.c | 52 ----------------------------------------- src/openvpn/multi.h | 3 --- src/openvpn/socket.c | 5 ++-- src/openvpn/socket.h | 2 +- src/openvpn/ssl.c | 2 +- src/openvpn/ssl_openssl.c | 7 +++--- src/openvpn/win32.c | 6 ++--- 10 files changed, 79 insertions(+), 71 deletions(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index fb14726..031fb20 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -183,10 +183,12 @@ ce_management_query_proxy (struct context *c) if (management) { gc = gc_new (); - struct buffer out = alloc_buf_gc (256, &gc); - buf_printf (&out, ">PROXY:%u,%s,%s", (l ? l->current : 0) + 1, - (proto_is_udp (ce->proto) ? "UDP" : "TCP"), np (ce->remote)); - management_notify_generic (management, BSTR (&out)); + { + struct buffer out = alloc_buf_gc (256, &gc); + buf_printf (&out, ">PROXY:%u,%s,%s", (l ? l->current : 0) + 1, + (proto_is_udp (ce->proto) ? "UDP" : "TCP"), np (ce->remote)); + management_notify_generic (management, BSTR (&out)); + } ce->flags |= CE_MAN_QUERY_PROXY; while (ce->flags & CE_MAN_QUERY_PROXY) { diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c index 1120adc..4688444 100644 --- a/src/openvpn/misc.c +++ b/src/openvpn/misc.c @@ -2063,3 +2063,59 @@ compat_flag (unsigned int flag) return (compat_flags & (flag >> 1)); } + +#if P2MP_SERVER + +/* helper to parse peer_info received from multi client, validate + * (this is untrusted data) and put into environment + */ +bool +validate_peer_info_line(char *line) +{ + uint8_t c; + int state = 0; + while (*line) + { + c = *line; + switch (state) + { + case 0: + case 1: + if (c == '=' && state == 1) + state = 2; + else if (isalnum(c) || c == '_') + state = 1; + else + return false; + case 2: + /* after the '=', replace non-printable or shell meta with '_' */ + if (!isprint(c) || isspace(c) || + c == '$' || c == '(' || c == '`' ) + *line = '_'; + } + line++; + } + return (state == 2); +} + +void +output_peer_info_env (struct env_set *es, const char * peer_info) +{ + char line[256]; + struct buffer buf; + buf_set_read (&buf, (const uint8_t *) peer_info, strlen(peer_info)); + while (buf_parse (&buf, '\n', line, sizeof (line))) + { + chomp (line); + if (validate_peer_info_line(line) && + (strncmp(line, "IV_", 3) == 0 || strncmp(line, "UV_", 3) == 0) ) + { + msg (M_INFO, "peer info: %s", line); + env_set_add(es, line); + } + else + msg (M_WARN, "validation failed on peer_info line received from client"); + } +} + +#endif /* P2MP_SERVER */ diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h index 183898e..41748bd 100644 --- a/src/openvpn/misc.h +++ b/src/openvpn/misc.h @@ -369,4 +369,11 @@ void argv_printf_cat (struct argv *a, const char *format, ...) #define COMPAT_NO_NAME_REMAPPING (1<<2) /** compat flag: --compat-names without char remapping */ bool compat_flag (unsigned int flag); +#if P2MP_SERVER +/* helper to parse peer_info received from multi client, validate + * (this is untrusted data) and put into environment */ +bool validate_peer_info_line(char *line); +void output_peer_info_env (struct env_set *es, const char * peer_info); +#endif /* P2MP_SERVER */ + #endif diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 50f398d..f016b14 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -1562,58 +1562,6 @@ multi_client_connect_mda (struct multi_context *m, #endif -/* helper to parse peer_info received from multi client, validate - * (this is untrusted data) and put into environment - */ -bool -validate_peer_info_line(char *line) -{ - uint8_t c; - int state = 0; - while (*line) - { - c = *line; - switch (state) - { - case 0: - case 1: - if (c == '=' && state == 1) - state = 2; - else if (isalnum(c) || c == '_') - state = 1; - else - return false; - case 2: - /* after the '=', replace non-printable or shell meta with '_' */ - if (!isprint(c) || isspace(c) || - c == '$' || c == '(' || c == '`' ) - *line = '_'; - } - line++; - } - return (state == 2); -} - -void -multi_output_peer_info_env (struct env_set *es, const char * peer_info) -{ - char line[256]; - struct buffer buf; - buf_set_read (&buf, (const uint8_t *) peer_info, strlen(peer_info)); - while (buf_parse (&buf, '\n', line, sizeof (line))) - { - chomp (line); - if (validate_peer_info_line(line) && - (strncmp(line, "IV_", 3) == 0 || strncmp(line, "UV_", 3) == 0) ) - { - msg (M_INFO, "peer info: %s", line); - env_set_add(es, line); - } - else - msg (M_WARN, "validation failed on peer_info line received from client"); - } -} - static void multi_client_connect_setenv (struct multi_context *m, struct multi_instance *mi) diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index 7b97b0d..fc2ffb2 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -312,9 +312,6 @@ void multi_close_instance_on_signal (struct multi_context *m, struct multi_insta void init_management_callback_multi (struct multi_context *m); void uninit_management_callback_multi (struct multi_context *m); -bool validate_peer_info_line(char *line); -void multi_output_peer_info_env (struct env_set *es, const char * peer_info); - /* * Return true if our output queue is not full */ diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 40356a0..3c0a379 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1158,7 +1158,6 @@ resolve_bind_local (struct link_socket *sock) case AF_INET6: { int status; - int err; CLEAR(sock->info.lsa->local.addr.in6); if (sock->local_host) { @@ -1181,7 +1180,7 @@ resolve_bind_local (struct link_socket *sock) { msg (M_FATAL, "getaddr6() failed for local \"%s\": %s", sock->local_host, - gai_strerror(err)); + gai_strerror(status)); } sock->info.lsa->local.addr.in6.sin6_port = htons (sock->local_port); } @@ -1235,6 +1234,7 @@ resolve_remote (struct link_socket *sock, unsigned int flags = sf2gaf(GETADDR_RESOLVE|GETADDR_UPDATE_MANAGEMENT_STATE, sock->sockflags); int retry = 0; int status = -1; + struct addrinfo* ai; if (sock->connection_profiles_defined && sock->resolve_retry_seconds == RESOLV_RETRY_INFINITE) { @@ -1271,7 +1271,6 @@ resolve_remote (struct link_socket *sock, ASSERT (0); } - struct addrinfo* ai; /* Temporary fix, this need to be changed for dual stack */ status = openvpn_getaddrinfo(flags, sock->remote_host, retry, signal_received, af, &ai); diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index 4e7e7f8..793cd9f 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -1023,7 +1023,7 @@ static inline void link_socket_set_tos (struct link_socket *ls) { if (ls && ls->ptos_defined) - setsockopt (ls->sd, IPPROTO_IP, IP_TOS, &ls->ptos, sizeof (ls->ptos)); + setsockopt (ls->sd, IPPROTO_IP, IP_TOS, (const void *)&ls->ptos, sizeof (ls->ptos)); } #endif diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index e4b802f..69f77f3 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2062,7 +2062,7 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi free (multi->peer_info); multi->peer_info = read_string_alloc (buf); if ( multi->peer_info ) - multi_output_peer_info_env (session->opt->es, multi->peer_info); + output_peer_info_env (session->opt->es, multi->peer_info); #endif if (verify_user_pass_enabled(session)) diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index 12c725d..ec76b30 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -242,8 +242,7 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers) const tls_cipher_name_pair *cipher_pair; - const size_t openssl_ciphers_size = 4096; - char openssl_ciphers[openssl_ciphers_size]; + char openssl_ciphers[4096]; size_t openssl_ciphers_len = 0; openssl_ciphers[0] = '\0'; @@ -282,8 +281,8 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers) } // Make sure new cipher name fits in cipher string - if (((openssl_ciphers_size-1) - openssl_ciphers_len) < current_cipher_len) { - msg(M_SSLERR, "Failed to set restricted TLS cipher list, too long (>%zu).", openssl_ciphers_size-1); + if (((sizeof(openssl_ciphers)-1) - openssl_ciphers_len) < current_cipher_len) { + msg(M_SSLERR, "Failed to set restricted TLS cipher list, too long (>%d).", (int)sizeof(openssl_ciphers)-1); } // Concatenate cipher name to OpenSSL cipher string diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c index 178e2c3..022eec5 100644 --- a/src/openvpn/win32.c +++ b/src/openvpn/win32.c @@ -870,6 +870,9 @@ openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned i WCHAR *cl = wide_cmd_line (a, &gc); WCHAR *cmd = wide_string (a->argv[0], &gc); + /* this allows console programs to run, and is ignored otherwise */ + DWORD proc_flags = CREATE_NO_WINDOW; + CLEAR (start_info); CLEAR (proc_info); @@ -879,9 +882,6 @@ openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned i start_info.dwFlags = STARTF_USESHOWWINDOW; start_info.wShowWindow = SW_HIDE; - /* this allows console programs to run, and is ignored otherwise */ - DWORD proc_flags = CREATE_NO_WINDOW; - if (CreateProcessW (cmd, cl, NULL, NULL, FALSE, proc_flags, env, NULL, &start_info, &proc_info)) { DWORD exit_status = 0; -- 1.7.9.5 |
From: Gert D. <ge...@gr...> - 2013-08-16 15:57:40
|
Hi, patch has been applied to the master branch (not to release/2.3, as it's fixing code that does not exist in 2.3). Sorry for making a mess with the multi_output_peer_info_env() stuff... still trying to find my way. commit 46e02127a44270c7199f458f43807bff2ddb11f3 Author: James Yonan Date: Sun Jul 28 16:05:35 2013 -0600 MSVC fixes Acked-by: Gert Doering <ge...@gr...> Message-Id: <137...@op...> URL: http://article.gmane.org/gmane.network.openvpn.devel/7777 Signed-off-by: Gert Doering <ge...@gr...> -- kind regards, Gert Doering |