NetworkManager r4230 - in trunk/vpn-daemons/openvpn: . properties
- From: tambeti svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r4230 - in trunk/vpn-daemons/openvpn: . properties
- Date: Tue, 28 Oct 2008 11:49:41 +0000 (UTC)
Author: tambeti
Date: Tue Oct 28 11:49:41 2008
New Revision: 4230
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4230&view=rev
Log:
2008-10-28 Tambet Ingo <tambet gmail com>
Patch from Bin Li <libin charles gmail com>.
* properties/import-export.c (handle_path_item): Search for certificates
from the directory where the configuration file is from.
Modified:
trunk/vpn-daemons/openvpn/ChangeLog
trunk/vpn-daemons/openvpn/properties/import-export.c
Modified: trunk/vpn-daemons/openvpn/properties/import-export.c
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/import-export.c (original)
+++ trunk/vpn-daemons/openvpn/properties/import-export.c Tue Oct 28 11:49:41 2008
@@ -61,9 +61,10 @@
const char *tag,
const char *key,
GHashTable *hash,
+ const char *path,
char **leftover)
{
- char *tmp, *file, *unquoted, *p;
+ char *tmp, *file, *unquoted, *p, *full_path;
gboolean quoted = FALSE;
if (leftover)
@@ -77,6 +78,12 @@
if (!strlen (file))
goto out;
+ /* If file isn't an absolute file name, add the default path */
+ if (!g_path_is_absolute (file)) {
+ full_path = g_build_filename (path, file, NULL);
+ file = full_path;
+ }
+
/* Simple unquote */
if ((file[0] == '"') || (file[0] == '\'')) {
quoted = TRUE;
@@ -108,6 +115,8 @@
out:
g_free (tmp);
+ if (full_path)
+ g_free (full_path);
return TRUE;
}
@@ -162,7 +171,8 @@
gboolean have_client = FALSE, have_remote = FALSE;
gboolean have_pass = FALSE, have_sk = FALSE;
const char *ctype = NULL;
- const char *basename;
+ char *basename;
+ char *default_path;
connection = nm_connection_new ();
s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
@@ -170,6 +180,10 @@
s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_OPENVPN);
+
+ /* Get the default path for ca, cert, key file, these files maybe
+ * in same path with the configuration file */
+ default_path = g_path_get_dirname (path);
basename = g_path_get_basename (path);
last_dot = strrchr (basename, '.');
@@ -255,17 +269,17 @@
continue;
}
- if (handle_path_item (*line, CA_TAG, NM_OPENVPN_KEY_CA, s_vpn->data, NULL))
+ if (handle_path_item (*line, CA_TAG, NM_OPENVPN_KEY_CA, s_vpn->data, default_path, NULL))
continue;
- if (handle_path_item (*line, CERT_TAG, NM_OPENVPN_KEY_CERT, s_vpn->data, NULL))
+ if (handle_path_item (*line, CERT_TAG, NM_OPENVPN_KEY_CERT, s_vpn->data, default_path, NULL))
continue;
- if (handle_path_item (*line, KEY_TAG, NM_OPENVPN_KEY_KEY, s_vpn->data, NULL))
+ if (handle_path_item (*line, KEY_TAG, NM_OPENVPN_KEY_KEY, s_vpn->data, default_path, NULL))
continue;
if (handle_path_item (*line, SECRET_TAG, NM_OPENVPN_KEY_STATIC_KEY,
- s_vpn->data, &leftover)) {
+ s_vpn->data, default_path, &leftover)) {
handle_direction ("secret",
NM_OPENVPN_KEY_STATIC_KEY_DIRECTION,
leftover,
@@ -274,7 +288,7 @@
}
if (handle_path_item (*line, TLS_AUTH_TAG, NM_OPENVPN_KEY_TA,
- s_vpn->data, &leftover)) {
+ s_vpn->data, default_path, &leftover)) {
handle_direction ("tls-auth",
NM_OPENVPN_KEY_TA_DIR,
leftover,
@@ -365,6 +379,8 @@
g_strdup (ctype));
}
+ g_free (default_path);
+
nm_connection_add_setting (connection, NM_SETTING (s_vpn));
return connection;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]