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

-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de
From 396d34190f50865685188e1e9965725169422afc Mon Sep 17 00:00:00 2001
From: Gert Doering <g...@greenie.muc.de>
List-Post: openvpn-devel@lists.sourceforge.net
Date: Sat, 26 Apr 2014 20:31:41 +0200
Subject: [PATCH] Accept BUILD_STRING from caller, add to IV_GUI_VER setting

Signed-off-by: Gert Doering <g...@greenie.muc.de>
---
 Makefile.am |    2 +-
 openvpn.c   |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c4d754c..668f769 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 \
diff --git a/openvpn.c b/openvpn.c
index 79696f3..89d9601 100644
--- a/openvpn.c
+++ b/openvpn.c
@@ -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("")));
-- 
1.7.9.5

From 1fdd993905e711acbc4b3042ff7912ef71d337c4 Mon Sep 17 00:00:00 2001
From: Gert Doering <g...@greenie.muc.de>
List-Post: openvpn-devel@lists.sourceforge.net
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".

Signed-off-by: Gert Doering <g...@greenie.muc.de>
---
 generic/build               |   15 +++++++++++----
 windows-nsis/build-complete |    1 +
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/generic/build b/generic/build
index db30348..0f030a3 100755
--- a/generic/build
+++ b/generic/build
@@ -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}"
                        ;;
diff --git a/windows-nsis/build-complete b/windows-nsis/build-complete
index 7a0bf11..b7eccc4 100755
--- a/windows-nsis/build-complete
+++ b/windows-nsis/build-complete
@@ -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} 
\
-- 
1.7.9.5

Attachment: pgpTRj1xnRZeS.pgp
Description: PGP signature

Reply via email to