Merge branch 'maemo-bye-bye'

Removes the code and helper files related to the unused and unmaintained
Maemo port.
This commit is contained in:
Tobias Brunner
2016-09-15 18:38:48 +02:00
55 changed files with 1 additions and 3375 deletions
-12
View File
@@ -262,7 +262,6 @@ ARG_ENABL_SET([ha], [enable high availability cluster plugin.])
ARG_ENABL_SET([led], [enable plugin to control LEDs on IKEv2 activity using the Linux kernel LED subsystem.])
ARG_ENABL_SET([load-tester], [enable load testing plugin for IKEv2 daemon.])
ARG_ENABL_SET([lookip], [enable fast virtual IP lookup and notification plugin.])
ARG_ENABL_SET([maemo], [enable Maemo specific plugin.])
ARG_ENABL_SET([radattr], [enable plugin to inject and process custom RADIUS attributes as IKEv2 client.])
ARG_ENABL_SET([systime-fix], [enable plugin to handle cert lifetimes with invalid system time gracefully.])
ARG_ENABL_SET([test-vectors], [enable plugin providing crypto test vectors.])
@@ -1140,14 +1139,6 @@ if test x$android_dns = xtrue; then
AC_SUBST(DLLIB)
fi
if test x$maemo = xtrue; then
PKG_CHECK_MODULES(maemo, [glib-2.0 gthread-2.0 libosso osso-af-settings])
AC_SUBST(maemo_CFLAGS)
AC_SUBST(maemo_LIBS)
dbusservicedir="/usr/share/dbus-1/system-services"
AC_SUBST(dbusservicedir)
fi
if test x$eap_sim_pcsc = xtrue; then
PKG_CHECK_MODULES(pcsclite, [libpcsclite])
AC_SUBST(pcsclite_CFLAGS)
@@ -1447,7 +1438,6 @@ ADD_PLUGIN([led], [c charon])
ADD_PLUGIN([duplicheck], [c charon])
ADD_PLUGIN([coupling], [c charon])
ADD_PLUGIN([radattr], [c charon])
ADD_PLUGIN([maemo], [c charon])
ADD_PLUGIN([uci], [c charon])
ADD_PLUGIN([addrblock], [c charon])
ADD_PLUGIN([unity], [c charon])
@@ -1542,7 +1532,6 @@ AM_CONDITIONAL(USE_OSX_ATTR, test x$osx_attr = xtrue)
AM_CONDITIONAL(USE_P_CSCF, test x$p_cscf = xtrue)
AM_CONDITIONAL(USE_ANDROID_DNS, test x$android_dns = xtrue)
AM_CONDITIONAL(USE_ANDROID_LOG, test x$android_log = xtrue)
AM_CONDITIONAL(USE_MAEMO, test x$maemo = xtrue)
AM_CONDITIONAL(USE_SMP, test x$smp = xtrue)
AM_CONDITIONAL(USE_SQL, test x$sql = xtrue)
AM_CONDITIONAL(USE_DNSCERT, test x$dnscert = xtrue)
@@ -1891,7 +1880,6 @@ AC_CONFIG_FILES([
src/libcharon/plugins/p_cscf/Makefile
src/libcharon/plugins/android_dns/Makefile
src/libcharon/plugins/android_log/Makefile
src/libcharon/plugins/maemo/Makefile
src/libcharon/plugins/stroke/Makefile
src/libcharon/plugins/vici/Makefile
src/libcharon/plugins/vici/ruby/Makefile
-37
View File
@@ -1,37 +0,0 @@
SOURCE:=../../src/frontends/maemo
BUILD:=build
VERSION:=$(shell sed -n 's/AC_INIT(.*,\s*\(.*\))/\1/p' $(SOURCE)/configure.ac)
TARGETVERSION:=$(VERSION)
ORIGNAME:=strongswan-applet-$(VERSION)
ORIGSRC:=$(BUILD)/strongswan-applet_$(TARGETVERSION).orig.tar.gz
package: $(ORIGSRC) prepare
cd $(BUILD)/$(ORIGNAME) && \
dpkg-buildpackage -rfakeroot -sa > /dev/null
source: $(ORIGSRC) prepare
cd $(BUILD)/$(ORIGNAME) && \
dpkg-buildpackage -rfakeroot -sa -S > /dev/null
prepare:
debchange -b -v $(TARGETVERSION)-1
cp -R debian $(BUILD)/$(ORIGNAME)
$(ORIGSRC): $(SOURCE)/Makefile | $(BUILD)
make -j -C $(SOURCE) dist-gzip > /dev/null
mv $(SOURCE)/$(ORIGNAME).tar.gz $(ORIGSRC)
tar -zx -C $(BUILD) -f $(ORIGSRC)
$(SOURCE)/Makefile: $(SOURCE)/configure
cd $(SOURCE) && ./configure > /dev/null
$(SOURCE)/configure: $(SOURCE)/configure.ac
cd $(SOURCE) && ./autogen.sh > /dev/null
$(BUILD):
mkdir -p $(BUILD)
clean:
rm -Rf $(BUILD)
.PHONY: package source prepare clean
-5
View File
@@ -1,5 +0,0 @@
files
strongswan-applet.postinst.debhelper
strongswan-applet.postrm.debhelper
strongswan-applet.substvars
strongswan-applet/
-18
View File
@@ -1,18 +0,0 @@
strongswan-applet (1.0.1-2) unstable; urgency=low
* Exclude static libraries from package
-- Tobias Brunner <[email protected]> Tue, 08 Feb 2011 16:15:07 +0100
strongswan-applet (1.0.1-1) unstable; urgency=low
* New upstream release
-- Tobias Brunner <[email protected]> Mon, 07 Feb 2011 10:34:53 +0100
strongswan-applet (1.0.0-1) unstable; urgency=low
* Initial release
-- Tobias Brunner <[email protected]> Fri, 4 Jun 2010 11:02:47 +0200
-1
View File
@@ -1 +0,0 @@
5
-79
View File
@@ -1,79 +0,0 @@
Source: strongswan-applet
Section: user/network
Priority: extra
Maintainer: Tobias Brunner <[email protected]>
Build-Depends: debhelper (>= 5), autotools-dev, libhildon1-dev,
libhildonfm2-dev, hildon-control-panel-dev,
libhildondesktop1-dev, osso-af-settings
Standards-Version: 3.7.2
Homepage: http://www.strongswan.org
Package: strongswan-applet
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, strongswan
Description: A frontend for the strongSwan IPsec VPN solution
A frontend to configure and control the strongSwan
IPsec VPN solution. Currently only IKEv2 with EAP
authentication (username/password) is supported.
XSBC-Maemo-Display-Name: strongSwan IPsec VPN Applet
XSBC-Bugtracker: http://wiki.strongswan.org/projects/strongswan/issues
XB-Maemo-Icon-26:
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABL2lDQ1BJQ0Mg
cHJvZmlsZQAAeNqtkbFKw1AUhr8bRcWhVgji4HAnUVBs1cGMSVuKIFirQ5Kt
SUOV0iTc3Kp9CEe3Di7uPoGTo+Cg+AS+geLUwSFIcBLBb/rOz+Fw4AejYted
hlGGQaxVu+lI1/Pl7BMzTAFAJ8xSu9U6AIiTOOInAj5fEQDPm3bdafA35sNU
aWACbHejLARRAfoXOtUgxoAZ9FMN4g4w1Um7BuIBKPVyfwFKQe5vQEm5ng/i
A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R//Ae7UrBoAhLHUAAAAAElFTkSuQmCC
-8
View File
@@ -1,8 +0,0 @@
Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=437
Upstream-Name: strongSwan
Upstream-Source: http://download.strongswan.org
Files: debian/*
License: GPL-2
On Debian systems the full text of the GNU General Public License can be found
in the `/usr/share/common-licenses/GPL-2' file.
-44
View File
@@ -1,44 +0,0 @@
#!/bin/sh
# postinst script for strongswan-applet
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
gtk-update-icon-cache -f /usr/share/icons/hicolor
# change event is not triggered otherwise
touch /usr/share/icons/hicolor
case "$1" in
configure)
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
-122
View File
@@ -1,122 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets by Bill Allombert 2001
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
# Use hardware floating point
ifneq (,$(findstring vfp,$(DEB_BUILD_OPTIONS)))
CFLAGS += -mfpu=vfp -mfloat-abi=softfp
endif
config.status: configure
dh_testdir
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
#Architecture
build: build-arch build-indep
build-arch: build-arch-stamp
build-arch-stamp: config.status
$(MAKE)
touch $@
build-indep: build-indep-stamp
build-indep-stamp: config.status
# Add here commands to compile the indep part of the package.
#$(MAKE) doc
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
-$(MAKE) distclean
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
cp -f /usr/share/misc/config.guess config.guess
endif
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
dh_install --list-missing --sourcedir=debian/tmp
# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
dh_testdir
dh_testroot
dh_installchangelogs NEWS
dh_installdocs
dh_installexamples
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
# Build architecture independent packages using the common target.
binary-indep: build-indep install
$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
# Build architecture dependent packages using the common target.
binary-arch: build-arch install
$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install
@@ -1 +0,0 @@
3.0 (quilt)
@@ -1,7 +0,0 @@
# libraries
usr/lib/hildon-control-panel/libstrongswan-settings.so*
usr/lib/hildon-desktop/libstrongswan-status.so*
# *.desktop files
usr/share/applications
# icons
usr/share/icons/hicolor
-38
View File
@@ -1,38 +0,0 @@
SOURCE:=../../
BUILD:=build
VERSION:=$(shell sed -n 's/AC_INIT(.*,\s*\(.*\))/\1/p' $(SOURCE)/configure.in)
TARGETVERSION:=$(VERSION)
ORIGNAME:=strongswan-$(VERSION)
ORIGSRC:=$(BUILD)/strongswan_$(TARGETVERSION).orig.tar.gz
package: prepare
cd $(BUILD)/$(ORIGNAME) && \
dpkg-buildpackage -rfakeroot -sa > /dev/null
source: prepare
cd $(BUILD)/$(ORIGNAME) && \
dpkg-buildpackage -rfakeroot -sa -S > /dev/null
prepare: $(ORIGSRC)
rm -Rf $(BUILD)/$(ORIGNAME)
tar -zx -C $(BUILD) -f $(ORIGSRC)
debchange -b -v $(TARGETVERSION)-1
cp -R debian $(BUILD)/$(ORIGNAME)
$(ORIGSRC): $(SOURCE)/Makefile | $(BUILD)
make -j -C $(SOURCE) dist-gzip > /dev/null
mv $(SOURCE)/$(ORIGNAME).tar.gz $(ORIGSRC)
$(SOURCE)/Makefile: $(SOURCE)/configure
cd $(SOURCE) && ./configure --disable-gmp > /dev/null
$(SOURCE)/configure: $(SOURCE)/configure.in
cd $(SOURCE) && ./autogen.sh > /dev/null
$(BUILD):
mkdir -p $(BUILD)
clean:
rm -Rf $(BUILD)
.PHONY: package source prepare clean
@@ -1,49 +0,0 @@
strongswan (4.6.2-1) unstable; urgency=low
* New upstream release
-- Tobias Brunner <[email protected]> Mon, 27 Feb 2012 17:29:05 +0100
strongswan (4.6.0-1) unstable; urgency=low
* New upstream release
-- Tobias Brunner <[email protected]> Mon, 07 Nov 2011 14:01:45 +0100
strongswan (4.5.3-1) unstable; urgency=low
* New upstream release
-- Tobias Brunner <[email protected]> Fri, 05 Aug 2011 10:53:10 +0200
strongswan (4.5.2-1) unstable; urgency=low
* New upstream release
-- Tobias Brunner <[email protected]> Mon, 16 May 2011 13:10:30 +0200
strongswan (4.5.1-1) unstable; urgency=low
* New upstream release
-- Tobias Brunner <[email protected]> Fri, 11 Feb 2011 10:35:41 +0100
strongswan (4.5.0+4.5.1rc2-2) unstable; urgency=low
* Exclude static libraries from package
* Use automatic optification
-- Tobias Brunner <[email protected]> Tue, 08 Feb 2011 12:23:40 +0100
strongswan (4.5.0+4.5.1rc2-1) unstable; urgency=low
* New upstream release
-- Tobias Brunner <[email protected]> Mon, 07 Feb 2011 10:38:33 +0100
strongswan (4.5.0-1) unstable; urgency=low
* Initial release
-- Tobias Brunner <[email protected]> Thu, 14 Oct 2010 17:31:43 +0200
-1
View File
@@ -1 +0,0 @@
5
-120
View File
@@ -1,120 +0,0 @@
Source: strongswan
Section: user/network
Priority: extra
Maintainer: Tobias Brunner <[email protected]>
Build-Depends: debhelper (>= 5), autotools-dev, libssl-dev (>= 0.9.8),
libglib2.0-dev, libosso-dev, osso-af-settings
Standards-Version: 3.7.2
Homepage: http://www.strongswan.org
Package: strongswan
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, kernel-power (>= 2.6.28-maemo42)
Suggests: strongswan-applet
Description: strongSwan IPsec VPN
strongSwan is an IPsec-based VPN solution.
XSBC-Maemo-Display-Name: strongSwan IPsec VPN
XSBC-Bugtracker: http://wiki.strongswan.org/projects/strongswan/issues
XB-Maemo-Icon-26:
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABL2lDQ1BJQ0Mg
cHJvZmlsZQAAeNqtkbFKw1AUhr8bRcWhVgji4HAnUVBs1cGMSVuKIFirQ5Kt
SUOV0iTc3Kp9CEe3Di7uPoGTo+Cg+AS+geLUwSFIcBLB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gTISt+z+8nrK9ok431nPKXY9k
O+8xM1Jn+7KBABK9YxF8UMxiEu1EpIVe82amXdepkJOiYgqIIdIbrIhhMoA0
6adn/QgSkN0qfRjQru+7AuwmehhoN9QI+ziB5JxfhuBNNSXn+pks/TQxdV27
0x3WNEx4McwExIZZrAxzv36m2ieGw993ps3rYSXIUMCw41b795op6epDAOsR
UxKhybJgSVPyqiklTc45bdvW1nsBmA5416WzWZ8yC30QQ3oBZc/PO2W27NKF
3XG3rV+8ZuU+e3Mhy7yCtHmWEVNSTarJp6TqbBjpANRmxKEAuvJaU0J2CbMW
ild0CmR4VvdS6r+5hr3qIZj+7LYKwC+//hdD10WZLxbWNI0ulyu7eOnFvTvU
w8i7BHKgGO7ZnuUHAf1Qa+8OzHfHsXrlKLb/B49hrUex7doLXo0AYTjB5Jy4
LARTVXvuzNYr1TO7mpf9X1we4NzzL3D0husxHE89/QPj/9H1X/YEXFQL/X68
AAAAAElFTkSuQmCC
@@ -1,8 +0,0 @@
Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=437
Upstream-Name: strongSwan
Upstream-Source: http://download.strongswan.org
Files: debian/*
License: GPL-2
On Debian systems the full text of the GNU General Public License can be found
in the `/usr/share/common-licenses/GPL-2' file.
-1
View File
@@ -1 +0,0 @@
auto
@@ -1,25 +0,0 @@
Adding maemo specific logger config (as there is no syslog daemon by default).
--- a/src/strongswan.conf
+++ b/src/strongswan.conf
@@ -5,6 +5,21 @@
retransmit_timeout = 3.0
retransmit_base = 1.4
+ # maemo specific logging
+ filelog {
+ /var/log/charon.log {
+ time_format = %b %e %T
+ append = no
+ default = 1
+ flush_line = yes
+ }
+ }
+ # there is no syslog daemon installed by default
+ syslog {
+ daemon {
+ }
+ }
+
# number of worker threads in charon
threads = 16
@@ -1,13 +0,0 @@
llabs is defined in C99. features.h on other platforms enables C99 features
automatically, here we explicitly enable them with _GNU_SOURCE (which enables
also a lot of other things).
--- a/src/libstrongswan/utils.c
+++ b/src/libstrongswan/utils.c
@@ -14,6 +14,7 @@
* for more details.
*/
+#define _GNU_SOURCE
#include "utils.h"
#include <sys/stat.h>
@@ -1,3 +0,0 @@
shorter-timeout.patch
configure-logging.patch
llabs-needs-c99.patch
@@ -1,13 +0,0 @@
Make timeouts shorter which is more appropriate for client only use.
--- a/src/strongswan.conf
+++ b/src/strongswan.conf
@@ -1,6 +1,9 @@
# strongswan.conf - strongSwan configuration file
charon {
+ # shorter timeouts (defaults are 4.0/1.8)
+ retransmit_timeout = 3.0
+ retransmit_base = 1.4
# number of worker threads in charon
threads = 16
-142
View File
@@ -1,142 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets by Bill Allombert 2001
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CONFIG_OPTIONS = \
--prefix=/usr --sysconfdir=/etc \
--disable-scepclient --disable-pki --disable-scripts \
--disable-fips-prf --disable-pubkey --disable-attr \
--disable-constraints --disable-revocation \
--disable-sha1 --disable-sha2 --disable-aes --disable-des \
--disable-md5 --disable-gmp --disable-pgp --disable-dnskey \
--enable-openssl --enable-monolithic --enable-eap-identity \
--enable-eap-md5 --enable-eap-mschapv2 --enable-maemo
CFLAGS = -Wall -g -Wno-format -Wno-pointer-sign -Wno-strict-aliasing -Wno-sign-compare -Wno-unused-parameter
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKEFLAGS += -j$(NUMJOBS)
endif
# Use hardware floating point
ifneq (,$(findstring vfp,$(DEB_BUILD_OPTIONS)))
CFLAGS += -mfpu=vfp -mfloat-abi=softfp
endif
config.status: configure
dh_testdir
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info $(CONFIG_OPTIONS) CFLAGS="$(CFLAGS)"
#LDFLAGS="-Wl,-z,defs"
#Architecture
build: build-arch build-indep
build-arch: build-arch-stamp
build-arch-stamp: config.status
$(MAKE)
touch $@
build-indep: build-indep-stamp
build-indep-stamp: config.status
# Add here commands to compile the indep part of the package.
#$(MAKE) doc
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
-$(MAKE) distclean
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
cp -f /usr/share/misc/config.guess config.guess
endif
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
dh_install --list-missing --sourcedir=debian/tmp
# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
dh_testdir
dh_testroot
dh_installchangelogs NEWS
dh_installdocs
dh_installexamples
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
# Build architecture independent packages using the common target.
binary-indep: build-indep install
$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
# Build architecture dependent packages using the common target.
binary-arch: build-arch install
$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install
@@ -1 +0,0 @@
3.0 (quilt)
@@ -1,28 +0,0 @@
# config
etc
# libraries
usr/lib/ipsec/libstrongswan.so*
usr/lib/ipsec/libcharon.so*
# starter etc.
usr/sbin/ipsec
usr/libexec/ipsec/starter
usr/libexec/ipsec/_copyright
usr/share/man/man8/ipsec.8
usr/share/man/man5/ipsec.conf.5
usr/share/man/man5/ipsec.secrets.5
# updown
usr/libexec/ipsec/_updown
usr/libexec/ipsec/_updown_espmark
usr/share/man/man8/_updown.8
usr/share/man/man8/_updown_espmark.8
# charon
usr/share/dbus-1/system-services
usr/libexec/ipsec/charon
usr/libexec/ipsec/stroke
usr/share/man/man5/strongswan.conf.5
# pluto
usr/libexec/ipsec/pluto
usr/libexec/ipsec/_pluto_adns
usr/libexec/ipsec/whack
usr/lib/ipsec/plugins/libstrongswan-xauth.so*
usr/share/man/man8/pluto.8
+1 -1
View File
@@ -32,7 +32,7 @@ printf-builtin)
all)
CONFIG="--enable-all --disable-android-dns --disable-android-log
--disable-dumm --disable-kernel-pfroute --disable-keychain
--disable-lock-profiler --disable-maemo --disable-padlock
--disable-lock-profiler --disable-padlock
--disable-osx-attr --disable-tkm --disable-uci
--disable-systemd --disable-soup --disable-unwind-backtraces
--disable-svc --disable-dbghelp-backtraces --disable-socket-win
-2
View File
@@ -1,2 +0,0 @@
build-arch-stamp
build-indep-stamp
View File
View File
-3
View File
@@ -1,3 +0,0 @@
SUBDIRS = src data
-4
View File
@@ -1,4 +0,0 @@
strongswan-applet-1.0.0
-----------------------
- Initial release
View File
-5
View File
@@ -1,5 +0,0 @@
#!/bin/sh
libtoolize --force &&
aclocal &&
automake -a &&
autoconf
-54
View File
@@ -1,54 +0,0 @@
AC_INIT(strongswan-applet, 1.0.1)
AM_INIT_AUTOMAKE
# Programs
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
# Headers
AC_HEADER_STDC
# Library dependencies
PKG_CHECK_MODULES(HILDON, hildon-1 hildon-fm-2 hildon-control-panel libhildondesktop-1)
AC_SUBST(HILDON_CFLAGS)
AC_SUBST(HILDON_LIBS)
PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.60)
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
PKG_CHECK_MODULES(OSSO, osso-af-settings >= 0.8.5 libosso >= 0.9.17 gnome-vfs-2.0 >= 2.8.4.11 gnome-vfs-module-2.0 >= 2.8.4.11)
AC_SUBST(OSSO_CFLAGS)
AC_SUBST(OSSO_LIBS)
# Application icon install directories
icon_18x18dir=$datadir/icons/hicolor/18x18/hildon
icon_24x24dir=$datadir/icons/hicolor/24x24/hildon
icon_32x32dir=$datadir/icons/hicolor/32x32/hildon
icon_48x48dir=$datadir/icons/hicolor/48x48/hildon
icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
# Hildon control panel plugin install directories
pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=pluginlibdir`
plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
# Hildon status widget install directories
statuslibdir=`$PKG_CONFIG libhildondesktop-1 --variable=hildondesktoplibdir`
statusdesktopentrydir=`$PKG_CONFIG libhildondesktop-1 --variable=hildonstatusmenudesktopentrydir`
AC_SUBST(icon_18x18dir)
AC_SUBST(icon_24x24dir)
AC_SUBST(icon_32x32dir)
AC_SUBST(icon_48x48dir)
AC_SUBST(icon_scalabledir)
AC_SUBST(pluginlibdir)
AC_SUBST(plugindesktopentrydir)
AC_SUBST(statuslibdir)
AC_SUBST(statusdesktopentrydir)
AC_OUTPUT(
Makefile \
src/Makefile \
data/Makefile
)
-15
View File
@@ -1,15 +0,0 @@
plugindesktopentry_DATA = strongswan-settings.desktop
statusdesktopentry_DATA = strongswan-status.desktop
icon_18x18_DATA = \
icons/18x18/strongswan_lock_open.png \
icons/18x18/strongswan_lock_close.png
icon_48x48_DATA = \
icons/48x48/strongswan_lock_open.png \
icons/48x48/strongswan_lock_close.png
EXTRA_DIST = \
$(plugindesktopentry_DATA) $(statusdesktopentry_DATA) \
$(icon_18x18_DATA) $(icon_48x48_DATA)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

@@ -1,9 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=strongSwan VPN
Comment=A control panel applet to configure strongSwan VPN
Type=HildonControlPanelPlugin
Icon=strongswan_lock_close
Categories=connectivity
X-control-panel-plugin=libstrongswan-settings.so
@@ -1,9 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=strongSwan Status
Comment=A status menu widget to control strongSwan
Type=default
Icon=strongswan_lock_close
Category=permanent
X-Path=libstrongswan-status.so
-21
View File
@@ -1,21 +0,0 @@
statuslib_LTLIBRARIES = libstrongswan-status.la
libstrongswan_status_la_SOURCES = \
strongswan-status.c strongswan-status.h \
strongswan-connection.c strongswan-connection.h \
strongswan-connections.c strongswan-connections.h
libstrongswan_status_la_LIBADD = $(HILDON_LIBS) $(DBUS_LIBS) $(OSSO_LIBS)
libstrongswan_status_la_CFLAGS = -DUSE_DYNAMIC_TYPES \
$(HILDON_CFLAGS) $(DBUS_CFLAGS) $(OSSO_CFLAGS)
libstrongswan_status_la_LDFLAGS = -module -avoid-version
pluginlib_LTLIBRARIES = libstrongswan-settings.la
libstrongswan_settings_la_SOURCES = \
strongswan-settings.c \
strongswan-connection.c strongswan-connection.h \
strongswan-connections.c strongswan-connections.h
libstrongswan_settings_la_LIBADD = $(HILDON_LIBS)
libstrongswan_settings_la_CFLAGS = $(HILDON_CFLAGS)
libstrongswan_settings_la_LDFLAGS = -module -avoid-version
@@ -1,260 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#include <string.h>
#include "strongswan-connection.h"
#define STRONGSWAN_CONNECTION_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
STRONGSWAN_TYPE_CONNECTION, \
StrongswanConnectionPrivate))
struct _StrongswanConnectionPrivate
{
gchar *orig_name;
gchar *name;
gchar *host;
gchar *cert;
gchar *user;
};
enum
{
PROP_0,
PROP_NAME,
PROP_HOST,
PROP_CERT,
PROP_USER,
};
#ifndef USE_DYNAMIC_TYPES
G_DEFINE_TYPE (StrongswanConnection, strongswan_connection, G_TYPE_OBJECT);
#else
G_DEFINE_DYNAMIC_TYPE (StrongswanConnection, strongswan_connection, G_TYPE_OBJECT);
void strongswan_connection_register (GTypeModule *type_module)
{
strongswan_connection_register_type (type_module);
}
#endif
static void
strongswan_connection_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
StrongswanConnectionPrivate *priv = STRONGSWAN_CONNECTION (object)->priv;
switch (prop_id)
{
case PROP_NAME:
g_value_set_string (value, priv->name);
break;
case PROP_HOST:
g_value_set_string (value, priv->host);
break;
case PROP_CERT:
g_value_set_string (value, priv->cert);
break;
case PROP_USER:
g_value_set_string (value, priv->user);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
strongswan_connection_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
StrongswanConnectionPrivate *priv = STRONGSWAN_CONNECTION (object)->priv;
switch (prop_id)
{
case PROP_NAME:
g_free (priv->name);
priv->name = g_value_dup_string (value);
case PROP_HOST:
g_free (priv->host);
priv->host = g_value_dup_string (value);
break;
case PROP_CERT:
g_free (priv->cert);
priv->cert = g_value_dup_string (value);
break;
case PROP_USER:
g_free (priv->user);
priv->user = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
strongswan_connection_init (StrongswanConnection *connection)
{
connection->priv = STRONGSWAN_CONNECTION_GET_PRIVATE (connection);
}
static void
strongswan_connection_dispose (GObject *object)
{
G_OBJECT_CLASS (strongswan_connection_parent_class)->dispose (object);
}
static void
strongswan_connection_finalize (GObject *object)
{
StrongswanConnectionPrivate *priv = STRONGSWAN_CONNECTION (object)->priv;
g_free (priv->orig_name);
g_free (priv->name);
g_free (priv->host);
g_free (priv->cert);
g_free (priv->user);
G_OBJECT_CLASS (strongswan_connection_parent_class)->finalize (object);
}
static void
strongswan_connection_class_init (StrongswanConnectionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = strongswan_connection_get_property;
object_class->set_property = strongswan_connection_set_property;
object_class->dispose = strongswan_connection_dispose;
object_class->finalize = strongswan_connection_finalize;
g_object_class_install_property (object_class, PROP_NAME,
g_param_spec_string ("name", "Connection name",
"The unique name of a connection",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_HOST,
g_param_spec_string ("host", "Hostname or IP address",
"The hostname or IP address of the Gateway",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_CERT,
g_param_spec_string ("cert", "Gateway or CA certificate",
"The certificate of the gateway or the CA",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_USER,
g_param_spec_string ("user", "Username",
"The username for EAP authentication",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_type_class_add_private (klass, sizeof (StrongswanConnectionPrivate));
}
#ifdef USE_DYNAMIC_TYPES
static void
strongswan_connection_class_finalize (StrongswanConnectionClass *klass)
{
}
#endif
static inline gchar *
get_string_from_key_file (GKeyFile *key_file,
const gchar *name,
const gchar *key)
{
GError *error = NULL;
gchar *value;
value = g_key_file_get_string (key_file, name, key, &error);
if (error)
{
g_warning ("Failed to read %s/%s from key file: %s",
name, key, error->message);
g_error_free (error);
}
return value;
}
static void
strongswan_connection_update_from_key_file (GKeyFile *key_file,
StrongswanConnection *connection)
{
StrongswanConnectionPrivate *priv = connection->priv;
gchar *name = priv->name;
priv->orig_name = g_strdup (name);
priv->host = get_string_from_key_file (key_file, name, "host");
priv->cert = get_string_from_key_file (key_file, name, "cert");
priv->user = get_string_from_key_file (key_file, name, "user");
}
StrongswanConnection *
strongswan_connection_new (const gchar *name)
{
StrongswanConnection *conn;
conn = g_object_new (STRONGSWAN_TYPE_CONNECTION,
"name", name,
NULL);
g_return_val_if_fail (conn->priv != NULL, NULL);
return conn;
}
StrongswanConnection *
strongswan_connection_new_from_key_file (GKeyFile *key_file,
const gchar *name)
{
StrongswanConnection *conn = strongswan_connection_new (name);
g_return_val_if_fail (conn != NULL, NULL);
strongswan_connection_update_from_key_file (key_file, conn);
return conn;
}
void
strongswan_connection_save_to_key_file (GKeyFile *key_file,
StrongswanConnection *connection)
{
StrongswanConnectionPrivate *priv = connection->priv;
gchar *name = priv->name;
if (priv->orig_name && strcmp (name, priv->orig_name))
{
g_key_file_remove_group (key_file, priv->orig_name, NULL);
g_free (priv->orig_name);
priv->orig_name = g_strdup (name);
}
if (priv->host)
{
g_key_file_set_string (key_file, name, "host", priv->host);
}
if (priv->cert)
{
g_key_file_set_string (key_file, name, "cert", priv->cert);
}
else
{
g_key_file_remove_key (key_file, name, "cert", NULL);
}
if (priv->user)
{
g_key_file_set_string (key_file, name, "user", priv->user);
}
}
@@ -1,60 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#ifndef __STRONGSWAN_CONNECTION_H__
#define __STRONGSWAN_CONNECTION_H__
#include <glib.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define STRONGSWAN_TYPE_CONNECTION (strongswan_connection_get_type ())
#define STRONGSWAN_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_CONNECTION, StrongswanConnection))
#define STRONGSWAN_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_CONNECTION, StrongswanConnectionClass))
#define STRONGSWAN_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_CONNECTION))
#define STRONGSWAN_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STRONGSWAN_TYPE_CONNECTION))
#define STRONGSWAN_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_CONNECTION, StrongswanConnectionClass))
typedef struct _StrongswanConnection StrongswanConnection;
typedef struct _StrongswanConnectionClass StrongswanConnectionClass;
typedef struct _StrongswanConnectionPrivate StrongswanConnectionPrivate;
struct _StrongswanConnection
{
GObject gobject;
StrongswanConnectionPrivate *priv;
};
struct _StrongswanConnectionClass
{
GObjectClass parent_class;
};
GType strongswan_connection_get_type (void);
StrongswanConnection *strongswan_connection_new (const gchar *name);
StrongswanConnection *strongswan_connection_new_from_key_file(GKeyFile *key_file, const gchar *name);
void strongswan_connection_save_to_key_file (GKeyFile *key_file, StrongswanConnection *connection);
#ifdef USE_DYNAMIC_TYPES
void strongswan_connection_register (GTypeModule *type_module);
#endif
G_END_DECLS
#endif /* __STRONGSWAN_CONNECTION_H__ */
@@ -1,318 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#include <glib.h>
#include <libgnomevfs/gnome-vfs.h>
#include "strongswan-connections.h"
/* connections are stored in ~/.config/strongswan/connections */
#define CONFIG_DIR_NAME "strongswan"
#define CONFIG_FILE_NAME "connections"
#define STRONGSWAN_CONNECTIONS_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), STRONGSWAN_TYPE_CONNECTIONS, StrongswanConnectionsPrivate))
struct _StrongswanConnectionsPrivate
{
GKeyFile *key_file;
gchar *path;
GnomeVFSMonitorHandle *monitor;
GHashTable *connections;
GtkTreeModel *model;
};
#ifndef USE_DYNAMIC_TYPES
G_DEFINE_TYPE (StrongswanConnections, strongswan_connections, G_TYPE_OBJECT);
#else
G_DEFINE_DYNAMIC_TYPE (StrongswanConnections, strongswan_connections, G_TYPE_OBJECT);
void strongswan_connections_register (GTypeModule *type_module)
{
strongswan_connections_register_type (type_module);
}
#endif
static void
strongswan_connections_load_connections (StrongswanConnections *connections)
{
StrongswanConnectionsPrivate *priv = connections->priv;
GHashTableIter iter;
gpointer key, value;
gchar **groups;
guint i;
g_hash_table_remove_all (priv->connections);
groups = g_key_file_get_groups (priv->key_file, NULL);
for (i = 0; groups[i]; i++)
{
StrongswanConnection *conn;
conn = strongswan_connection_new_from_key_file(priv->key_file,
groups[i]);
if (conn != NULL)
{
g_hash_table_insert (priv->connections,
g_strdup(groups[i]),
conn);
}
}
g_strfreev (groups);
gtk_list_store_clear (GTK_LIST_STORE (priv->model));
g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, &key, &value))
{
gtk_list_store_insert_with_values (GTK_LIST_STORE (priv->model),
NULL,
-1,
0, key,
-1);
}
}
static void
strongswan_connections_load_config (StrongswanConnections *connections)
{
StrongswanConnectionsPrivate *priv = connections->priv;
GError *error = NULL;
if (priv->key_file)
{
g_key_file_free (priv->key_file);
}
priv->key_file = g_key_file_new ();
if (!g_key_file_load_from_file (priv->key_file,
priv->path,
G_KEY_FILE_KEEP_COMMENTS,
&error))
{
if (g_error_matches (error,
G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_PARSE))
{
g_debug ("Failed to parse config file '%s', treated as empty: %s",
priv->path, error->message);
g_error_free (error);
}
else
{
g_debug ("Could not read config file '%s': %s",
priv->path, error->message);
g_error_free (error);
}
}
strongswan_connections_load_connections (connections);
}
static void
strongswan_connections_file_changed (GnomeVFSMonitorHandle *handle,
const gchar *monitor_uri,
const gchar *info_uri,
GnomeVFSMonitorEventType event_type,
StrongswanConnections *connections)
{
strongswan_connections_load_config (connections);
}
static void
strongswan_connections_init (StrongswanConnections *connections)
{
StrongswanConnectionsPrivate *priv;
connections->priv = STRONGSWAN_CONNECTIONS_GET_PRIVATE (connections);
priv = connections->priv;
priv->path = g_build_filename (g_get_user_config_dir (),
CONFIG_DIR_NAME,
CONFIG_FILE_NAME,
NULL);
/* ensure that the directory exists */
gchar *dir = g_path_get_dirname (priv->path);
g_mkdir_with_parents (dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
g_free (dir);
priv->connections = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
priv->model = GTK_TREE_MODEL (gtk_list_store_new (2,
G_TYPE_STRING,
G_TYPE_STRING));
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->model),
0,
GTK_SORT_ASCENDING);
}
static void
strongswan_connections_constructed (GObject *object)
{
StrongswanConnectionsPrivate *priv;
GnomeVFSResult result;
if (G_OBJECT_CLASS (strongswan_connections_parent_class)->constructed)
{
G_OBJECT_CLASS (strongswan_connections_parent_class)->constructed (object);
}
g_return_if_fail (STRONGSWAN_IS_CONNECTIONS (object));
priv = STRONGSWAN_CONNECTIONS (object)->priv;
result = gnome_vfs_monitor_add (&priv->monitor,
priv->path,
GNOME_VFS_MONITOR_FILE,
(GnomeVFSMonitorCallback) strongswan_connections_file_changed,
object);
if (result != GNOME_VFS_OK)
{
g_warning ("Could not monitor '%s': %s",
priv->path,
gnome_vfs_result_to_string (result));
}
strongswan_connections_load_config (STRONGSWAN_CONNECTIONS (object));
}
static void
strongswan_connections_dispose (GObject *object)
{
StrongswanConnectionsPrivate *priv;
g_return_if_fail (STRONGSWAN_IS_CONNECTIONS (object));
priv = STRONGSWAN_CONNECTIONS (object)->priv;
if (priv->model)
{
priv->model = (g_object_unref (priv->model), NULL);
}
G_OBJECT_CLASS (strongswan_connections_parent_class)->dispose (object);
}
static void
strongswan_connections_finalize (GObject *object)
{
StrongswanConnectionsPrivate *priv;
g_return_if_fail (STRONGSWAN_IS_CONNECTIONS (object));
priv = STRONGSWAN_CONNECTIONS (object)->priv;
priv->path = (g_free (priv->path), NULL);
priv->monitor = (gnome_vfs_monitor_cancel (priv->monitor), NULL);
priv->key_file = (g_key_file_free (priv->key_file), NULL);
priv->connections = (g_hash_table_destroy (priv->connections), NULL);
G_OBJECT_CLASS (strongswan_connections_parent_class)->finalize (object);
}
static void
strongswan_connections_class_init (StrongswanConnectionsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = strongswan_connections_constructed;
object_class->dispose = strongswan_connections_dispose;
object_class->finalize = strongswan_connections_finalize;
g_type_class_add_private (klass, sizeof (StrongswanConnectionsPrivate));
}
#ifdef USE_DYNAMIC_TYPES
static void
strongswan_connections_class_finalize (StrongswanConnectionsClass *klass)
{
}
#endif
GtkTreeModel *
strongswan_connections_get_model (StrongswanConnections *self)
{
StrongswanConnectionsPrivate *priv = self->priv;
return g_object_ref (priv->model);
}
void
strongswan_connections_setup_column_renderers (StrongswanConnections *self,
GtkCellLayout *layout)
{
GtkCellRenderer *renderer;
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (layout,
renderer,
TRUE);
gtk_cell_layout_add_attribute (layout,
renderer,
"text", 0);
}
StrongswanConnections *
strongswan_connections_new (void)
{
StrongswanConnections *connections;
connections = g_object_new (STRONGSWAN_TYPE_CONNECTIONS,
NULL);
return connections;
}
StrongswanConnection *
strongswan_connections_get_connection (StrongswanConnections *self,
const gchar *name)
{
StrongswanConnectionsPrivate *priv = self->priv;
g_return_val_if_fail (name != NULL, NULL);
return g_hash_table_lookup (priv->connections, name);
}
static void
strongswan_connections_save_connections (StrongswanConnections *self)
{
StrongswanConnectionsPrivate *priv = self->priv;
gchar *data;
gsize size;
GError *error = NULL;
data = g_key_file_to_data (priv->key_file, &size, NULL);
if (!g_file_set_contents (priv->path, data, size, &error))
{
g_warning ("Failed to save connections to '%s': %s",
priv->path, error->message);
g_error_free (error);
}
g_free (data);
}
void
strongswan_connections_save_connection (StrongswanConnections *self,
StrongswanConnection *conn)
{
StrongswanConnectionsPrivate *priv = self->priv;
strongswan_connection_save_to_key_file (priv->key_file, conn);
strongswan_connections_save_connections (self);
}
void
strongswan_connections_remove_connection (StrongswanConnections *self,
const gchar *name)
{
StrongswanConnectionsPrivate *priv = self->priv;
g_key_file_remove_group (priv->key_file, name, NULL);
strongswan_connections_save_connections (self);
}
@@ -1,65 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#ifndef __STRONGSWAN_CONNECTIONS_H__
#define __STRONGSWAN_CONNECTIONS_H__
#include <gtk/gtk.h>
#include "strongswan-connection.h"
G_BEGIN_DECLS
#define STRONGSWAN_TYPE_CONNECTIONS (strongswan_connections_get_type ())
#define STRONGSWAN_CONNECTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_CONNECTIONS, StrongswanConnections))
#define STRONGSWAN_CONNECTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_CONNECTIONS, StrongswanConnectionsClass))
#define STRONGSWAN_IS_CONNECTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_CONNECTIONS))
#define STRONGSWAN_IS_CONNECTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STRONGSWAN_TYPE_CONNECTIONS))
#define STRONGSWAN_CONNECTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_CONNECTIONS, StrongswanConnectionsClass))
typedef struct _StrongswanConnections StrongswanConnections;
typedef struct _StrongswanConnectionsClass StrongswanConnectionsClass;
typedef struct _StrongswanConnectionsPrivate StrongswanConnectionsPrivate;
struct _StrongswanConnections
{
GObject gobject;
StrongswanConnectionsPrivate *priv;
};
struct _StrongswanConnectionsClass
{
GObjectClass parent_class;
};
GType strongswan_connections_get_type (void);
StrongswanConnections *strongswan_connections_new (void);
GtkTreeModel *strongswan_connections_get_model (StrongswanConnections *connections);
void strongswan_connections_setup_column_renderers (StrongswanConnections *connections, GtkCellLayout *layout);
StrongswanConnection *strongswan_connections_get_connection (StrongswanConnections *self, const gchar *name);
void strongswan_connections_save_connection (StrongswanConnections *self, StrongswanConnection *conn);
void strongswan_connections_remove_connection (StrongswanConnections *self, const gchar *name);
#ifdef USE_DYNAMIC_TYPES
void strongswan_connections_register (GTypeModule *type_module);
#endif
G_END_DECLS
#endif /* __STRONGSWAN_CONNECTIONS_H__ */
@@ -1,353 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#include <hildon-cp-plugin/hildon-cp-plugin-interface.h>
#include <gtk/gtk.h>
#include <hildon/hildon.h>
#include <hildon/hildon-file-chooser-dialog.h>
#include <string.h>
#include "strongswan-connections.h"
enum {
RESPONSE_NEW = 1,
RESPONSE_EDIT,
RESPONSE_DELETE
};
struct {
GtkWidget *dialog;
GtkWidget *list;
StrongswanConnections *conns;
} ListDialog = { 0, };
/**
* Callback if no certificate should be selected
*/
void no_certificate(HildonButton *button, gpointer user_data)
{
gtk_dialog_response (GTK_DIALOG (user_data), GTK_RESPONSE_REJECT);
}
/**
* Callback to select a certificate
*/
void select_cert(HildonButton *button, gpointer user_data)
{
GtkWidget *selector = hildon_file_chooser_dialog_new (GTK_WINDOW (user_data), GTK_FILE_CHOOSER_ACTION_OPEN);
GtkWidget *nocert = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT |
HILDON_SIZE_AUTO_WIDTH,
HILDON_BUTTON_ARRANGEMENT_VERTICAL);
hildon_button_set_text (HILDON_BUTTON (nocert),
"No certificate",
"Use system-wide CA certificates");
hildon_button_set_alignment (HILDON_BUTTON (nocert), 0, 0.5, 1, 1);
g_signal_connect (nocert, "clicked", G_CALLBACK (no_certificate), selector);
hildon_file_chooser_dialog_add_extra (HILDON_FILE_CHOOSER_DIALOG (selector),
nocert);
gtk_widget_show_all (selector);
switch (gtk_dialog_run (GTK_DIALOG (selector)))
{
case GTK_RESPONSE_OK:
{
gchar *file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector));
hildon_button_set_value (button, file);
g_free(file);
break;
}
case GTK_RESPONSE_REJECT:
{
hildon_button_set_value (button, "None");
break;
}
default:
break;
}
gtk_widget_destroy (selector);
}
/**
* Shows a dialog to edit the given connection (or create a new one,
* if conn is NULL)
*/
static void
edit_connection (gpointer *parent, StrongswanConnection *conn)
{
GtkWidget *dialog;
dialog = gtk_dialog_new_with_buttons (
conn ? "Edit Connection" : "New Connection",
GTK_WINDOW (parent),
GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE,
GTK_RESPONSE_OK,
NULL);
GtkWidget *vbox = GTK_DIALOG (dialog)->vbox;
GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
GtkWidget *name = hildon_entry_new (HILDON_SIZE_AUTO);
hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (name), "Connection Name");
hildon_gtk_entry_set_input_mode (GTK_ENTRY (name),
HILDON_GTK_INPUT_MODE_AUTOCAP |
HILDON_GTK_INPUT_MODE_ALPHA |
HILDON_GTK_INPUT_MODE_NUMERIC);
GtkWidget *ncap = hildon_caption_new (group,
"Name",
name,
NULL,
HILDON_CAPTION_OPTIONAL);
gtk_box_pack_start (GTK_BOX (vbox), ncap, TRUE, TRUE, 0);
GtkWidget *host = hildon_entry_new (HILDON_SIZE_AUTO);
hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (host), "Hostname / IP");
hildon_gtk_entry_set_input_mode (GTK_ENTRY (host),
HILDON_GTK_INPUT_MODE_FULL);
GtkWidget *hcap = hildon_caption_new (group,
"Host",
host,
NULL,
HILDON_CAPTION_OPTIONAL);
gtk_box_pack_start (GTK_BOX (vbox), hcap, TRUE, TRUE, 0);
GtkWidget *cert = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT |
HILDON_SIZE_AUTO_WIDTH,
HILDON_BUTTON_ARRANGEMENT_VERTICAL);
hildon_button_set_text (HILDON_BUTTON (cert),
"Host or CA Certificate",
"None");
hildon_button_set_alignment (HILDON_BUTTON (cert), 0, 0.5, 1, 1);
g_signal_connect (cert, "clicked", G_CALLBACK (select_cert), dialog);
GtkWidget *ccap = hildon_caption_new (group,
"Certificate",
cert,
NULL,
HILDON_CAPTION_OPTIONAL);
gtk_box_pack_start (GTK_BOX (vbox), ccap, TRUE, TRUE, 0);
GtkWidget *user = hildon_entry_new (HILDON_SIZE_AUTO);
hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (user), "Username");
hildon_gtk_entry_set_input_mode (GTK_ENTRY (user),
HILDON_GTK_INPUT_MODE_FULL);
GtkWidget *ucap = hildon_caption_new (group,
"Username",
user,
NULL,
HILDON_CAPTION_OPTIONAL);
gtk_box_pack_start (GTK_BOX (vbox), ucap, TRUE, TRUE, 0);
if (conn)
{
gchar *c_name, *c_host, *c_cert, *c_user;
g_object_get (conn,
"name", &c_name,
"host", &c_host,
"cert", &c_cert,
"user", &c_user,
NULL);
gtk_entry_set_text (GTK_ENTRY (name), c_name);
gtk_entry_set_text (GTK_ENTRY (host), c_host);
hildon_button_set_value (HILDON_BUTTON (cert),
c_cert ? c_cert : "None");
gtk_entry_set_text (GTK_ENTRY (user), c_user);
g_free (c_name);
g_free (c_host);
g_free (c_cert);
g_free (c_user);
}
gtk_widget_show_all (dialog);
gint retval = gtk_dialog_run (GTK_DIALOG (dialog));
if (retval == GTK_RESPONSE_OK)
{
const gchar *c_name, *c_cert;
c_name = gtk_entry_get_text (GTK_ENTRY (name));
if (!conn)
{
conn = strongswan_connection_new (c_name);
}
c_cert = hildon_button_get_value (HILDON_BUTTON (cert));
c_cert = strcmp (c_cert, "None") ? c_cert : NULL;
g_object_set (conn,
"name", c_name,
"host", gtk_entry_get_text (GTK_ENTRY (host)),
"cert", c_cert,
"user", gtk_entry_get_text (GTK_ENTRY (user)),
NULL);
strongswan_connections_save_connection (ListDialog.conns, conn);
}
gtk_widget_destroy (dialog);
}
/**
* Creates a dialog showing a list of all connections
*/
static void
create_list_dialog (gpointer *parent)
{
GtkWidget *dialog = gtk_dialog_new_with_buttons (
"strongSwan Connections",
GTK_WINDOW (parent),
GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_NEW,
RESPONSE_NEW,
GTK_STOCK_EDIT,
RESPONSE_EDIT,
GTK_STOCK_DELETE,
RESPONSE_DELETE,
GTK_STOCK_CLOSE,
GTK_RESPONSE_OK,
NULL);
ListDialog.dialog = dialog;
GtkWidget *vbox = GTK_DIALOG (dialog)->vbox;
ListDialog.conns = strongswan_connections_new ();
GtkTreeModel *model = strongswan_connections_get_model (ListDialog.conns);
ListDialog.list = gtk_tree_view_new_with_model (model);
g_object_unref (model);
GtkTreeSelection *selection;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ListDialog.list));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
GtkTreeViewColumn *column = gtk_tree_view_column_new ();
strongswan_connections_setup_column_renderers (ListDialog.conns,
GTK_CELL_LAYOUT (column));
gtk_tree_view_append_column (GTK_TREE_VIEW (ListDialog.list), column);
gtk_box_pack_start (GTK_BOX (vbox),
ListDialog.list,
TRUE,
TRUE,
HILDON_MARGIN_DEFAULT);
gtk_widget_show_all (dialog);
gtk_widget_hide (dialog);
}
/**
* Get the name fo the selected connection in the list (or NULL).
* The name has to be freed.
*/
static gchar *
get_selected (void)
{
GtkTreeView *tree = GTK_TREE_VIEW(ListDialog.list);
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
gchar *name = NULL;
selection = gtk_tree_view_get_selection (tree);
model = gtk_tree_view_get_model (tree);
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get(model, &iter, 0, &name, -1);
}
return name;
}
/**
* main callback for control panel plugins
*/
osso_return_t execute(osso_context_t *osso, gpointer data,
gboolean user_activated)
{
gint response;
create_list_dialog (data);
if (!user_activated)
{
/* load state */
}
do
{
gchar *selected;
response = gtk_dialog_run (GTK_DIALOG (ListDialog.dialog));
switch (response)
{
case RESPONSE_NEW:
{
edit_connection (data, NULL);
break;
}
case RESPONSE_EDIT:
{
StrongswanConnection *conn;
selected = get_selected ();
conn = strongswan_connections_get_connection (ListDialog.conns,
selected);
if (conn)
{
edit_connection (data, conn);
}
else
{
hildon_banner_show_information (NULL, NULL,
"Select a connection first");
}
g_free (selected);
break;
}
case RESPONSE_DELETE:
{
GtkWidget *confirm;
gint retval;
gchar *msg;
selected = get_selected ();
if (!selected)
{
hildon_banner_show_information (NULL, NULL,
"Select a connection first");
break;
}
msg = g_strdup_printf ("Delete connection?\n%s", selected);
confirm = hildon_note_new_confirmation (data, msg);
retval = gtk_dialog_run (GTK_DIALOG (confirm));
if (retval == GTK_RESPONSE_OK)
{
strongswan_connections_remove_connection (ListDialog.conns,
selected);
}
gtk_widget_destroy (confirm);
g_free (msg);
g_free (selected);
break;
}
default:
break;
}
}
while (response > 0);
gtk_widget_destroy (ListDialog.dialog);
g_object_unref (ListDialog.conns);
return OSSO_OK;
}
/**
* callback called in case state has to be saved
*/
osso_return_t save_state(osso_context_t *osso, gpointer data)
{
/* save state */
return OSSO_OK;
}
-621
View File
@@ -1,621 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#include <hildon/hildon.h>
#include <libosso.h>
#include <string.h>
#include "strongswan-status.h"
#include "strongswan-connections.h"
#define STRONGSWAN_STATUS_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
STRONGSWAN_TYPE_STATUS, \
StrongswanStatusPrivate))
#define OSSO_STATUS_NAME "status"
#define OSSO_STATUS_SERVICE "org.strongswan."OSSO_STATUS_NAME
#define OSSO_STATUS_OBJECT "/org/strongswan/"OSSO_STATUS_NAME
#define OSSO_STATUS_IFACE "org.strongswan."OSSO_STATUS_NAME
#define OSSO_CHARON_NAME "charon"
#define OSSO_CHARON_SERVICE "org.strongswan."OSSO_CHARON_NAME
#define OSSO_CHARON_OBJECT "/org/strongswan/"OSSO_CHARON_NAME
#define OSSO_CHARON_IFACE "org.strongswan."OSSO_CHARON_NAME
#define ICON_SIZE_STATUS 18
#define ICON_SIZE_BUTTON 48
#define UNREF_IF(obj) do { \
if (obj) { obj = (g_object_unref (obj), NULL); } \
} while(0)
typedef enum
{
STATUS_DISCONNECTED,
STATUS_CONNECTING,
STATUS_CONNECTED,
STATUS_AUTH_FAILED,
STATUS_CONNECTION_FAILED,
} StrongswanConnectionStatus;
struct _StrongswanStatusPrivate
{
struct {
GdkPixbuf *status_open;
GdkPixbuf *status_close;
GdkPixbuf *button_open;
GdkPixbuf *button_close;
} icons;
GtkWidget *dialog;
GtkWidget *button;
GtkWidget *image;
GtkWidget *selector;
GtkWidget *box;
osso_context_t *context;
StrongswanConnections *conns;
StrongswanConnectionStatus status;
gchar *current;
};
HD_DEFINE_PLUGIN_MODULE_EXTENDED (StrongswanStatus, strongswan_status, \
HD_TYPE_STATUS_MENU_ITEM, {}, { \
strongswan_connection_register (G_TYPE_MODULE (plugin)); \
strongswan_connections_register (G_TYPE_MODULE (plugin)); }, {});
static void
update_status_menu (StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = plugin->priv;
switch (priv->status)
{
default:
case STATUS_DISCONNECTED:
{
hildon_button_set_value (HILDON_BUTTON (priv->button),
"Not connected");
hd_status_plugin_item_set_status_area_icon (
HD_STATUS_PLUGIN_ITEM (plugin),
priv->icons.status_open);
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image),
priv->icons.button_open);
break;
}
case STATUS_CONNECTING:
{
gchar *msg = g_strdup_printf ("Connecting to %s...", priv->current);
hildon_button_set_value (HILDON_BUTTON (priv->button), msg);
g_free (msg);
break;
}
case STATUS_CONNECTED:
{
gchar *msg = g_strdup_printf ("Connected to %s", priv->current);
hildon_button_set_value (HILDON_BUTTON (priv->button), msg);
g_free (msg);
hd_status_plugin_item_set_status_area_icon (
HD_STATUS_PLUGIN_ITEM (plugin),
priv->icons.status_close);
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image),
priv->icons.button_close);
break;
}
}
}
static void
update_dialog_connecting (StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = plugin->priv;
gtk_widget_set_sensitive (priv->box, FALSE);
hildon_gtk_window_set_progress_indicator (GTK_WINDOW (priv->dialog), 1);
}
static void
update_dialog_default (StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = plugin->priv;
gtk_widget_set_sensitive (priv->box, TRUE);
hildon_gtk_window_set_progress_indicator (GTK_WINDOW (priv->dialog), 0);
}
static void
dialog_response (GtkDialog *dialog, gint response_id, StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = plugin->priv;
gtk_widget_destroy (priv->dialog);
priv->dialog = NULL;
}
static void
handle_status_change (StrongswanStatus *plugin,
StrongswanConnectionStatus status,
gchar *message)
{
StrongswanStatusPrivate *priv = plugin->priv;
gchar *msg = NULL;
switch (status)
{
case STATUS_CONNECTION_FAILED:
{
if (priv->status == STATUS_CONNECTED)
{
msg = g_strdup_printf ("Lost connection to %s", priv->current);
}
else if (message)
{
msg = g_strdup_printf ("Failed to connect to %s: %s",
priv->current, message);
}
else
{
msg = g_strdup_printf ("Failed to connect to %s",
priv->current);
}
status = STATUS_DISCONNECTED;
break;
}
case STATUS_AUTH_FAILED:
{
msg = g_strdup_printf ("Failed to connect to %s: authentication "
"failed", priv->current);
status = STATUS_DISCONNECTED;
/* TODO: show password dialog again? */
break;
}
case STATUS_CONNECTED:
{
msg = g_strdup_printf ("Successfully connected to %s",
priv->current);
break;
}
default:
case STATUS_DISCONNECTED:
{
msg = g_strdup_printf ("Disconnected from %s", priv->current);
break;
}
}
priv->status = status;
if (status == STATUS_DISCONNECTED)
{
priv->current = (g_free (priv->current), NULL);
}
hildon_banner_show_information (NULL, NULL, msg);
g_free (msg);
update_status_menu (plugin);
if (priv->dialog)
{
update_dialog_default (plugin);
if (status == STATUS_CONNECTED)
{
gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK);
}
}
}
static gboolean
get_password (StrongswanStatus *plugin, gchar **password)
{
StrongswanStatusPrivate *priv = plugin->priv;
gboolean result = FALSE;
GtkWidget *dialog = gtk_dialog_new_with_buttons (
"Connecting...",
GTK_WINDOW(priv->dialog),
GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_OK,
GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
GtkWidget *vbox = GTK_DIALOG (dialog)->vbox;
GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
GtkWidget *pass = hildon_entry_new (HILDON_SIZE_AUTO);
hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (pass), "Password");
hildon_gtk_entry_set_input_mode (GTK_ENTRY (pass),
HILDON_GTK_INPUT_MODE_FULL |
HILDON_GTK_INPUT_MODE_INVISIBLE);
GtkWidget *pcap = hildon_caption_new (group,
"Password",
pass,
NULL,
HILDON_CAPTION_OPTIONAL);
gtk_box_pack_start (GTK_BOX (vbox), pcap, TRUE, TRUE, 0);
gtk_widget_show_all (dialog);
gint retval = gtk_dialog_run (GTK_DIALOG (dialog));
if (retval == GTK_RESPONSE_OK)
{
*password = g_strdup (gtk_entry_get_text (GTK_ENTRY (pass)));
result = TRUE;
}
gtk_widget_destroy (dialog);
return result;
}
static void
connect_clicked (HildonButton *button, StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = plugin->priv;
osso_return_t result;
osso_rpc_t retval;
priv->current = hildon_touch_selector_get_current_text (
HILDON_TOUCH_SELECTOR (priv->selector));
priv->status = STATUS_CONNECTING;
update_dialog_connecting (plugin);
update_status_menu (plugin);
StrongswanConnection *conn = strongswan_connections_get_connection (
priv->conns,
priv->current);
if (!conn)
{
handle_status_change (plugin, STATUS_CONNECTION_FAILED, "not found");
return;
}
/* this call on the system bus is only needed to start charon as root */
result = osso_rpc_run_system (priv->context,
OSSO_CHARON_SERVICE,
OSSO_CHARON_OBJECT,
OSSO_CHARON_IFACE,
"Start",
&retval,
DBUS_TYPE_INVALID);
osso_rpc_free_val (&retval);
if (result != OSSO_OK)
{
handle_status_change (plugin, STATUS_CONNECTION_FAILED,
"couldn't connect to charon");
return;
}
gchar *c_host, *c_cert, *c_user, *c_pass;
if (!get_password (plugin, &c_pass))
{
update_dialog_default (plugin);
return;
}
g_object_get (conn,
"host", &c_host,
"cert", &c_cert,
"user", &c_user,
NULL);
result = osso_rpc_run (priv->context,
OSSO_CHARON_SERVICE,
OSSO_CHARON_OBJECT,
OSSO_CHARON_IFACE,
"Connect",
&retval,
DBUS_TYPE_STRING, priv->current,
DBUS_TYPE_STRING, c_host,
DBUS_TYPE_STRING, c_cert,
DBUS_TYPE_STRING, c_user,
DBUS_TYPE_STRING, c_pass,
DBUS_TYPE_INVALID);
g_free (c_host);
g_free (c_cert);
g_free (c_user);
g_free (c_pass);
if (result != OSSO_OK || !retval.value.b)
{
handle_status_change (plugin, STATUS_CONNECTION_FAILED,
"initiation failed");
osso_rpc_free_val (&retval);
return;
}
osso_rpc_free_val (&retval);
}
static void
disconnect_clicked (HildonButton *button, StrongswanStatus *plugin)
{
osso_return_t result;
osso_rpc_t retval;
gchar *msg;
StrongswanStatusPrivate *priv = plugin->priv;
gtk_widget_set_sensitive (priv->box, FALSE);
hildon_gtk_window_set_progress_indicator (GTK_WINDOW (priv->dialog), 1);
result = osso_rpc_run_system (priv->context,
OSSO_CHARON_SERVICE,
OSSO_CHARON_OBJECT,
OSSO_CHARON_IFACE,
"Disconnect",
&retval,
DBUS_TYPE_INVALID);
gtk_widget_set_sensitive (priv->box, TRUE);
hildon_gtk_window_set_progress_indicator (GTK_WINDOW (priv->dialog), 0);
if (result == OSSO_OK)
{
msg = g_strdup_printf ("Successfully disconnected from %s",
priv->current);
}
else
{
msg = g_strdup_printf ("Failed to disconnect from %s", priv->current);
}
hildon_banner_show_information (NULL, NULL, msg);
g_free (msg);
priv->current = (g_free (priv->current), NULL);
priv->status = STATUS_DISCONNECTED;
update_status_menu (plugin);
gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK);
}
static void
setup_dialog_disconnected (StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = plugin->priv;
GtkWidget *vbox = GTK_DIALOG (priv->dialog)->vbox;
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
priv->box = hbox;
GtkWidget *button = hildon_picker_button_new (
HILDON_SIZE_FINGER_HEIGHT |
HILDON_SIZE_AUTO_WIDTH,
HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
hildon_button_set_title (HILDON_BUTTON (button), "Connection:");
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
GtkWidget *selector = hildon_touch_selector_new ();
priv->selector = selector;
GtkTreeModel *model = strongswan_connections_get_model (priv->conns);
hildon_touch_selector_append_text_column (
HILDON_TOUCH_SELECTOR (selector),
model,
TRUE);
hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
HILDON_TOUCH_SELECTOR (selector));
button = hildon_button_new_with_text (
HILDON_SIZE_FINGER_HEIGHT |
HILDON_SIZE_AUTO_WIDTH,
HILDON_BUTTON_ARRANGEMENT_HORIZONTAL,
"Connect", NULL);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
g_signal_connect (button, "clicked", G_CALLBACK (connect_clicked),
plugin);
}
static void
setup_dialog_connected (StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = plugin->priv;
GtkWidget *vbox = GTK_DIALOG (priv->dialog)->vbox;
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
priv->box = hbox;
GtkWidget *button = hildon_button_new_with_text (
HILDON_SIZE_FINGER_HEIGHT |
HILDON_SIZE_AUTO_WIDTH,
HILDON_BUTTON_ARRANGEMENT_HORIZONTAL,
"Disconnect", priv->current);
hildon_button_set_style (HILDON_BUTTON (button),
HILDON_BUTTON_STYLE_PICKER);
g_signal_connect (button, "clicked", G_CALLBACK (disconnect_clicked),
plugin);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
}
static void
button_clicked (HildonButton *button, StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = plugin->priv;
priv->dialog = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (priv->dialog), "strongSwan VPN");
g_signal_connect (priv->dialog, "response",
G_CALLBACK (dialog_response), plugin);
switch (priv->status)
{
default:
case STATUS_DISCONNECTED:
setup_dialog_disconnected (plugin);
break;
case STATUS_CONNECTING:
setup_dialog_disconnected (plugin);
update_dialog_connecting (plugin);
break;
case STATUS_CONNECTED:
setup_dialog_connected (plugin);
break;
}
gtk_widget_show_all (priv->dialog);
}
static gint
dbus_req_handler(const gchar *interface, const gchar *method,
GArray *arguments, StrongswanStatus *plugin,
osso_rpc_t *retval)
{
if (!strcmp (method, "StatusChanged") && arguments->len == 1)
{
int status = 0;
osso_rpc_t *arg = &g_array_index(arguments, osso_rpc_t, 0);
if (arg->type == DBUS_TYPE_INT32)
{
status = arg->value.i;
}
handle_status_change (plugin, status, NULL);
}
return OSSO_OK;
}
static GdkPixbuf*
load_icon (GtkIconTheme *theme, const gchar *name, gint size)
{
GdkPixbuf *icon = gtk_icon_theme_load_icon (theme, name, size,
GTK_ICON_LOOKUP_NO_SVG, NULL);
return icon;
}
static void
load_icons (StrongswanStatusPrivate *priv)
{
GtkIconTheme *theme = gtk_icon_theme_get_default ();
priv->icons.status_open = load_icon (theme, "strongswan_lock_open",
ICON_SIZE_STATUS);
priv->icons.status_close = load_icon (theme, "strongswan_lock_close",
ICON_SIZE_STATUS);
priv->icons.button_open = load_icon (theme, "strongswan_lock_open",
ICON_SIZE_BUTTON);
priv->icons.button_close = load_icon (theme, "strongswan_lock_close",
ICON_SIZE_BUTTON);
}
static void
icon_theme_changed (GtkIconTheme *theme, StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = plugin->priv;
UNREF_IF(priv->icons.status_open);
UNREF_IF(priv->icons.status_close);
UNREF_IF(priv->icons.button_open);
UNREF_IF(priv->icons.button_close);
load_icons (priv);
update_status_menu (plugin);
}
static void
strongswan_status_init (StrongswanStatus *plugin)
{
StrongswanStatusPrivate *priv = STRONGSWAN_STATUS_GET_PRIVATE (plugin);
plugin->priv = priv;
priv->context = osso_initialize (OSSO_STATUS_SERVICE, "0.0.1", TRUE, NULL);
if (!priv->context)
{
return;
}
osso_return_t result;
result = osso_rpc_set_cb_f (priv->context,
OSSO_STATUS_SERVICE,
OSSO_STATUS_OBJECT,
OSSO_STATUS_IFACE,
(osso_rpc_cb_f*)dbus_req_handler,
plugin);
if (result != OSSO_OK)
{
return;
}
priv->conns = strongswan_connections_new ();
load_icons(priv);
hd_status_plugin_item_set_status_area_icon (HD_STATUS_PLUGIN_ITEM (plugin),
priv->icons.status_open);
GtkWidget *button = hildon_button_new_with_text (
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
HILDON_BUTTON_ARRANGEMENT_VERTICAL,
"strongSwan VPN", "Not connected");
hildon_button_set_style (HILDON_BUTTON (button),
HILDON_BUTTON_STYLE_PICKER);
priv->button = button;
gtk_container_add (GTK_CONTAINER (plugin), button);
GtkWidget *image = gtk_image_new_from_pixbuf (priv->icons.button_open);
priv->image = image;
hildon_button_set_image (HILDON_BUTTON (button), image);
gtk_button_set_alignment (GTK_BUTTON (button), 0.0, 0.5);
g_signal_connect (button, "clicked", G_CALLBACK (button_clicked), plugin);
gtk_widget_show_all (GTK_WIDGET (plugin));
g_signal_connect (gtk_icon_theme_get_default (), "changed",
G_CALLBACK (icon_theme_changed), plugin);
}
static void
strongswan_status_dispose (GObject *object)
{
StrongswanStatusPrivate *priv = STRONGSWAN_STATUS (object)->priv;
if (priv->context)
{
osso_rpc_unset_cb_f (priv->context,
OSSO_STATUS_SERVICE,
OSSO_STATUS_OBJECT,
OSSO_STATUS_IFACE,
(osso_rpc_cb_f*)dbus_req_handler,
STRONGSWAN_STATUS (object));
osso_deinitialize (priv->context);
priv->context = NULL;
}
UNREF_IF(priv->conns);
UNREF_IF(priv->icons.status_open);
UNREF_IF(priv->icons.status_close);
UNREF_IF(priv->icons.button_open);
UNREF_IF(priv->icons.button_close);
G_OBJECT_CLASS (strongswan_status_parent_class)->dispose (object);
}
static void
strongswan_status_finalize (GObject *object)
{
StrongswanStatusPrivate *priv = STRONGSWAN_STATUS (object)->priv;
priv->current = (g_free (priv->current), NULL);
G_OBJECT_CLASS (strongswan_status_parent_class)->finalize (object);
}
static void
strongswan_status_class_finalize (StrongswanStatusClass *klass)
{
}
static void
strongswan_status_class_init (StrongswanStatusClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = strongswan_status_dispose;
object_class->finalize = strongswan_status_finalize;
g_type_class_add_private (klass, sizeof (StrongswanStatusPrivate));
}
@@ -1,51 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#ifndef __STRONGSWAN_STATUS_H__
#define __STRONGSWAN_STATUS_H__
#include <libhildondesktop/libhildondesktop.h>
G_BEGIN_DECLS
#define STRONGSWAN_TYPE_STATUS (strongswan_status_get_type ())
#define STRONGSWAN_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_STATUS, StrongswanStatus))
#define STRONGSWAN_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_STATUS, StrongswanStatusClass))
#define STRONGSWAN_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_STATUS))
#define STRONGSWAN_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STRONGSWAN_TYPE_STATUS))
#define STRONGSWAN_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_STATUSS, StrongswanStatusClass))
typedef struct _StrongswanStatus StrongswanStatus;
typedef struct _StrongswanStatusClass StrongswanStatusClass;
typedef struct _StrongswanStatusPrivate StrongswanStatusPrivate;
struct _StrongswanStatus
{
HDStatusMenuItem parent;
StrongswanStatusPrivate *priv;
};
struct _StrongswanStatusClass
{
HDStatusMenuItemClass parent;
};
GType strongswan_status_get_type (void);
G_END_DECLS
#endif /* __STRONGSWAN_STATUS_H__ */
-7
View File
@@ -513,13 +513,6 @@ if MONOLITHIC
endif
endif
if USE_MAEMO
SUBDIRS += plugins/maemo
if MONOLITHIC
libcharon_la_LIBADD += plugins/maemo/libstrongswan-maemo.la
endif
endif
if USE_HA
SUBDIRS += plugins/ha
if MONOLITHIC
-29
View File
@@ -1,29 +0,0 @@
AM_CPPFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libcharon
AM_CFLAGS = \
${maemo_CFLAGS} \
$(PLUGIN_CFLAGS)
if MONOLITHIC
noinst_LTLIBRARIES = libstrongswan-maemo.la
else
plugin_LTLIBRARIES = libstrongswan-maemo.la
endif
libstrongswan_maemo_la_SOURCES = \
maemo_plugin.h maemo_plugin.c \
maemo_service.h maemo_service.c
libstrongswan_maemo_la_LDFLAGS = -module -avoid-version
libstrongswan_maemo_la_LIBADD = ${maemo_LIBS}
dbusservice_DATA = org.strongswan.charon.service
org.strongswan.charon.service: $(srcdir)/org.strongswan.charon.service.in
$(AM_V_GEN) \
sed -e 's|[@]LIBEXECDIR[@]|$(libexecdir)|' $< >$@
EXTRA_DIST = org.strongswan.charon.service.in
CLEANFILES = $(dbusservice_DATA)
@@ -1,87 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#include "maemo_plugin.h"
#include "maemo_service.h"
#include <daemon.h>
typedef struct private_maemo_plugin_t private_maemo_plugin_t;
/**
* private data of maemo plugin
*/
struct private_maemo_plugin_t {
/**
* implements plugin interface
*/
maemo_plugin_t public;
/**
* service
*/
maemo_service_t *service;
};
METHOD(plugin_t, get_name, char*,
private_maemo_plugin_t *this)
{
return "maemo";
}
METHOD(plugin_t, get_features, int,
private_maemo_plugin_t *this, plugin_feature_t *features[])
{
static plugin_feature_t f[] = {
PLUGIN_NOOP,
PLUGIN_PROVIDE(CUSTOM, "maemo"),
};
*features = f;
return countof(f);
}
METHOD(plugin_t, destroy, void,
private_maemo_plugin_t *this)
{
this->service->destroy(this->service);
free(this);
}
/*
* See header
*/
plugin_t *maemo_plugin_create()
{
private_maemo_plugin_t *this;
INIT(this,
.public = {
.plugin = {
.get_name = _get_name,
.get_features = _get_features,
.destroy = _destroy,
},
},
);
this->service = maemo_service_create();
if (!this->service)
{
return NULL;
}
return &this->public.plugin;
}
@@ -1,42 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
/**
* @defgroup maemo maemo
* @ingroup cplugins
*
* @defgroup maemo_plugin maemo_plugin
* @{ @ingroup maemo
*/
#ifndef MAEMO_PLUGIN_H_
#define MAEMO_PLUGIN_H_
#include <plugins/plugin.h>
typedef struct maemo_plugin_t maemo_plugin_t;
/**
* Maemo integration plugin.
*/
struct maemo_plugin_t {
/**
* implements plugin interface
*/
plugin_t plugin;
};
#endif /** MAEMO_PLUGIN_H_ @}*/
-530
View File
@@ -1,530 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
#include <glib.h>
#include <libosso.h>
#include <sys/stat.h>
#include "maemo_service.h"
#include <daemon.h>
#include <credentials/sets/mem_cred.h>
#include <processing/jobs/callback_job.h>
#define OSSO_STATUS_NAME "status"
#define OSSO_STATUS_SERVICE "org.strongswan."OSSO_STATUS_NAME
#define OSSO_STATUS_OBJECT "/org/strongswan/"OSSO_STATUS_NAME
#define OSSO_STATUS_IFACE "org.strongswan."OSSO_STATUS_NAME
#define OSSO_CHARON_NAME "charon"
#define OSSO_CHARON_SERVICE "org.strongswan."OSSO_CHARON_NAME
#define OSSO_CHARON_OBJECT "/org/strongswan/"OSSO_CHARON_NAME
#define OSSO_CHARON_IFACE "org.strongswan."OSSO_CHARON_NAME
#define MAEMO_COMMON_CA_DIR "/etc/certs/common-ca"
#define MAEMO_USER_CA_DIR "/home/user/.maemosec-certs/wifi-ca"
/* there is also an smime-ca and an ssl-ca sub-directory and the same for
* ...-user, which store end user/server certificates */
typedef enum {
VPN_STATUS_DISCONNECTED,
VPN_STATUS_CONNECTING,
VPN_STATUS_CONNECTED,
VPN_STATUS_AUTH_FAILED,
VPN_STATUS_CONNECTION_FAILED,
} vpn_status_t;
typedef struct private_maemo_service_t private_maemo_service_t;
/**
* private data of maemo service
*/
struct private_maemo_service_t {
/**
* public interface
*/
maemo_service_t public;
/**
* credentials
*/
mem_cred_t *creds;
/**
* Glib main loop for a thread, handles DBUS calls
*/
GMainLoop *loop;
/**
* Context for OSSO
*/
osso_context_t *context;
/**
* Current IKE_SA
*/
ike_sa_t *ike_sa;
/**
* Status of the current connection
*/
vpn_status_t status;
/**
* Name of the current connection
*/
gchar *current;
};
static gint change_status(private_maemo_service_t *this, int status)
{
osso_rpc_t retval;
gint res;
this->status = status;
res = osso_rpc_run (this->context, OSSO_STATUS_SERVICE, OSSO_STATUS_OBJECT,
OSSO_STATUS_IFACE, "StatusChanged", &retval,
DBUS_TYPE_INT32, status,
DBUS_TYPE_INVALID);
return res;
}
METHOD(listener_t, ike_updown, bool,
private_maemo_service_t *this, ike_sa_t *ike_sa, bool up)
{
/* this callback is only registered during initiation, so if the IKE_SA
* goes down we assume an authentication error */
if (this->ike_sa == ike_sa && !up)
{
change_status(this, VPN_STATUS_AUTH_FAILED);
return FALSE;
}
return TRUE;
}
METHOD(listener_t, ike_state_change, bool,
private_maemo_service_t *this, ike_sa_t *ike_sa, ike_sa_state_t state)
{
/* this call back is only registered during initiation */
if (this->ike_sa == ike_sa && state == IKE_DESTROYING)
{
change_status(this, VPN_STATUS_CONNECTION_FAILED);
return FALSE;
}
return TRUE;
}
METHOD(listener_t, child_updown, bool,
private_maemo_service_t *this, ike_sa_t *ike_sa, child_sa_t *child_sa,
bool up)
{
if (this->ike_sa == ike_sa)
{
if (up)
{
/* disable hooks registered to catch initiation failures */
this->public.listener.ike_updown = NULL;
this->public.listener.ike_state_change = NULL;
change_status(this, VPN_STATUS_CONNECTED);
}
else
{
change_status(this, VPN_STATUS_CONNECTION_FAILED);
return FALSE;
}
}
return TRUE;
}
METHOD(listener_t, ike_rekey, bool,
private_maemo_service_t *this, ike_sa_t *old, ike_sa_t *new)
{
if (this->ike_sa == old)
{
this->ike_sa = new;
}
return TRUE;
}
/**
* load all CA certificates in the given directory
*/
static void load_ca_dir(private_maemo_service_t *this, char *dir)
{
enumerator_t *enumerator;
char *rel, *abs;
struct stat st;
enumerator = enumerator_create_directory(dir);
if (enumerator)
{
while (enumerator->enumerate(enumerator, &rel, &abs, &st))
{
if (rel[0] != '.')
{
if (S_ISREG(st.st_mode))
{
certificate_t *cert;
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE,
CERT_X509, BUILD_FROM_FILE, abs,
BUILD_END);
if (!cert)
{
DBG1(DBG_CFG, "loading CA certificate '%s' failed",
abs);
continue;
}
DBG2(DBG_CFG, "loaded CA certificate '%Y'",
cert->get_subject(cert));
this->creds->add_cert(this->creds, TRUE, cert);
}
}
}
enumerator->destroy(enumerator);
}
}
static void disconnect(private_maemo_service_t *this)
{
ike_sa_t *ike_sa;
u_int id;
if (!this->current)
{
return;
}
/* avoid status updates, as this is called from the Glib main loop */
charon->bus->remove_listener(charon->bus, &this->public.listener);
ike_sa = charon->ike_sa_manager->checkout_by_name(charon->ike_sa_manager,
this->current, FALSE);
if (ike_sa)
{
id = ike_sa->get_unique_id(ike_sa);
charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
charon->controller->terminate_ike(charon->controller, id,
NULL, NULL, 0);
}
this->current = (g_free(this->current), NULL);
this->status = VPN_STATUS_DISCONNECTED;
}
static gboolean initiate_connection(private_maemo_service_t *this,
GArray *arguments)
{
gint i;
gchar *hostname = NULL, *cacert = NULL, *username = NULL, *password = NULL;
identification_t *gateway = NULL, *user = NULL;
ike_sa_t *ike_sa;
ike_cfg_t *ike_cfg;
peer_cfg_t *peer_cfg;
child_cfg_t *child_cfg;
traffic_selector_t *ts;
auth_cfg_t *auth;
certificate_t *cert;
peer_cfg_create_t peer = {
.cert_policy = CERT_SEND_IF_ASKED,
.unique = UNIQUE_REPLACE,
.keyingtries = 1,
.rekey_time = 36000, /* 10h */
.jitter_time = 600, /* 10min */
.over_time = 600, /* 10min */
};
child_cfg_create_t child = {
.lifetime = {
.time = {
.life = 10800, /* 3h */
.rekey = 10200, /* 2h50min */
.jitter = 300 /* 5min */
},
},
.mode = MODE_TUNNEL,
};
if (this->status == VPN_STATUS_CONNECTED ||
this->status == VPN_STATUS_CONNECTING)
{
DBG1(DBG_CFG, "currently connected to '%s', disconnecting first",
this->current);
disconnect (this);
}
if (arguments->len != 5)
{
DBG1(DBG_CFG, "wrong number of arguments: %d", arguments->len);
return FALSE;
}
for (i = 0; i < arguments->len; i++)
{
osso_rpc_t *arg = &g_array_index(arguments, osso_rpc_t, i);
if (arg->type != DBUS_TYPE_STRING)
{
DBG1(DBG_CFG, "invalid argument [%d]: %d", i, arg->type);
return FALSE;
}
switch (i)
{
case 0: /* name */
this->current = (g_free(this->current), NULL);
this->current = g_strdup(arg->value.s);
break;
case 1: /* hostname */
hostname = arg->value.s;
break;
case 2: /* CA certificate path */
cacert = arg->value.s;
break;
case 3: /* username */
username = arg->value.s;
break;
case 4: /* password */
password = arg->value.s;
break;
}
}
DBG1(DBG_CFG, "received initiate for connection '%s'", this->current);
this->creds->clear(this->creds);
if (cacert && !streq(cacert, ""))
{
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509,
BUILD_FROM_FILE, cacert, BUILD_END);
if (cert)
{
this->creds->add_cert(this->creds, TRUE, cert);
}
else
{
DBG1(DBG_CFG, "failed to load CA certificate");
}
/* if this is a server cert we could use the cert subject as id */
}
else
{
load_ca_dir(this, MAEMO_COMMON_CA_DIR);
load_ca_dir(this, MAEMO_USER_CA_DIR);
}
gateway = identification_create_from_string(hostname);
DBG1(DBG_CFG, "using CA certificate, gateway identitiy '%Y'", gateway);
{
shared_key_t *shared_key;
chunk_t secret = chunk_create(password, strlen(password));
user = identification_create_from_string(username);
shared_key = shared_key_create(SHARED_EAP, chunk_clone(secret));
this->creds->add_shared(this->creds, shared_key, user->clone(user),
NULL);
}
ike_cfg = ike_cfg_create(IKEV2, TRUE, FALSE, "0.0.0.0",
charon->socket->get_port(charon->socket, FALSE),
hostname, IKEV2_UDP_PORT, FRAGMENTATION_NO, 0);
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
ike_cfg->add_proposal(ike_cfg, proposal_create_default_aead(PROTO_IKE));
peer_cfg = peer_cfg_create(this->current, ike_cfg, &peer);
peer_cfg->add_virtual_ip(peer_cfg, host_create_from_string("0.0.0.0", 0));
auth = auth_cfg_create();
auth->add(auth, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_EAP);
auth->add(auth, AUTH_RULE_IDENTITY, user);
peer_cfg->add_auth_cfg(peer_cfg, auth, TRUE);
auth = auth_cfg_create();
auth->add(auth, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY);
auth->add(auth, AUTH_RULE_IDENTITY, gateway);
peer_cfg->add_auth_cfg(peer_cfg, auth, FALSE);
child_cfg = child_cfg_create(this->current, &child);
child_cfg->add_proposal(child_cfg, proposal_create_default(PROTO_ESP));
child_cfg->add_proposal(child_cfg, proposal_create_default_aead(PROTO_ESP));
ts = traffic_selector_create_dynamic(0, 0, 65535);
child_cfg->add_traffic_selector(child_cfg, TRUE, ts);
ts = traffic_selector_create_from_string(0, TS_IPV4_ADDR_RANGE, "0.0.0.0",
0, "255.255.255.255", 65535);
child_cfg->add_traffic_selector(child_cfg, FALSE, ts);
peer_cfg->add_child_cfg(peer_cfg, child_cfg);
/* get us an IKE_SA */
ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
peer_cfg);
if (!ike_sa)
{
peer_cfg->destroy(peer_cfg);
this->status = VPN_STATUS_CONNECTION_FAILED;
return FALSE;
}
if (!ike_sa->get_peer_cfg(ike_sa))
{
ike_sa->set_peer_cfg(ike_sa, peer_cfg);
}
peer_cfg->destroy(peer_cfg);
/* store the IKE_SA, so we can track its progress */
this->ike_sa = ike_sa;
this->status = VPN_STATUS_CONNECTING;
this->public.listener.ike_updown = _ike_updown;
this->public.listener.ike_state_change = _ike_state_change;
charon->bus->add_listener(charon->bus, &this->public.listener);
/* get an additional reference because initiate consumes one */
child_cfg->get_ref(child_cfg);
if (ike_sa->initiate(ike_sa, child_cfg, 0, NULL, NULL) != SUCCESS)
{
DBG1(DBG_CFG, "failed to initiate tunnel");
charon->bus->remove_listener(charon->bus, &this->public.listener);
charon->ike_sa_manager->checkin_and_destroy(charon->ike_sa_manager,
ike_sa);
this->status = VPN_STATUS_CONNECTION_FAILED;
return FALSE;
}
charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
return TRUE;
}
/**
* Callback for libosso dbus wrapper
*/
static gint dbus_req_handler(const gchar *interface, const gchar *method,
GArray *arguments, private_maemo_service_t *this,
osso_rpc_t *retval)
{
if (streq(method, "Start"))
{ /* void start (void), dummy function to start charon as root */
return OSSO_OK;
}
else if (streq(method, "Connect"))
{ /* bool connect (name, host, cert, user, pass) */
retval->value.b = initiate_connection(this, arguments);
retval->type = DBUS_TYPE_BOOLEAN;
}
else if (streq(method, "Disconnect"))
{ /* void disconnect (void) */
disconnect(this);
}
else
{
return OSSO_ERROR;
}
return OSSO_OK;
}
/**
* Main loop to handle D-BUS messages.
*/
static job_requeue_t run(private_maemo_service_t *this)
{
this->loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(this->loop);
return JOB_REQUEUE_NONE;
}
/**
* Cancel the GLib Main Event Loop
*/
static bool cancel(private_maemo_service_t *this)
{
if (this->loop)
{
if (g_main_loop_is_running(this->loop))
{
g_main_loop_quit(this->loop);
}
g_main_loop_unref(this->loop);
}
return TRUE;
}
METHOD(maemo_service_t, destroy, void,
private_maemo_service_t *this)
{
if (this->context)
{
osso_rpc_unset_cb_f(this->context,
OSSO_CHARON_SERVICE,
OSSO_CHARON_OBJECT,
OSSO_CHARON_IFACE,
(osso_rpc_cb_f*)dbus_req_handler,
this);
osso_deinitialize(this->context);
}
charon->bus->remove_listener(charon->bus, &this->public.listener);
lib->credmgr->remove_set(lib->credmgr, &this->creds->set);
this->creds->destroy(this->creds);
this->current = (g_free(this->current), NULL);
free(this);
}
/*
* See header
*/
maemo_service_t *maemo_service_create()
{
osso_return_t result;
private_maemo_service_t *this;
INIT(this,
.public = {
.listener = {
.ike_updown = _ike_updown,
.ike_state_change = _ike_state_change,
.child_updown = _child_updown,
.ike_rekey = _ike_rekey,
},
.destroy = _destroy,
},
.creds = mem_cred_create(),
);
lib->credmgr->add_set(lib->credmgr, &this->creds->set);
this->context = osso_initialize(OSSO_CHARON_SERVICE, "0.0.1", TRUE, NULL);
if (!this->context)
{
DBG1(DBG_CFG, "failed to initialize OSSO context");
destroy(this);
return NULL;
}
result = osso_rpc_set_cb_f(this->context,
OSSO_CHARON_SERVICE,
OSSO_CHARON_OBJECT,
OSSO_CHARON_IFACE,
(osso_rpc_cb_f*)dbus_req_handler,
this);
if (result != OSSO_OK)
{
DBG1(DBG_CFG, "failed to set D-BUS callback (%d)", result);
destroy(this);
return NULL;
}
this->loop = NULL;
if (!g_thread_supported())
{
g_thread_init(NULL);
}
lib->processor->queue_job(lib->processor,
(job_t*)callback_job_create_with_prio((callback_job_cb_t)run, this,
NULL, (callback_job_cancel_t)cancel, JOB_PRIO_CRITICAL));
return &this->public;
}
@@ -1,49 +0,0 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
/**
* @defgroup maemo_service maemo_service
* @{ @ingroup maemo
*/
#ifndef MAEMO_SERVICE_H_
#define MAEMO_SERVICE_H_
#include <bus/listeners/listener.h>
typedef struct maemo_service_t maemo_service_t;
/**
* Maemo connection management.
*/
struct maemo_service_t {
/**
* Implements listener_t.
*/
listener_t listener;
/**
* Destroy a maemo_service_t.
*/
void (*destroy)(maemo_service_t *this);
};
/**
* Create an instance of maemo_service_t.
*/
maemo_service_t *maemo_service_create();
#endif /** MAEMO_SERVICE_H_ @}*/
@@ -1,4 +0,0 @@
[D-BUS Service]
Name=org.strongswan.charon
Exec=/usr/bin/run-standalone.sh @LIBEXECDIR@/ipsec/charon
User=root