Commit Graph

14 Commits

Author SHA1 Message Date
Thomas Haller
d0f01aa2c2 clients,cli: show better error message when failing to load VPN plugin
VPN plugins are often not installed or they might be legacy-only.
In both cases we should show a better error message about the
failure reason.
2016-05-19 12:52:59 +02:00
Thomas Haller
41976e3069 clients,cli: for connection-add consider VPNs as loaded from the plugin
Instead of using (only) a hard-coded list of VPN types,
prefer lookup the VPN settings from the .name files.

Still, fallback to a hard-coded list if the plugin cannot
be found, because for connection-add we currently don't
actually need the plugin installed.
2016-05-19 12:52:59 +02:00
Thomas Haller
2b4b9d34e4 clients: don't assert against existance of plugin in nm_vpn_supports_ipv6()
Obviously, loading a plugin can fail easily.
2016-05-19 12:52:59 +02:00
Thomas Haller
0225c4567b clients: lookup VPN plugins either by "name" or "service"
... not constructing a "service" by prepending a D-Bus prefix to "name" (urgh).
2016-05-19 12:52:59 +02:00
Beniamino Galvani
f57c205051 clients: add missing openvpn secret types to secret agent
Add support for asking a certificate password and a HTTP proxy
password for openvpn connections to the built-in secret agent.

https://bugzilla.gnome.org/show_bug.cgi?id=765553
2016-05-05 14:22:32 +02:00
Thomas Haller
c5ac691744 build: cleanup includes of <gmodule.h>
<gmodule.h> is implicitly included by <gio/gio.h> which is available
everywhere. For that reason, we would not have to include this header
at all. However, it is recommended to explicitly include <gmodule.h>
where needed.

So, include it where needed -- if <gio/gio.h> wouldn't be there --
and drop it from where it is not needed.
2016-04-30 03:42:16 +02:00
Thomas Haller
8bace23beb all: cleanup includes and let "nm-default.h" include "config.h"
- All internal source files (except "examples", which are not internal)
  should include "config.h" first. As also all internal source
  files should include "nm-default.h", let "config.h" be included
  by "nm-default.h" and include "nm-default.h" as first in every
  source file.
  We already wanted to include "nm-default.h" before other headers
  because it might contains some fixes (like "nm-glib.h" compatibility)
  that is required first.

- After including "nm-default.h", we optinally allow for including the
  corresponding header file for the source file at hand. The idea
  is to ensure that each header file is self contained.

- Don't include "config.h" or "nm-default.h" in any header file
  (except "nm-sd-adapt.h"). Public headers anyway must not include
  these headers, and internal headers are never included after
  "nm-default.h", as of the first previous point.

- Include all internal headers with quotes instead of angle brackets.
  In practice it doesn't matter, because in our public headers we must
  include other headers with angle brackets. As we use our public
  headers also to compile our interal source files, effectively the
  result must be the same. Still do it for consistency.

- Except for <config.h> itself. Include it with angle brackets as suggested by
  https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
2016-02-19 17:53:25 +01:00
Thomas Haller
2c2d9d2e4c build: cleanup default includes
- "gsystem-local-alloc.h" and <gio/gio.h> are already included via
  "nm-default.h". No need to include them separately.

- include "nm-macros-internal.h" via "nm-default.h" and drop all
  explict includes.

- in the modified files, ensure that we always include "config.h"
  and "nm-default.h" first. As second, include the header file
  for the current source file (if applicable). Then follow external
  includes and finally internal nm includes.

- include nm headers inside source code files with quotes

- internal header files don't need to include default headers.
  They can savely assume that "nm-default.h" is already included
  and with it glib, nm-glib.h, nm-macros-internal.h, etc.
2016-02-12 15:36:01 +01:00
Jiří Klimeš
ea54b7f2c0 clients: add a helper function to get required openconnect VPN secrets
OpenConnect needs three secrets - COOKIE, HOST and FINGERPRINT. They can be
obtained by authenticating to the server. This can be performed by running
"openconnect --authenticate <host>" and the three values are printed to stdout.

Note that the function may (probably will) interactively ask user for
his credentials.

Alternatively, it would be possible to dlopen() libopenconnect and call its
functions. However, as that would be more complicated and would also require
implementing functionality that openconnect simply does for free for us, it is
not worth it, I think.
2015-12-12 17:37:30 +01:00
Jiří Klimeš
6dd1e2673e clients: move vpn_get_secret_names() to nm-vpn-helpers
It should eventually move into libnm and ideally the data be obtained from VPN
plugins.

(No functional change, only moving the function).
2015-12-12 17:37:30 +01:00
Jiří Klimeš
f28d311d13 clients: accept service without org.freedesktop.NetworkManager prefix
in nm_vpn_get_plugin_by_service()
2015-12-05 21:29:00 +01:00
Jiří Klimeš
96ab3a8a5c clients: add GError parameter to nm_vpn_get_plugin_by_service() 2015-12-05 21:29:00 +01:00
Jiří Klimeš
191f213c49 clients: (trivial) remove unused commented code in nm-vpn-helpers 2015-11-26 11:09:15 +01:00
Jiří Klimeš
b8d6bd1a98 clients: move clients/tui/vpn-helpers.c to clients/common/nm-vpn-helpers.c
The file has not been used up to now. But it is going to be used by both
nmtui and nmcli later.
2015-11-26 11:08:44 +01:00