Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package openvpn for openSUSE:Factory checked in at 2023-06-17 22:19:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/openvpn (Old) and /work/SRC/openSUSE:Factory/.openvpn.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "openvpn" Sat Jun 17 22:19:41 2023 rev:109 rq:1093056 version:2.6.5 Changes: -------- --- /work/SRC/openSUSE:Factory/openvpn/openvpn.changes 2023-05-13 17:17:33.714353716 +0200 +++ /work/SRC/openSUSE:Factory/.openvpn.new.15902/openvpn.changes 2023-06-17 22:19:43.403325264 +0200 @@ -1,0 +2,24 @@ +Wed Jun 14 06:42:58 UTC 2023 - Mohd Saquib <mohd.saq...@suse.com> + +- update to 2.6.5: + * apctl (windows): generate driver-specific names (if using tapctl + to create additional tap/wintun/dco devices, and not using + --name) (Github #337) + * interactive service (windows): do not force target desktop for + openvpn.exe - this has no impact for normal use, but enables + running of OpenVPN in a scripted way when no user is logged on + (for example, via task scheduler) (Github OpenVPN/openvpn-gui#626) + * fix use-after-free with EVP_CIPHER_free + * fix building with MSVC from release tarball (missing version.m4.in) + * dco-win: repair use of --dev-node to select specific DCO drivers + (Github #336) + * fix missing malloc() return check in dco_freebsd.c + * windows: correctly handle unicode names for "exit event" + * fix memleak in client-connect example plugin + * fix fortify build problem in keying-material-exporter-demo plugin + * fix memleak in dco_linux.c/dco_get_peer_stats_multi() - this will + leak a small amount of memory every 15s on DCO enabled servers, + leading to noticeable memory waste for long-running processes. + * dco_linux.c: properly close dco version file (fd leak) + +------------------------------------------------------------------- Old: ---- openvpn-2.6.4.tar.gz openvpn-2.6.4.tar.gz.asc New: ---- openvpn-2.6.5.tar.gz openvpn-2.6.5.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ openvpn.spec ++++++ --- /var/tmp/diff_new_pack.7XHzRH/_old 2023-06-17 22:19:44.267330457 +0200 +++ /var/tmp/diff_new_pack.7XHzRH/_new 2023-06-17 22:19:44.271330480 +0200 @@ -20,7 +20,7 @@ %define _rundir %{_localstatedir}/run %endif Name: openvpn -Version: 2.6.4 +Version: 2.6.5 Release: 0 Summary: Full-featured SSL VPN solution using a TUN/TAP Interface License: GPL-2.0-only WITH openvpn-openssl-exception ++++++ openvpn-2.6.4.tar.gz -> openvpn-2.6.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/ChangeLog new/openvpn-2.6.5/ChangeLog --- old/openvpn-2.6.4/ChangeLog 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/ChangeLog 2023-06-13 08:09:22.000000000 +0200 @@ -1,6 +1,31 @@ OpenVPN ChangeLog Copyright (C) 2002-2023 OpenVPN Inc <sa...@openvpn.net> +2023.06.13 -- Version 2.6.5 + +Arne Schwabe (1): + Fix use-after-free with EVP_CIPHER_free + +Frank Lichtenheld (6): + dco_linux: properly close dco version file + DCO: fix memory leak in dco_get_peer_stats_multi for Linux + Fix two unused assignments + sample-plugins: Fix memleak in client-connect example plugin + options: remove --key-method from usage message + msvc-generate: include version.m4.in in tarball + +Ilya Shipitsin (1): + src/openvpn/dco_freebsd.c: handle malloc failure + +Lev Stipakov (2): + dco-win: support for --dev-node + tapctl: generate driver-specific adapter names + +Selva Nair (2): + Correctly handle Unicode names for exit event + Interactive service: do not force a target desktop for openvpn.exe + + 2023.05.11 -- Version 2.6.4 Arne Schwabe (3): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/Changes.rst new/openvpn-2.6.5/Changes.rst --- old/openvpn-2.6.4/Changes.rst 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/Changes.rst 2023-06-13 08:09:22.000000000 +0200 @@ -1,3 +1,41 @@ +Overview of changes in 2.6.5 +============================ + +User visible changes +-------------------- +- tapctl (windows): generate driver-specific names (if using tapctl to + create additional tap/wintun/dco devices, and not using --name) + (Github #337) + +- interactive service (windows): do not force target desktop for + openvpn.exe - this has no impact for normal use, but enables running + of OpenVPN in a scripted way when no user is logged on (for example, + via task scheduler) (Github OpenVPN/openvpn-gui#626) + +Bug fixes +--------- +- fix use-after-free with EVP_CIPHER_free + +- fix building with MSVC from release tarball (missing version.m4.in) + +- dco-win: repair use of --dev-node to select specific DCO drivers + (Github #336) + +- fix missing malloc() return check in dco_freebsd.c + +- windows: correctly handle unicode names for "exit event" + +- fix memleak in client-connect example plugin + +- fix fortify build problem in keying-material-exporter-demo plugin + +- fix memleak in dco_linux.c/dco_get_peer_stats_multi() - this will + leak a small amount of memory every 15s on DCO enabled servers, + leading to noticeable memory waste for long-running processes. + +- dco_linux.c: properly close dco version file (fd leak) + + Overview of changes in 2.6.4 ============================ @@ -52,7 +90,7 @@ - Windows DCO driver: use correct crypto library so it loads on x86, see GH OpenVPN/ovpn-dco-win#43 - + Overview of changes in 2.6.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/build/msvc/msvc-generate/Makefile.am new/openvpn-2.6.5/build/msvc/msvc-generate/Makefile.am --- old/openvpn-2.6.4/build/msvc/msvc-generate/Makefile.am 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/build/msvc/msvc-generate/Makefile.am 2023-06-13 08:09:22.000000000 +0200 @@ -15,4 +15,5 @@ dist_noinst_DATA = \ msvc-generate.vcxproj \ Makefile.mak \ - msvc-generate.js + msvc-generate.js \ + version.m4.in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/build/msvc/msvc-generate/Makefile.in new/openvpn-2.6.5/build/msvc/msvc-generate/Makefile.in --- old/openvpn-2.6.4/build/msvc/msvc-generate/Makefile.in 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/build/msvc/msvc-generate/Makefile.in 2023-06-13 08:09:22.000000000 +0200 @@ -337,7 +337,8 @@ dist_noinst_DATA = \ msvc-generate.vcxproj \ Makefile.mak \ - msvc-generate.js + msvc-generate.js \ + version.m4.in all: all-am diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/build/msvc/msvc-generate/version.m4.in new/openvpn-2.6.5/build/msvc/msvc-generate/version.m4.in --- old/openvpn-2.6.4/build/msvc/msvc-generate/version.m4.in 1970-01-01 01:00:00.000000000 +0100 +++ new/openvpn-2.6.5/build/msvc/msvc-generate/version.m4.in 2023-06-13 08:09:22.000000000 +0200 @@ -0,0 +1,3 @@ +define([OPENVPN_VERSION_MAJOR], [@PRODUCT_VERSION_MAJOR@]) +define([OPENVPN_VERSION_MINOR], [@PRODUCT_VERSION_MINOR@]) +define([OPENVPN_VERSION_PATCH], [@PRODUCT_VERSION_PATCH@]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/configure new/openvpn-2.6.5/configure --- old/openvpn-2.6.4/configure 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/configure 2023-06-13 08:09:22.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for OpenVPN 2.6.4. +# Generated by GNU Autoconf 2.71 for OpenVPN 2.6.5. # # Report bugs to <openvpn-us...@lists.sourceforge.net>. # @@ -621,8 +621,8 @@ # Identity of this package. PACKAGE_NAME='OpenVPN' PACKAGE_TARNAME='openvpn' -PACKAGE_VERSION='2.6.4' -PACKAGE_STRING='OpenVPN 2.6.4' +PACKAGE_VERSION='2.6.5' +PACKAGE_STRING='OpenVPN 2.6.5' PACKAGE_BUGREPORT='openvpn-us...@lists.sourceforge.net' PACKAGE_URL='' @@ -1522,7 +1522,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenVPN 2.6.4 to adapt to many kinds of systems. +\`configure' configures OpenVPN 2.6.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1593,7 +1593,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenVPN 2.6.4:";; + short | recursive ) echo "Configuration of OpenVPN 2.6.5:";; esac cat <<\_ACEOF @@ -1830,7 +1830,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenVPN configure 2.6.4 +OpenVPN configure 2.6.5 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2487,7 +2487,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenVPN $as_me 2.6.4, which was +It was created by OpenVPN $as_me 2.6.5, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3267,13 +3267,13 @@ fi -printf "%s\n" "#define OPENVPN_VERSION_RESOURCE 2,6,4,0" >>confdefs.h +printf "%s\n" "#define OPENVPN_VERSION_RESOURCE 2,6,5,0" >>confdefs.h OPENVPN_VERSION_MAJOR=2 OPENVPN_VERSION_MINOR=6 -OPENVPN_VERSION_PATCH=.4 +OPENVPN_VERSION_PATCH=.5 printf "%s\n" "#define OPENVPN_VERSION_MAJOR 2" >>confdefs.h @@ -3282,7 +3282,7 @@ printf "%s\n" "#define OPENVPN_VERSION_MINOR 6" >>confdefs.h -printf "%s\n" "#define OPENVPN_VERSION_PATCH \".4\"" >>confdefs.h +printf "%s\n" "#define OPENVPN_VERSION_PATCH \".5\"" >>confdefs.h @@ -3811,7 +3811,7 @@ # Define the identity of the package. PACKAGE='openvpn' - VERSION='2.6.4' + VERSION='2.6.5' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -20072,7 +20072,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenVPN $as_me 2.6.4, which was +This file was extended by OpenVPN $as_me 2.6.5, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20140,7 +20140,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -OpenVPN config.status 2.6.4 +OpenVPN config.status 2.6.5 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/include/openvpn-plugin.h new/openvpn-2.6.5/include/openvpn-plugin.h --- old/openvpn-2.6.4/include/openvpn-plugin.h 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/include/openvpn-plugin.h 2023-06-13 08:09:22.000000000 +0200 @@ -53,7 +53,7 @@ */ #define OPENVPN_VERSION_MAJOR 2 #define OPENVPN_VERSION_MINOR 6 -#define OPENVPN_VERSION_PATCH ".4" +#define OPENVPN_VERSION_PATCH ".5" /* * Plug-in types. These types correspond to the set of script callbacks diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/sample/sample-plugins/Makefile new/openvpn-2.6.5/sample/sample-plugins/Makefile --- old/openvpn-2.6.4/sample/sample-plugins/Makefile 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/sample/sample-plugins/Makefile 2023-06-13 08:09:22.000000000 +0200 @@ -216,7 +216,7 @@ OPENSSL_LIBS = -lssl -lcrypto OPENVPN_VERSION_MAJOR = 2 OPENVPN_VERSION_MINOR = 6 -OPENVPN_VERSION_PATCH = .4 +OPENVPN_VERSION_PATCH = .5 OPTIONAL_CRYPTO_CFLAGS = OPTIONAL_CRYPTO_LIBS = -lssl -lcrypto OPTIONAL_DL_LIBS = -ldl @@ -237,10 +237,10 @@ PACKAGE = openvpn PACKAGE_BUGREPORT = openvpn-us...@lists.sourceforge.net PACKAGE_NAME = OpenVPN -PACKAGE_STRING = OpenVPN 2.6.4 +PACKAGE_STRING = OpenVPN 2.6.5 PACKAGE_TARNAME = openvpn PACKAGE_URL = -PACKAGE_VERSION = 2.6.4 +PACKAGE_VERSION = 2.6.5 PATH_SEPARATOR = : PKCS11_HELPER_CFLAGS = PKCS11_HELPER_LIBS = -lpthread -ldl -lcrypto -lpkcs11-helper @@ -270,7 +270,7 @@ TEST_CFLAGS = -I$(top_srcdir)/include TEST_LDFLAGS = -lssl -lcrypto -lcmocka TMPFILES_DIR = -VERSION = 2.6.4 +VERSION = 2.6.5 WOLFSSL_CFLAGS = WOLFSSL_INCLUDEDIR = WOLFSSL_LIBS = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/sample/sample-plugins/client-connect/sample-client-connect.c new/openvpn-2.6.5/sample/sample-plugins/client-connect/sample-client-connect.c --- old/openvpn-2.6.4/sample/sample-plugins/client-connect/sample-client-connect.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/sample/sample-plugins/client-connect/sample-client-connect.c 2023-06-13 08:09:22.000000000 +0200 @@ -454,6 +454,9 @@ if (!rl->name || !rl->value) { plugin_log(PLOG_ERR, MODULE, "malloc(return_list->xx) failed"); + free(rl->name); + free(rl->value); + free(rl); return OPENVPN_PLUGIN_FUNC_ERROR; } @@ -509,6 +512,9 @@ if (!rl->name || !rl->value) { plugin_log(PLOG_ERR, MODULE, "malloc(return_list->xx) failed"); + free(rl->name); + free(rl->value); + free(rl); return OPENVPN_PLUGIN_FUNC_ERROR; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c new/openvpn-2.6.5/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c --- old/openvpn-2.6.4/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c 2023-06-13 08:09:22.000000000 +0200 @@ -155,7 +155,7 @@ if (!strncasecmp(objbuf, "CN", 2)) { - snprintf(sess->user, sizeof(sess->user) - 1, (char *)buf); + strncpy(sess->user, (char *)buf, sizeof(sess->user) - 1); } OPENSSL_free(buf); @@ -234,7 +234,7 @@ return OPENVPN_PLUGIN_FUNC_ERROR; } - snprintf(sess->key, sizeof(sess->key) - 1, "%s", key); + strncpy(sess->key, key, sizeof(sess->key) - 1); ovpn_note("app session key: %s", sess->key); switch (plugin->type) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/src/openvpn/crypto_openssl.c new/openvpn-2.6.5/src/openvpn/crypto_openssl.c --- old/openvpn-2.6.4/src/openvpn/crypto_openssl.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/src/openvpn/crypto_openssl.c 2023-06-13 08:09:22.000000000 +0200 @@ -839,9 +839,9 @@ crypto_msg(M_FATAL, "EVP cipher init #2"); } - EVP_CIPHER_free(kt); /* make sure we used a big enough key */ ASSERT(EVP_CIPHER_CTX_key_length(ctx) <= EVP_CIPHER_key_length(kt)); + EVP_CIPHER_free(kt); } int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/src/openvpn/dco_freebsd.c new/openvpn-2.6.5/src/openvpn/dco_freebsd.c --- old/openvpn-2.6.4/src/openvpn/dco_freebsd.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/src/openvpn/dco_freebsd.c 2023-06-13 08:09:22.000000000 +0200 @@ -594,6 +594,10 @@ } buf = malloc(ifcr.ifcr_total * IFNAMSIZ); + if (!buf) + { + goto out; + } ifcr.ifcr_count = ifcr.ifcr_total; ifcr.ifcr_buffer = buf; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/src/openvpn/dco_linux.c new/openvpn-2.6.5/src/openvpn/dco_linux.c --- old/openvpn-2.6.4/src/openvpn/dco_linux.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/src/openvpn/dco_linux.c 2023-06-13 08:09:22.000000000 +0200 @@ -925,7 +925,10 @@ nlmsg_hdr(nl_msg)->nlmsg_flags |= NLM_F_DUMP; - return ovpn_nl_msg_send(dco, nl_msg, dco_parse_peer_multi, m, __func__); + int ret = ovpn_nl_msg_send(dco, nl_msg, dco_parse_peer_multi, m, __func__); + + nlmsg_free(nl_msg); + return ret; } static int @@ -1020,6 +1023,7 @@ if (!fgets(BSTR(&out), BCAP(&out), fp)) { + fclose(fp); return "ERR"; } @@ -1031,6 +1035,7 @@ *nl = '\0'; } + fclose(fp); return BSTR(&out); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/src/openvpn/options.c new/openvpn-2.6.5/src/openvpn/options.c --- old/openvpn-2.6.4/src/openvpn/options.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/src/openvpn/options.c 2023-06-13 08:09:22.000000000 +0200 @@ -569,8 +569,6 @@ "(These options are meaningful only for TLS-mode)\n" "--tls-server : Enable TLS and assume server role during TLS handshake.\n" "--tls-client : Enable TLS and assume client role during TLS handshake.\n" - "--key-method m : (DEPRECATED) Data channel key exchange method. m should be a method\n" - " number, such as 1 (default), 2, etc.\n" "--ca file : Certificate authority file in .pem format containing\n" " root certificate.\n" #ifndef ENABLE_CRYPTO_MBEDTLS @@ -3771,14 +3769,14 @@ o->windows_driver = WINDOWS_DRIVER_TAP_WINDOWS6; } } -#endif - +#else /* _WIN32 */ if (dco_enabled(o) && o->dev_node) { msg(M_WARN, "Note: ignoring --dev-node as it has no effect when using " "data channel offload"); o->dev_node = NULL; } +#endif /* _WIN32 */ /* this depends on o->windows_driver, which is set above */ options_postprocess_mutate_invariant(o); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/src/openvpn/push.c new/openvpn-2.6.5/src/openvpn/push.c --- old/openvpn-2.6.4/src/openvpn/push.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/src/openvpn/push.c 2023-06-13 08:09:22.000000000 +0200 @@ -713,7 +713,6 @@ { struct push_entry *e = push_list->head; - e = push_list->head; while (e) { if (e->enable) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/src/openvpn/tun.c new/openvpn-2.6.5/src/openvpn/tun.c --- old/openvpn-2.6.4/src/openvpn/tun.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/src/openvpn/tun.c 2023-06-13 08:09:22.000000000 +0200 @@ -4200,7 +4200,7 @@ const struct tap_reg *tap_reg = get_tap_reg(&gc); const struct panel_reg *panel_reg = get_panel_reg(&gc); - msg(msglev, "Available TAP-WIN32 / Wintun adapters [name, GUID, driver]:"); + msg(msglev, "Available adapters [name, GUID, driver]:"); /* loop through each TAP-Windows adapter registry entry */ for (tr = tap_reg; tr != NULL; tr = tr->next) @@ -4337,7 +4337,6 @@ struct gc_arena *gc) { const struct tap_reg *tap_reg = tap_reg_src; - struct buffer ret = clear_buf(); struct buffer actual = clear_buf(); int i; @@ -4381,7 +4380,7 @@ } /* Save GUID for return value */ - ret = alloc_buf_gc(256, gc); + struct buffer ret = alloc_buf_gc(256, gc); buf_printf(&ret, "%s", tap_reg->guid); if (windows_driver != NULL) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/src/openvpn/win32.c new/openvpn-2.6.5/src/openvpn/win32.c --- old/openvpn-2.6.4/src/openvpn/win32.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/src/openvpn/win32.c 2023-06-13 08:09:22.000000000 +0200 @@ -509,19 +509,19 @@ && !HANDLE_DEFINED(ws->in.read) && exit_event_name) { struct security_attributes sa; + struct gc_arena gc = gc_new(); + const wchar_t *exit_event_nameW = wide_string(exit_event_name, &gc); if (!init_security_attributes_allow_all(&sa)) { msg(M_ERR, "Error: win32_signal_open: init SA failed"); } - ws->in.read = CreateEvent(&sa.sa, - TRUE, - exit_event_initial_state ? TRUE : FALSE, - exit_event_name); + ws->in.read = CreateEventW(&sa.sa, TRUE, exit_event_initial_state ? TRUE : FALSE, + exit_event_nameW); if (ws->in.read == NULL) { - msg(M_WARN|M_ERRNO, "NOTE: CreateEvent '%s' failed", exit_event_name); + msg(M_WARN|M_ERRNO, "NOTE: CreateEventW '%s' failed", exit_event_name); } else { @@ -534,6 +534,7 @@ ws->mode = WSO_MODE_SERVICE; } } + gc_free(&gc); } /* set the ctrl handler in both console and service modes */ if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE) win_ctrl_handler, true)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/src/openvpnserv/interactive.c new/openvpn-2.6.5/src/openvpnserv/interactive.c --- old/openvpn-2.6.4/src/openvpnserv/interactive.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/src/openvpnserv/interactive.c 2023-06-13 08:09:22.000000000 +0200 @@ -1868,7 +1868,6 @@ } startup_info.cb = sizeof(startup_info); - startup_info.lpDesktop = L"winsta0\\default"; startup_info.dwFlags = STARTF_USESTDHANDLES; startup_info.hStdInput = stdin_read; startup_info.hStdOutput = stdout_write; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/src/tapctl/main.c new/openvpn-2.6.5/src/tapctl/main.c --- old/openvpn-2.6.4/src/tapctl/main.c 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/src/tapctl/main.c 2023-06-13 08:09:22.000000000 +0200 @@ -126,6 +126,85 @@ title_string); } +/** + * Checks if adapter with given name doesn't already exist + */ +static BOOL +is_adapter_name_available(LPCTSTR name, struct tap_adapter_node *adapter_list, BOOL log) +{ + for (struct tap_adapter_node *a = adapter_list; a; a = a->pNext) + { + if (_tcsicmp(name, a->szName) == 0) + { + if (log) + { + LPOLESTR adapter_id = NULL; + StringFromIID((REFIID)&a->guid, &adapter_id); + _ftprintf(stderr, TEXT("Adapter \"%") TEXT(PRIsLPTSTR) TEXT("\" already exists (GUID %") + TEXT(PRIsLPOLESTR) TEXT(").\n"), a->szName, adapter_id); + CoTaskMemFree(adapter_id); + } + + return FALSE; + } + } + + return TRUE; +} + +/** + * Returns unique adapter name based on hwid or NULL if name cannot be generated. + * Caller is responsible for freeing it. + */ +static LPTSTR +get_unique_adapter_name(LPCTSTR hwid, struct tap_adapter_node *adapter_list) +{ + if (hwid == NULL) + { + return NULL; + } + + LPCTSTR base_name; + if (_tcsicmp(hwid, TEXT("ovpn-dco")) == 0) + { + base_name = TEXT("OpenVPN Data Channel Offload"); + } + else if (_tcsicmp(hwid, TEXT("wintun")) == 0) + { + base_name = TEXT("OpenVPN Wintun"); + } + else if (_tcsicmp(hwid, TEXT("root\\") TEXT(TAP_WIN_COMPONENT_ID)) == 0) + { + base_name = TEXT("OpenVPN TAP-Windows6"); + } + else + { + return NULL; + } + + if (is_adapter_name_available(base_name, adapter_list, FALSE)) + { + return _tcsdup(base_name); + } + + size_t name_len = _tcslen(base_name) + 10; + LPTSTR name = malloc(name_len * sizeof(TCHAR)); + if (name == NULL) + { + return NULL; + } + for (int i = 1; i < 100; ++i) + { + _stprintf_s(name, name_len, TEXT("%ls #%d"), base_name, i); + + if (is_adapter_name_available(name, adapter_list, FALSE)) + { + return name; + } + } + + return NULL; +} /** * Program entry point @@ -210,50 +289,49 @@ iResult = 1; goto quit; } - if (szName) + /* Get existing network adapters. */ + struct tap_adapter_node *pAdapterList = NULL; + dwResult = tap_list_adapters(NULL, NULL, &pAdapterList); + if (dwResult != ERROR_SUCCESS) { - /* Get existing network adapters. */ - struct tap_adapter_node *pAdapterList = NULL; - dwResult = tap_list_adapters(NULL, NULL, &pAdapterList); - if (dwResult != ERROR_SUCCESS) - { - _ftprintf(stderr, TEXT("Enumerating adapters failed (error 0x%x).\n"), dwResult); - iResult = 1; goto create_delete_adapter; - } + _ftprintf(stderr, TEXT("Enumerating adapters failed (error 0x%x).\n"), dwResult); + iResult = 1; + goto create_delete_adapter; + } - /* Check for duplicates. */ - for (struct tap_adapter_node *pAdapter = pAdapterList; pAdapter; pAdapter = pAdapter->pNext) + LPTSTR adapter_name = szName ? _tcsdup(szName) : get_unique_adapter_name(szHwId, pAdapterList); + if (adapter_name) + { + /* Check for duplicates when name was specified, + * otherwise get_adapter_default_name() takes care of it */ + if (szName && !is_adapter_name_available(adapter_name, pAdapterList, TRUE)) { - if (_tcsicmp(szName, pAdapter->szName) == 0) - { - StringFromIID((REFIID)&pAdapter->guid, &szAdapterId); - _ftprintf(stderr, TEXT("Adapter \"%") TEXT(PRIsLPTSTR) TEXT("\" already exists (GUID %") - TEXT(PRIsLPOLESTR) TEXT(").\n"), pAdapter->szName, szAdapterId); - CoTaskMemFree(szAdapterId); - iResult = 1; goto create_cleanup_pAdapterList; - } + iResult = 1; + goto create_cleanup_pAdapterList; } /* Rename the adapter. */ - dwResult = tap_set_adapter_name(&guidAdapter, szName, FALSE); + dwResult = tap_set_adapter_name(&guidAdapter, adapter_name, FALSE); if (dwResult != ERROR_SUCCESS) { StringFromIID((REFIID)&guidAdapter, &szAdapterId); _ftprintf(stderr, TEXT("Renaming TUN/TAP adapter %") TEXT(PRIsLPOLESTR) TEXT(" to \"%") TEXT(PRIsLPTSTR) TEXT("\" failed (error 0x%x).\n"), - szAdapterId, szName, dwResult); + szAdapterId, adapter_name, dwResult); CoTaskMemFree(szAdapterId); iResult = 1; goto quit; } + } - iResult = 0; + iResult = 0; create_cleanup_pAdapterList: - tap_free_adapter_list(pAdapterList); - if (iResult) - { - goto create_delete_adapter; - } + free(adapter_name); + + tap_free_adapter_list(pAdapterList); + if (iResult) + { + goto create_delete_adapter; } /* Output adapter GUID. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openvpn-2.6.4/version.m4 new/openvpn-2.6.5/version.m4 --- old/openvpn-2.6.4/version.m4 2023-05-11 08:09:21.000000000 +0200 +++ new/openvpn-2.6.5/version.m4 2023-06-13 08:09:22.000000000 +0200 @@ -3,12 +3,12 @@ define([PRODUCT_TARNAME], [openvpn]) define([PRODUCT_VERSION_MAJOR], [2]) define([PRODUCT_VERSION_MINOR], [6]) -define([PRODUCT_VERSION_PATCH], [.4]) +define([PRODUCT_VERSION_PATCH], [.5]) m4_append([PRODUCT_VERSION], [PRODUCT_VERSION_MAJOR]) m4_append([PRODUCT_VERSION], [PRODUCT_VERSION_MINOR], [[.]]) m4_append([PRODUCT_VERSION], [PRODUCT_VERSION_PATCH], [[]]) define([PRODUCT_BUGREPORT], [openvpn-us...@lists.sourceforge.net]) -define([PRODUCT_VERSION_RESOURCE], [2,6,4,0]) +define([PRODUCT_VERSION_RESOURCE], [2,6,5,0]) dnl define the TAP version define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901]) define([PRODUCT_TAP_WIN_MIN_MAJOR], [9])