IV_GUI_VER and the windows gui
Hiya,
"I thought this would be just an easy walk in the park", and then both our build system and windows came to haunt me.
What I *want* is "have the windows gui send a string back to the server that tells the server the version of the gui plus the installer".
Like in:
IV_GUI_VER=OpenVPN_GUI_601_build_I901
what I get is:
IV_GUI_VER=_____________________1____________1_____________________1
the "_"s are "non printable characters that the server converts to '_' before passing to the shell or the log file"...
To actually get to this point, I had to patch both the gui source to accept an extra string for the "build version" (GUI version alone is not enough to identify a given client version) - attached as
"0001-Accept-BUILD_STRING-from-caller-add-to-IV_GUI_VER-se.patch"
and the build system itself, attached as
"0001-Pass-installer-version-to-openvpn-gui-building.patch"
... so now I have an openvpn-gui.exe that the shows all the strings I want to have in there with "strings", but on the way to the command line, the string seems to be massacred into a wide string (_sntprintf_0() is a wrapper for _vsntprintf(), which expands to _vsnwprintf() if UNICODE is defined, and that one seems to, well, create wide characters) that openvpn.exe happily passes on, but the server cannot make sense of.
(Something else seems to go on, though, as the string length isn't exactly doubled, and I had expected it to show every second character just fine)
So...
... any elegant ideas how to solve this?
(the patches are "work in progress", obviously, to see whether I could get anywhere)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...From 396d34190f50865685188e1e9965725169422afc Mon Sep 17 00:00:00 2001
From: Gert Doering <[email protected]...>
Date: Sat, 26 Apr 2014 20:31:41 +0200
Subject: [PATCH] Accept BUILD_STRING from caller, add to IV_GUI_VER setting
--- Makefile.am | 2 +- openvpn.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
Makefile.am +1 -1
@@ -39,7 +39,7 @@ dist_doc_DATA = \ INCLUDES = $(OPENSSL_CRYPTO_CFLAGS) AM_CPPFLAGS = -D_UNICODE -AM_CFLAGS = -municode +AM_CFLAGS = -municode -DBUILD_STRING="\"$(BUILD_STRING)\"" openvpn_gui_RESOURCES = \ res/openvpn-gui-res.rc \
openvpn.c +3 -2
@@ -684,9 +684,10 @@ StartOpenVPN(connection_t *c)/* Construct command line */ _sntprintf_0 (cmdline,_T ("openvpn --config \"%s\" " -"--setenv IV_GUI_VER \"%s\" --service %s 0 --log%s \"%s\" --auth-retry interact " +"--setenv IV_GUI_VER \"%s%s\" --service %s 0 --log%s \"%s\" --auth-retry interact " "--management %S %hd stdin --management-query-passwords %s" -"--management-hold" ), c->config_file,PACKAGE_STRING , exit_event_name, +"--management-hold" ), c->config_file,PACKAGE_STRING ,BUILD_STRING , + exit_event_name, (o.append_string[0 ] =='1' ?_T ("-append" ) :_T ("" )), c->log_path,inet_ntoa (c->manage.skaddr.sin_addr),ntohs (c->manage.skaddr.sin_port), (o.proxy_source != config ?_T ("--management-query-proxy " ) :_T ("" )));
Signature · 1 line
1.7.9.5
From 1fdd993905e711acbc4b3042ff7912ef71d337c4 Mon Sep 17 00:00:00 2001
From: Gert Doering <[email protected]...>
Date: Sat, 26 Apr 2014 20:33:56 +0200
Subject: [PATCH] Pass installer version to openvpn-gui building.
build-complete knows the installer version, generic/build doesn't, so add a new option (--build-string), and pass on the string to the openvpn-gui build.
Also fix the "downloading of tar balls" function to check for the actual file to download, not just "anything that has the same name with any(!) number after it".
--- generic/build | 15 +++++++++++---- windows-nsis/build-complete | 1 + 2 files changed, 12 insertions(+), 4 deletions(-)
generic/build +11 -4
@@ -82,9 +82,11 @@ geturl() { download1() { local url="$1" - local prefix="$(basename "${url}" | sed 's/-[0-9].*//g')" + local filename="$(basename "${url}")" - if ! [ -n "$(ls "${SOURCESROOT}/${prefix}-"[0-9]* 2> /dev/null)" ]; then + if [ -f "${SOURCESROOT}/${filename}" ] ; then + echo "$filename already there, skip download." + else geturl ${url} || die "Cannot download ${url}" fi }
@@ -300,10 +302,12 @@ build_openvpn_gui() { fixup_la echo "Build openvpn-gui" - cd "${BUILDROOT}/openvpn-gui"* || die "cd openvpn gui" + cd "${BUILDROOT}/openvpn-gui-${OPENVPN_GUI_VERSION}" || \ + die "cd ${BUILDROOT}/openvpn-gui-${OPENVPN_GUI_VERSION}" ./configure ${CONFIGOPTS} ${EXTRA_OPENVPN_GUI_CONFIG} \ || die "Configure openvpn-gui" - ${MAKE} ${MAKEOPTS} ${MAKE_AUTOCONF_INSTALL_TARGET} DESTDIR="${OPENVPN_ROOT}" || die "make openvpn-gui" + ${MAKE} ${MAKEOPTS} ${MAKE_AUTOCONF_INSTALL_TARGET} \ + BUILD_STRING="${BUILD_STRING}" DESTDIR="${OPENVPN_ROOT}" || die "make openvpn-gui" fixup_la
@@ -501,6 +505,9 @@ while [ -n "$1" ]; do ;; esac ;; + --build-string=*) + BUILD_STRING="${v}" + ;; --special-build=*) SPECIAL_BUILD="${v}" ;;
windows-nsis/build-complete +1 -0
@@ -20,6 +20,7 @@ main() { BUILDROOT="${TMPDIR}/build-${arch}" \ CHOST=${arch}-w64-mingw32 \ ../generic/build \ + --build-string=" build ${INSTALLER_VERSION}" \ --special-build="${SPECIAL_BUILD}" \ ${WIN_USE_DEPCACHE:+--use-depcache=win-$arch} \ ${WIN_SAVE_DEPCACHE:+--save-depcache=win-$arch} \
Signature · 1 line
1.7.9.5