NetworkManager-libreswan/0005-Fixed-dead-code-based-on-coverity-scan.patch
Avesh Agarwal 08f137fc11 New upstream release 0.9.8.4
- Fixed 926225
- Fixed dependency to libreswan.
- Created a new sub package NetworkManager-openswan-gnome
- Various other spec file fixes.
- Additional code changes are as follows:
- Fixed an issue where proper network stack is not loaded unless
  _stackmanager is run before starting pluto daemon service.
- Fixed the termination operation of pluto daemon to comply with
  libreswan changes.
- Fixed various debug messages.
- Fixed initiation of pluto daemon by this plugin to reflect the
  changes in libreaswan.
- Fixed defaults values for more parameters to help the VPN
  connection stay more reliable.
- Rewrote pluto watch API which watches the pluto process for its status.
  Fixed memory leak issues as not all child processes were reaped correctly.
  Also g_spwan_close_pid was not being called after children were reaped.
  Also modified debugs and added more to help with debugging in the future.
- Fixed an issue where nm-openswan service is searching for ipsec binary in
  both /sbin and /usr/sbin leading to same operation twice, as /sbin is just
  symlink to /usr/sbin, so removed /sbin from the search paths.
- Fixed some libreswan related macro changes.
- Fixed netmask issue when sending IP information to the nm openswan
  plugin service.
- Fixed the current code as it does not set the default route field
  NM_VPN_PLUGIN_IP4_CONFIG_NEVER_DEFAULT when sending VPN information
  to nm-openswan plugin. This fix sets the field to TRUE.
- Fixed some issues found by coverity scan.
- Fixed an issue where writing configuration on stdin should not end with
  \n as it gives error. It used to work previously, but not with latest
  NetworkManager versions.
- libreswan related fixes, as some macros have been modified after forking
  to libreswan from openswan.
- openswan/libreswan does not provide tun0 interface, so fixed the code
  where it sends tun0 interface.
- Fix prcoessing of nm-openswan-dialog.ui file and added more error notifications.
- Fixed dead code based on coverity scan.
- Fixed gnomekeyring lib dependencies.
- Fixed Networkmanager and related lib dependencies.
- Fixed gtk label max width issue by setting it to 35.
- NM-openswan was missing support for nm-openswan-auth-dialog.desktop.in.in.
  So added a new nm-openswan-auth-dialog.desktop.in.in, and modified related
  Makefile and configure.ac files.
2013-12-10 17:51:36 -05:00

146 lines
5.5 KiB
Diff

From ff5dfb0a75d4312ddc923dff637ad180266ff923 Mon Sep 17 00:00:00 2001
From: Avesh Agarwal <avagarwa@redhat.com>
Date: Tue, 10 Dec 2013 13:44:24 -0500
Subject: [PATCH 05/20] Fixed dead code based on coverity scan.
---
properties/nm-openswan.c | 94 ++++++++++++++++--------------------------------
1 file changed, 31 insertions(+), 63 deletions(-)
diff --git a/properties/nm-openswan.c b/properties/nm-openswan.c
index 75acedd..c13de36 100644
--- a/properties/nm-openswan.c
+++ b/properties/nm-openswan.c
@@ -158,6 +158,36 @@ stuff_changed_cb (GtkWidget *widget, gpointer user_data)
}
static void
+setup_password_widget (OpenswanPluginUiWidget *self,
+ const char *entry_name,
+ NMSettingVPN *s_vpn,
+ const char *secret_name,
+ gboolean new_connection)
+{
+ OpenswanPluginUiWidgetPrivate *priv = OPENSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
+ NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
+ GtkWidget *widget;
+ const char *value;
+
+ if (new_connection)
+ secret_flags = NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+
+ widget = (GtkWidget *) gtk_builder_get_object (priv->builder, entry_name);
+ g_assert (widget);
+ gtk_size_group_add_widget (priv->group, widget);
+
+ if (s_vpn) {
+ value = nm_setting_vpn_get_secret (s_vpn, secret_name);
+ gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
+ nm_setting_get_secret_flags (NM_SETTING (s_vpn), secret_name, &secret_flags, NULL);
+ }
+ secret_flags &= ~(NM_SETTING_SECRET_FLAG_NOT_SAVED | NM_SETTING_SECRET_FLAG_NOT_REQUIRED);
+ g_object_set_data (G_OBJECT (widget), "flags", GUINT_TO_POINTER (secret_flags));
+
+ g_signal_connect (widget, "changed", G_CALLBACK (stuff_changed_cb), self);
+}
+
+static void
show_toggled_cb (GtkCheckButton *button, OpenswanPluginUiWidget *self)
{
OpenswanPluginUiWidgetPrivate *priv = OPENSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
@@ -301,35 +331,6 @@ init_one_pw_combo (OpenswanPluginUiWidget *self,
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (pw_type_combo_changed_cb), self);
}
-static void
-setup_password_widget (OpenswanPluginUiWidget *self,
- const char *entry_name,
- NMSettingVPN *s_vpn,
- const char *secret_name,
- gboolean new_connection)
-{
- OpenswanPluginUiWidgetPrivate *priv = OPENSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
- NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
- GtkWidget *widget;
- const char *value;
-
- if (new_connection)
- secret_flags = NM_SETTING_SECRET_FLAG_AGENT_OWNED;
-
- widget = (GtkWidget *) gtk_builder_get_object (priv->builder, entry_name);
- g_assert (widget);
- gtk_size_group_add_widget (priv->group, widget);
-
- if (s_vpn) {
- value = nm_setting_vpn_get_secret (s_vpn, secret_name);
- gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
- nm_setting_get_secret_flags (NM_SETTING (s_vpn), secret_name, &secret_flags, NULL);
- }
- secret_flags &= ~(NM_SETTING_SECRET_FLAG_NOT_SAVED | NM_SETTING_SECRET_FLAG_NOT_REQUIRED);
- g_object_set_data (G_OBJECT (widget), "flags", GUINT_TO_POINTER (secret_flags));
-
- g_signal_connect (widget, "changed", G_CALLBACK (stuff_changed_cb), self);
-}
static gboolean
init_plugin_ui (OpenswanPluginUiWidget *self,
@@ -338,7 +339,7 @@ init_plugin_ui (OpenswanPluginUiWidget *self,
GError **error)
{
OpenswanPluginUiWidgetPrivate *priv = OPENSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
- NMSettingVPN *s_vpn;
+ NMSettingVPN *s_vpn = NULL;
GtkWidget *widget;
const char *value = NULL;
@@ -435,24 +436,6 @@ init_plugin_ui (OpenswanPluginUiWidget *self,
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
- /*widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "disable_dpd_checkbutton"));
- g_return_val_if_fail (widget != NULL, FALSE);
- if (s_vpn) {
- value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENSWAN_DPDTIMEOUT);
- if (value) {
- long int tmp;
-
- errno = 0;
- tmp = strtol (value, NULL, 10);
- if (tmp >= 0 && tmp <= G_MAXUINT32 && errno == 0)
- priv->orig_dpd_timeout = (guint32) tmp;
-
- if (priv->orig_dpd_timeout == 0)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- }
- }
- g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (stuff_changed_cb), self);*/
-
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "show_passwords_checkbutton"));
g_return_val_if_fail (widget != NULL, FALSE);
g_signal_connect (G_OBJECT (widget), "toggled",
@@ -563,21 +546,6 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_OPENSWAN_DOMAIN, str);
- //widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "disable_dpd_checkbutton"));
- //if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
- // nm_setting_vpn_add_data_item (s_vpn, NM_OPENSWAN_DPDTIMEOUT, "0");
- //} else {
- /* If DPD was disabled and now the user wishes to enable it, just
- * don't pass the DPD_IDLE_TIMEOUT option to openswan and thus use the
- * default DPD idle time. Otherwise keep the original DPD idle timeout.
- */
- // if (priv->orig_dpd_timeout >= 10) {
- // char *tmp = g_strdup_printf ("%d", priv->orig_dpd_timeout);
- // nm_setting_vpn_add_data_item (s_vpn, NM_OPENSWAN_DPDTIMEOUT, tmp);
- // g_free (tmp);
- // }
- //}
-
save_one_password (s_vpn,
priv->builder,
"user_password_entry",
--
1.8.3.1