.gear/NetworkManager-fortisslvpn.spec | 147 +++++++++++++++++++++ .gear/rules | 3 + .../tags/2f7a25dc60aaf54762c3ab8f2b6b08dd784dc971 | 17 +++ .../tags/7262eac82134698853ee7e10879c62d726ff5209 | 22 +++ .../tags/7b56571cf734f4c2f8f39e8b767e6b9057a330a4 | 16 +++ .../tags/b347ec843f1f64f2a0060af2b1c3ef05ced4a6a6 | 16 +++ .gear/tags/list | 4 + Makefile.am | 7 +- .../network-manager-fortisslvpn.metainfo.xml.in | 1 + configure.ac | 33 ++++- po/ru.po | 31 +++-- src/nm-fortisslvpn-pppd-compat.h | 123 +++++++++++++++++ src/nm-fortisslvpn-pppd-plugin.c | 24 ++-- src/nm-fortisslvpn-pppd-status.h | 42 ++++++ src/nm-fortisslvpn-service.c | 2 +- src/nm-ppp-status.h | 42 ------ 16 files changed, 452 insertions(+), 78 deletions(-) diff --git a/.gear/NetworkManager-fortisslvpn.spec b/.gear/NetworkManager-fortisslvpn.spec new file mode 100644 index 0000000..e57cf9d --- /dev/null +++ b/.gear/NetworkManager-fortisslvpn.spec @@ -0,0 +1,147 @@ +%define nm_version 1.2.28 +%define nm_applet_version 1.2.28 +%define nm_applet_name NetworkManager-applet-gtk +%define ppp_version %(pkg-config --modversion pppd 2>/dev/null || (%{__awk} '/^#define VERSION/ { print $NF }' /usr/include/pppd/patchlevel.h 2>/dev/null||echo none)|/usr/bin/tr -d '"') +%def_with gtk4 +%def_without libnm_glib + +%define _unpackaged_files_terminate_build 1 + +Name: NetworkManager-fortisslvpn +Version: 1.4.0 +Release: alt2 +License: GPLv2+ +Group: System/Configuration/Networking +Summary: Fortinet compatible SSLVPN support for NetworkManager +Url: https://gitlab.gnome.org/GNOME/NetworkManager-fortisslvpn.git +Source0: %name-%version.tar +Patch: %name-%version-%release.patch + +BuildRequires: intltool +BuildRequires: libnm-devel >= %nm_version +BuildRequires: libnma-devel >= %nm_applet_version +%if_with libnm_glib +BuildRequires: NetworkManager-devel >= %nm_version +BuildRequires: libnm-glib-vpn-devel >= %nm_version +BuildRequires: libnm-gtk-devel >= %nm_applet_version +%endif +%if_with gtk4 +BuildRequires: libgtk4-devel +BuildRequires: libnma-gtk4-devel +%else +BuildRequires: libgtk+3-devel +%endif +BuildRequires: libsecret-devel +BuildRequires: ppp-devel + +Requires: NetworkManager-daemon >= %nm_version +Requires: openfortivpn +Requires: ppp = %ppp_version + +%description +Fortinet SSLVPN support for NetworkManager + +%package gtk +License: GPLv2+ +Summary: Applications for use %name with %nm_applet_name +Group: Graphical desktop/GNOME +Requires: %nm_applet_name >= %nm_applet_version +Requires: NetworkManager-fortisslvpn = %version-%release + +Obsoletes: %name-gnome < 0.9.8.4 +Provides: %name-gnome = %version-%release + +%description gtk +This package contains applications for use with +NetworkManager panel applet. + +%package gtk4 +License: GPLv2+ +Summary: Applications for use %name with %nm_applet_name +Group: Graphical desktop/GNOME +Requires: %nm_applet_name >= %nm_applet_version +Requires: NetworkManager-fortisslvpn = %version-%release + +%description gtk4 +This package contains applications for use with +NetworkManager panel applet build with gtk4. + +%prep +%setup +%patch -p1 + +%build +%autoreconf +%configure \ + --disable-static \ + --libexecdir=%_libexecdir/NetworkManager \ + --localstatedir=%_var \ +%if_without libnm_glib + --without-libnm-glib \ +%endif +%if_with gtk4 + --with-gtk4 \ +%endif + --disable-silent-rules +%make_build + +%install +%makeinstall_std +%find_lang %name + +%check +make check + +%files -f %name.lang +%doc AUTHORS README +%_libexecdir/NetworkManager/nm-fortisslvpn-service +%_libexecdir/NetworkManager/nm-fortisslvpn-pinentry +%_libdir/NetworkManager/libnm-vpn-plugin-fortisslvpn.so +%_libdir/pppd/%ppp_version/*.so +%config %_sysconfdir/dbus-1/system.d/nm-fortisslvpn-service.conf +%if_with libnm_glib +%config %_sysconfdir/NetworkManager/VPN/nm-fortisslvpn-service.name +%endif +%config %_libexecdir/NetworkManager/VPN/nm-fortisslvpn-service.name +%attr(700,root,root) %dir %_localstatedir/%name +%_datadir/metainfo/*.xml +%exclude %_libdir/pppd/%ppp_version/*.la +%exclude %_libdir/NetworkManager/*.la + +%files gtk +%if_with libnm_glib +%_libdir/NetworkManager/libnm-fortisslvpn-properties.so* +%endif +%_libexecdir/NetworkManager/nm-fortisslvpn-auth-dialog +%_libdir/NetworkManager/libnm-vpn-plugin-fortisslvpn-editor.so + +%files gtk4 +%_libdir/NetworkManager/libnm-gtk4-vpn-plugin-fortisslvpn-editor.so + +%changelog +* Tue Aug 08 2023 Alexey Shabalin 1.4.0-alt2 +- Fixed build with ppp-2.5.0. +- Update Russian translation. + +* Wed Nov 02 2022 L.A. Kostis 1.4.0-alt1 +- Build with gtk4 support. + +* Thu Jan 07 2021 L.A. Kostis 1.2.10-alt1 +- 1.2.10. + +* Fri Nov 09 2018 Mikhail Efremov 1.2.8-alt1.1 +- NMU: Disable libnm-glib-* support. +- NMU: Fix build without libnm-glib-*. + +* Thu Mar 22 2018 L.A. Kostis 1.2.8-alt1 +- 1.2.8. +- remove configuration hack. + +* Thu Jan 11 2018 L.A. Kostis 1.2.6-alt3 +- don't expose configuration to public. + +* Thu Jan 11 2018 L.A. Kostis 1.2.6-alt2 +- Fix unresolved symbols (#rhbz 1512606). + +* Thu Jan 11 2018 L.A. Kostis 1.2.6-alt1 +- initial build for ALTLinux. diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..19c6abd --- /dev/null +++ b/.gear/rules @@ -0,0 +1,3 @@ +tar: @version@:. name=@name@-@version@ +diff: @version@:. . +spec: .gear/NetworkManager-fortisslvpn.spec \ No newline at end of file diff --git a/.gear/tags/2f7a25dc60aaf54762c3ab8f2b6b08dd784dc971 b/.gear/tags/2f7a25dc60aaf54762c3ab8f2b6b08dd784dc971 new file mode 100644 index 0000000..614ca27 --- /dev/null +++ b/.gear/tags/2f7a25dc60aaf54762c3ab8f2b6b08dd784dc971 @@ -0,0 +1,17 @@ +object 308987d45faee919e54547eb7ff0120c32c5a84e +type commit +tag 1.4.0 +tagger Lubomir Rintel 1647016246 +0100 + +Tag 1.4.0 +-----BEGIN PGP SIGNATURE----- + +iQFHBAABCAAxFiEENyn6vISEy07peidTpxZjkszkJRYFAmIreTYTHGxyaW50ZWxA +cmVkaGF0LmNvbQAKCRCnFmOSzOQlFrRTCACf6Sz570Vspl7HSfLu9ReEG1h2tl4K +wwYf8Sc1yUatPVALoKDY2xFCXeGgsovX4KJc8JY3Shh9oQe2ujVpGE3Re1QImYPQ +ifq0SYX6qPUitPa8F+QfabT7dwO1vmvQ2kZVvBWMS4mv8FD8BpCdNbfSvFjT1ck8 +87EsTaTPa19VNke0DMI1eaXP8xNA0ap6vUzAK12BlMiCgBgOlqpwpyWnuHtqJyPo +IHgy5ckXXZNBYdm5CoXa/Gu2xseRpWuG0plf2FUpVcJn9lhtU2RQ5dllXne1cXX/ +vMuDuzRZZleTU/ZqWJ5BNLuQ9cqRW5fIhBcMDB76rkht5EW2bi46ZOGY +=OLbV +-----END PGP SIGNATURE----- diff --git a/.gear/tags/7262eac82134698853ee7e10879c62d726ff5209 b/.gear/tags/7262eac82134698853ee7e10879c62d726ff5209 new file mode 100644 index 0000000..5316fc7 --- /dev/null +++ b/.gear/tags/7262eac82134698853ee7e10879c62d726ff5209 @@ -0,0 +1,22 @@ +object 1a8115e4ecd5b1f846a143ae97483deb4ae92224 +type commit +tag 1.2.8 +tagger Thomas Haller 1516183663 +0100 + +Tag 1.2.8 +-----BEGIN PGP SIGNATURE----- + +iQIcBAABAgAGBQJaXyBvAAoJECnCNm5N/Fco4TcQAIamECepRs0YLqZ1jo8/6Zp+ +hrkFZVR25qx3KyJNJvSgZ3Q9wvYSOA1ItSu09d25vqBwRqIclonZMwQfc98ctLC+ +CkrLKvKYjs0sL/EB3xE5rm3MW0m/c8w86/6Fn13AOXBfYu+UW4cI70Uct8fmwoKW +T6hQXiWVSbR1Qy8Avq6wnAl7RcUBwOMdNXnTOATgY2YttI19Uahk0B0d+ybeHxYW +Gdkw8ib5KHYKEBSV1rB5LJrbT48igTNFgY3iNziSiMHSnpyeLFrF17FVyB4yUiI0 +60M8YcF+aNwqv0hO3RxKp09xFNKuwxaF2YHdz6zdycLRxLzXs8xuXFRb+3P8ipMR +gBdBF+2YH9dvouLDB5+5ht0Aght7AL0zVWxyKE6WN86dt5Th01xxLXwTO+SjoIP1 +3q0RBpmtenON6SmfWVDVO14bS+co0Al28rRTYYlTBZ9pMFrZWp1QWTYkMVcKEJIt +lkUtQ9/IZn8uKa2vpBhiZt2gQU7o390jM/E3MsmQh/dezxRSXlD9wMyaC0qDyOdi +VWmY9pgfXhldg+0boU81YwSEyERPEyufclEoo5uAz9DORiOvXVY4Me3me+IT4JPc +Eh1oBY6ud9inu2wvZbuj1th6+LJMDQ+cZe1og1dLvTwxOCpjBTkKCXTjvGz2shsG +tbf5V9geYSliwcc5PEOv +=lo83 +-----END PGP SIGNATURE----- diff --git a/.gear/tags/7b56571cf734f4c2f8f39e8b767e6b9057a330a4 b/.gear/tags/7b56571cf734f4c2f8f39e8b767e6b9057a330a4 new file mode 100644 index 0000000..8bab449 --- /dev/null +++ b/.gear/tags/7b56571cf734f4c2f8f39e8b767e6b9057a330a4 @@ -0,0 +1,16 @@ +object a84e2a8c74e681a3bf41761424b91e5f77f7be57 +type commit +tag 1.2.10 +tagger Lubomir Rintel 1553184267 +0100 + +Tag 1.2.10 +-----BEGIN PGP SIGNATURE----- + +iQEcBAABAgAGBQJck7YPAAoJEImi2lr3PV49Br4IAMjb6SBhKUsdcHQZhwjQp5b/ +YJyjUY58aweWvvU7uaQ+dNa7NGUZwiySz6kGdIJJsMBlfoz5isHRNIyPVykrMfVN +ISvVhLq0IVES1IatnUsoxaND7tWrgND3FDwJKmvIodunCNVW5F1E657s0/JUwzkZ +zCiguUYZ+C/yhIl5unrBv1lGJrkJU+w+MYSlE8liZQtFpgJjyZSvyFUvhibWYTgb +XIHtcHimWDYSo/N4UNutW69bu7CA74n3uPH7HL0YHTZ2WJPnSLnV9uqI+5tABz7u +WAwYqME1z1dHizoESSDdwwdt9TWCawtppdoOTC8w6tsaL+X9v16eYTZK7mkMSIk= +=nIbp +-----END PGP SIGNATURE----- diff --git a/.gear/tags/b347ec843f1f64f2a0060af2b1c3ef05ced4a6a6 b/.gear/tags/b347ec843f1f64f2a0060af2b1c3ef05ced4a6a6 new file mode 100644 index 0000000..a9e4b22 --- /dev/null +++ b/.gear/tags/b347ec843f1f64f2a0060af2b1c3ef05ced4a6a6 @@ -0,0 +1,16 @@ +object 63e383a55d4b014eec910fde1b0e9db1295bb826 +type commit +tag 1.2.6 +tagger Lubomir Rintel 1504011336 +0200 + +Tag 1.2.6 +-----BEGIN PGP SIGNATURE----- + +iQEcBAABAgAGBQJZpWRMAAoJEImi2lr3PV49lzYIALywZ1yTUexO+cpZp15mxR85 +JAcSCaozvADZEpxJT1TdydeSlsFKQFRG2CXjnzisaI6yD9EQSoE91Fr37ZYy8a1I +OIdjb2YD9MrGLmqZRd+Y0DVmMl8aCmcZ+fxiwtkr1LwPrqMDaocINhiRPT8/1/79 +Xu1CpBJqB3Zzo0xqUihr7vGKud6z41sZaEj5G046YVgSRryg/REXwXHuKtWMqHQa +OJZvOWTt4C0JOceHLuq0iTZyNOAPJMoB7/DB4FVyaUZ2uZDDrzL72Xkc8aGOHCwr +7ew0Zyx0hnMaTrgCOCQm0Q8iEkR0mKHhbPXESctkVMezKjxXF2aMuUn7bj98SzQ= +=MSeT +-----END PGP SIGNATURE----- diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..4f84019 --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1,4 @@ +b347ec843f1f64f2a0060af2b1c3ef05ced4a6a6 1.2.6 +7262eac82134698853ee7e10879c62d726ff5209 1.2.8 +7b56571cf734f4c2f8f39e8b767e6b9057a330a4 1.2.10 +2f7a25dc60aaf54762c3ab8f2b6b08dd784dc971 1.4.0 diff --git a/Makefile.am b/Makefile.am index f6bb29d..e1e5ec9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -81,7 +81,7 @@ libexec_PROGRAMS += src/nm-fortisslvpn-service src_nm_fortisslvpn_service_SOURCES = \ shared/nm-utils/nm-shared-utils.c \ shared/nm-utils/nm-shared-utils.h \ - src/nm-ppp-status.h \ + src/nm-fortisslvpn-pppd-status.h \ src/nm-fortisslvpn-service.h \ src/nm-fortisslvpn-service.c \ shared/nm-fortissl-properties.c \ @@ -106,7 +106,8 @@ src_nm_fortisslvpn_pppd_plugin_la_SOURCES = \ shared/nm-utils/nm-shared-utils.c \ shared/nm-utils/nm-shared-utils.h \ src/nm-fortisslvpn-pppd-plugin.c \ - src/nm-ppp-status.h + src/nm-fortisslvpn-pppd-compat.h \ + src/nm-fortisslvpn-pppd-status.h nodist_src_nm_fortisslvpn_pppd_plugin_la_SOURCES = \ src/nm-fortisslvpn-pppd-service-dbus.h src_nm_fortisslvpn_pppd_plugin_la_CPPFLAGS = $(src_cppflags) @@ -386,7 +387,7 @@ endif install-data-hook: install-compat-name-file $(mkinstalldirs) -m 0700 $(DESTDIR)$(fortisslvpn_statedir) -appdatadir = $(datadir)/appdata +appdatadir = $(datadir)/metainfo appdata_files = $(appdata_in_files:.xml.in=.xml) if WITH_GNOME appdata_DATA = $(appdata_files) diff --git a/appdata/network-manager-fortisslvpn.metainfo.xml.in b/appdata/network-manager-fortisslvpn.metainfo.xml.in index 4c06ccc..1af3b3f 100644 --- a/appdata/network-manager-fortisslvpn.metainfo.xml.in +++ b/appdata/network-manager-fortisslvpn.metainfo.xml.in @@ -5,6 +5,7 @@ GPL-2.0+ CC0-1.0 nm-connection-editor.desktop + org.gnome.Settings.desktop gnome-control-center.desktop Fortinet SSLVPN client Client for Fortinet SSLVPN virtual private networks diff --git a/configure.ac b/configure.ac index 8a48755..0146ac9 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,10 @@ AC_PROG_CC AM_PROG_CC_C_O AC_PROG_INSTALL AC_PROG_LIBTOOL +AC_PROG_CPP +AC_PROG_EGREP AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources) +PKG_PROG_PKG_CONFIG() AC_GNU_SOURCE @@ -37,20 +40,46 @@ dnl dnl Required headers dnl AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h paths.h sys/ioctl.h sys/time.h syslog.h unistd.h) +AC_CHECK_HEADERS(fcntl.h paths.h stdarg.h stdbool.h sys/ioctl.h sys/time.h syslog.h unistd.h) AC_CHECK_HEADERS(pppd/pppd.h,, AC_MSG_ERROR(couldn't find pppd.h. pppd development headers are required.)) +dnl +dnl Check the presense of other pppd/*.h files +AC_CHECK_HEADERS(pppd/chap.h pppd/chap-new.h pppd/chap_ms.h) + +dnl +dnl Versions >= 2.5.0 will have pkg-config support +PKG_CHECK_EXISTS([pppd], + [AS_VAR_SET([pppd_pkgconfig_support],[yes])]) + +dnl +dnl Get the version of pppd using pkg-config, assume 2.4.9 if not present +PPPD_VERSION=2.4.5 +if test x"$pppd_pkgconfig_support" = xyes; then + PPPD_VERSION=`$PKG_CONFIG --modversion pppd` +fi + + AC_ARG_WITH([pppd-plugin-dir], AS_HELP_STRING([--with-pppd-plugin-dir=DIR], [path to the pppd plugins directory])) if test -n "$with_pppd_plugin_dir" ; then PPPD_PLUGIN_DIR="$with_pppd_plugin_dir" else - PPPD_PLUGIN_DIR="${libdir}/pppd/2.4.5" + PPPD_PLUGIN_DIR="${libdir}/pppd/$PPPD_VERSION" fi AC_SUBST(PPPD_PLUGIN_DIR) +dnl The version of pppd dictates what code can be included, i.e. enable use of +dnl #if WITH_PPP_VERSION >= PPP_VERSION(2,5,0) in the code +AC_DEFINE_UNQUOTED([PPP_VERSION(x,y,z)], + [((x & 0xFF) << 16 | (y & 0xFF) << 8 | (z & 0xFF) << 0)], + [Macro to help determine the particular version of pppd]) +PPP_VERSION=$(echo $PPPD_VERSION | sed -e "s/\./\,/g") +AC_DEFINE_UNQUOTED(WITH_PPP_VERSION, PPP_VERSION($PPP_VERSION), + [The real version of pppd represented as an int]) + dnl dnl Checks for typedefs, structures, and compiler characteristics. dnl diff --git a/po/ru.po b/po/ru.po index 2160950..3f9c2fe 100644 --- a/po/ru.po +++ b/po/ru.po @@ -11,38 +11,38 @@ msgid "" msgstr "" "Project-Id-Version: ru\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/NetworkManager-" -"fortisslvpn/\n" -"POT-Creation-Date: 2022-03-11 16:59+0100\n" -"PO-Revision-Date: 2021-03-17 17:49+0300\n" -"Last-Translator: Дронова Ю \n" +"fortisslvpn/issues\n" +"POT-Creation-Date: 2022-07-08 03:58+0000\n" +"PO-Revision-Date: 2023-05-23 23:03+1000\n" +"Last-Translator: Ser82-png \n" "Language-Team: Russian \n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" -"X-Generator: Lokalize 19.12.3\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Poedit 3.0.1\n" -#: appdata/network-manager-fortisslvpn.metainfo.xml.in:9 +#: appdata/network-manager-fortisslvpn.metainfo.xml.in:10 msgid "Fortinet SSLVPN client" msgstr "Клиент SSLVPN Fortinet" -#: appdata/network-manager-fortisslvpn.metainfo.xml.in:10 +#: appdata/network-manager-fortisslvpn.metainfo.xml.in:11 msgid "Client for Fortinet SSLVPN virtual private networks" msgstr "Клиент для частных виртуальных сетей Fortinet SSLVPN" -#: appdata/network-manager-fortisslvpn.metainfo.xml.in:24 +#: appdata/network-manager-fortisslvpn.metainfo.xml.in:25 msgid "" "Support for configuring Fortinet SSLVPN virtual private network connections." msgstr "" "Поддержка в настройке подключений частных виртуальных сетей Fortinet SSLVPN" -#: appdata/network-manager-fortisslvpn.metainfo.xml.in:32 +#: appdata/network-manager-fortisslvpn.metainfo.xml.in:33 msgid "The advanced options dialog" msgstr "Диалог расширенных параметров" -#: appdata/network-manager-fortisslvpn.metainfo.xml.in:41 +#: appdata/network-manager-fortisslvpn.metainfo.xml.in:42 msgid "The NetworkManager Developers" msgstr "Разработчики NetworkManager" @@ -266,17 +266,16 @@ msgid "_One time password" msgstr "Одноразовый _пароль" #: properties/nm-fortisslvpn-dialog.ui:185 -#, fuzzy msgid "Advanced Properties" -msgstr "Расширенные параметры SSLVPN" +msgstr "Дополнительные свойства" #: properties/nm-fortisslvpn-dialog.ui:193 msgid "_Cancel" -msgstr "" +msgstr "_Отменить" #: properties/nm-fortisslvpn-dialog.ui:201 msgid "_Apply" -msgstr "" +msgstr "_Применить" #: properties/nm-fortisslvpn-dialog.ui:253 msgid "Show password" diff --git a/src/nm-fortisslvpn-pppd-compat.h b/src/nm-fortisslvpn-pppd-compat.h new file mode 100644 index 0000000..5d2d02a --- /dev/null +++ b/src/nm-fortisslvpn-pppd-compat.h @@ -0,0 +1,123 @@ +/* Copyright (C) 2023 Eivind Naess, eivnaes@yahoo.com */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __NM_FORTISSLVPN_PPPD_COMPAT_H__ +#define __NM_FORTISSLVPN_PPPD_COMPAT_H__ + +/* Define INET6 to compile with IPv6 support against older pppd headers, + * pppd >= 2.5.0 use WITH_PPP_IPV6 and is defined in pppdconf.h */ +#define INET6 1 + +/* PPP < 2.5.0 defines and exports VERSION which overlaps with current package VERSION define. + * this silly macro magic is to work around that. */ +#undef VERSION +#include + +#ifndef PPPD_VERSION +#define PPPD_VERSION VERSION +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_PPPD_CHAP_H +#include +#endif + +#ifdef HAVE_PPPD_CHAP_NEW_H +#include +#endif + +#ifdef HAVE_PPPD_CHAP_MS_H +#include +#endif + +#ifndef PPP_PROTO_CHAP +#define PPP_PROTO_CHAP 0xc223 +#endif + +#ifndef PPP_PROTO_EAP +#define PPP_PROTO_EAP 0xc227 +#endif + + +#if WITH_PPP_VERSION < PPP_VERSION(2,5,0) + +static inline bool +debug_on (void) +{ + return debug; +} + +static inline const char +*ppp_ipparam (void) +{ + return ipparam; +} + +static inline int +ppp_ifunit (void) +{ + return ifunit; +} + +static inline const char * +ppp_ifname (void) +{ + return ifname; +} + +static inline int +ppp_get_mtu (int idx) +{ + return netif_get_mtu(idx); +} + +typedef enum ppp_notify +{ + NF_PID_CHANGE, + NF_PHASE_CHANGE, + NF_EXIT, + NF_SIGNALED, + NF_IP_UP, + NF_IP_DOWN, + NF_IPV6_UP, + NF_IPV6_DOWN, + NF_AUTH_UP, + NF_LINK_DOWN, + NF_FORK, + NF_MAX_NOTIFY +} ppp_notify_t; + +typedef void (ppp_notify_fn) (void *ctx, int arg); + +static inline void +ppp_add_notify (ppp_notify_t type, ppp_notify_fn *func, void *ctx) +{ + struct notifier **list[NF_MAX_NOTIFY] = { + [NF_PID_CHANGE ] = &pidchange, + [NF_PHASE_CHANGE] = &phasechange, + [NF_EXIT ] = &exitnotify, + [NF_SIGNALED ] = &sigreceived, + [NF_IP_UP ] = &ip_up_notifier, + [NF_IP_DOWN ] = &ip_down_notifier, + [NF_IPV6_UP ] = &ipv6_up_notifier, + [NF_IPV6_DOWN ] = &ipv6_down_notifier, + [NF_AUTH_UP ] = &auth_up_notifier, + [NF_LINK_DOWN ] = &link_down_notifier, + [NF_FORK ] = &fork_notifier, + }; + + struct notifier **notify = list[type]; + if (notify) { + add_notifier(notify, func, ctx); + } +} + +#endif /* #if WITH_PPP_VERSION < PPP_VERSION(2,5,0) */ +#endif /* #ifdef __NM_FORTISSLVPN_PPPD_COMPAT_H__ */ diff --git a/src/nm-fortisslvpn-pppd-plugin.c b/src/nm-fortisslvpn-pppd-plugin.c index f2ad262..0f1c687 100644 --- a/src/nm-fortisslvpn-pppd-plugin.c +++ b/src/nm-fortisslvpn-pppd-plugin.c @@ -23,12 +23,6 @@ #define ___CONFIG_H__ #include -#include -#include -#include - -#include "nm-default.h" - #include #include #include @@ -42,10 +36,12 @@ #include #include +#include "nm-fortisslvpn-pppd-status.h" +#include "nm-fortisslvpn-pppd-compat.h" #include "nm-fortisslvpn-pppd-service-dbus.h" -#include "nm-fortisslvpn-service.h" -#include "nm-ppp-status.h" +#include "nm-default.h" +#include "nm-fortisslvpn-service.h" #include "nm-utils/nm-shared-utils.h" #include "nm-utils/nm-vpn-plugin-macros.h" @@ -80,7 +76,7 @@ static struct { int plugin_init (void); -char pppd_version[] = VERSION; +char pppd_version[] = PPPD_VERSION; static void chroot_sandbox (void) @@ -296,7 +292,7 @@ get_ip4_routes (in_addr_t ouraddr) static void nm_ip_up (void *data, int arg) { - guint32 pppd_made_up_address = htonl (0x0a404040 + ifunit); + guint32 pppd_made_up_address = htonl (0x0a404040 + ppp_ifunit()); ipcp_options opts = ipcp_gotoptions[0]; ipcp_options peer_opts = ipcp_hisoptions[0]; GVariantBuilder builder; @@ -317,7 +313,7 @@ nm_ip_up (void *data, int arg) g_variant_builder_add (&builder, "{sv}", NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV, - g_variant_new_string (ifname)); + g_variant_new_string (ppp_ifname())); str = g_getenv ("VPN_GATEWAY"); if (str) { @@ -442,8 +438,8 @@ plugin_init (void) return -1; } - add_notifier (&phasechange, nm_phasechange, NULL); - add_notifier (&ip_up_notifier, nm_ip_up, NULL); - add_notifier (&exitnotify, nm_exit_notify, NULL); + ppp_add_notify (NF_PHASE_CHANGE, nm_phasechange, NULL); + ppp_add_notify (NF_IP_UP, nm_ip_up, NULL); + ppp_add_notify (NF_EXIT, nm_exit_notify, NULL); return 0; } diff --git a/src/nm-fortisslvpn-pppd-status.h b/src/nm-fortisslvpn-pppd-status.h new file mode 100644 index 0000000..4535099 --- /dev/null +++ b/src/nm-fortisslvpn-pppd-status.h @@ -0,0 +1,42 @@ +/* nm-fortisslvpn-service - SSLVPN integration with NetworkManager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * (C) Copyright 2015 Lubomir Rintel + * (C) Copyright 2007 - 2008 Novell, Inc. + */ + +#ifndef NM_PPP_STATUS_H +#define NM_PPP_STATUS_H + +typedef enum { + NM_PPP_STATUS_UNKNOWN, + + NM_PPP_STATUS_DEAD, + NM_PPP_STATUS_INITIALIZE, + NM_PPP_STATUS_SERIALCONN, + NM_PPP_STATUS_DORMANT, + NM_PPP_STATUS_ESTABLISH, + NM_PPP_STATUS_AUTHENTICATE, + NM_PPP_STATUS_CALLBACK, + NM_PPP_STATUS_NETWORK, + NM_PPP_STATUS_RUNNING, + NM_PPP_STATUS_TERMINATE, + NM_PPP_STATUS_DISCONNECT, + NM_PPP_STATUS_HOLDOFF, + NM_PPP_STATUS_MASTER +} NMPPPStatus; + +#endif /* NM_PPP_STATUS_H */ diff --git a/src/nm-fortisslvpn-service.c b/src/nm-fortisslvpn-service.c index 6c340d0..a8483c2 100644 --- a/src/nm-fortisslvpn-service.c +++ b/src/nm-fortisslvpn-service.c @@ -40,7 +40,7 @@ #include #include "nm-fortissl-properties.h" -#include "nm-ppp-status.h" +#include "nm-fortisslvpn-pppd-status.h" #include "nm-fortisslvpn-pppd-service-dbus.h" #include "nm-utils/nm-shared-utils.h" #include "nm-utils/nm-vpn-plugin-macros.h" diff --git a/src/nm-ppp-status.h b/src/nm-ppp-status.h deleted file mode 100644 index 4535099..0000000 --- a/src/nm-ppp-status.h +++ /dev/null @@ -1,42 +0,0 @@ -/* nm-fortisslvpn-service - SSLVPN integration with NetworkManager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * (C) Copyright 2015 Lubomir Rintel - * (C) Copyright 2007 - 2008 Novell, Inc. - */ - -#ifndef NM_PPP_STATUS_H -#define NM_PPP_STATUS_H - -typedef enum { - NM_PPP_STATUS_UNKNOWN, - - NM_PPP_STATUS_DEAD, - NM_PPP_STATUS_INITIALIZE, - NM_PPP_STATUS_SERIALCONN, - NM_PPP_STATUS_DORMANT, - NM_PPP_STATUS_ESTABLISH, - NM_PPP_STATUS_AUTHENTICATE, - NM_PPP_STATUS_CALLBACK, - NM_PPP_STATUS_NETWORK, - NM_PPP_STATUS_RUNNING, - NM_PPP_STATUS_TERMINATE, - NM_PPP_STATUS_DISCONNECT, - NM_PPP_STATUS_HOLDOFF, - NM_PPP_STATUS_MASTER -} NMPPPStatus; - -#endif /* NM_PPP_STATUS_H */