- Fix hang when reading system connections from ifcfg files

This commit is contained in:
Daniel Williams 2008-09-11 20:24:17 +00:00
parent 15a5fd4144
commit b4b7c8b41b
2 changed files with 67 additions and 1 deletions

View File

@ -16,7 +16,7 @@ Name: NetworkManager
Summary: Network connection manager and user applications
Epoch: 1
Version: 0.7.0
Release: 0.11.%{snapshot}.1%{?dist}
Release: 0.11.%{snapshot}.2%{?dist}
Group: System Environment/Base
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
@ -27,6 +27,7 @@ Patch1: NetworkManager-0.6.5-fixup-internal-applet-build.patch
Patch4: serial-debug.patch
Patch5: explain-dns1-dns2.patch
Patch6: wpa-adhoc-fix.patch
Patch7: crypto-init.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
PreReq: chkconfig
@ -148,6 +149,7 @@ tar -xzf %{SOURCE1}
%patch4 -p1 -b .serial-debug
%patch5 -p1 -b .explain-dns1-dns2
%patch6 -p1 -b .wpa-adhoc-fix
%patch7 -p1 -b .crypto-init
%build
autoreconf -i
@ -302,6 +304,9 @@ fi
%{_datadir}/gtk-doc/html/libnm-glib/
%changelog
* Thu Sep 11 2008 Dan Williams <dcbw@redhat.com> - 1:0.7.0-0.11.svn4022.2
- Fix hang when reading system connections from ifcfg files
* Thu Sep 4 2008 Dan Williams <dcbw@redhat.com> - 1:0.7.0-0.11.svn4022.1
- Fix WPA Ad-Hoc connections

61
crypto-init.patch Normal file
View File

@ -0,0 +1,61 @@
diff -up NetworkManager-0.7.0/libnm-util/crypto_nss.c.crypto-init NetworkManager-0.7.0/libnm-util/crypto_nss.c
--- NetworkManager-0.7.0/libnm-util/crypto_nss.c.crypto-init 2008-08-22 12:14:12.000000000 -0400
+++ NetworkManager-0.7.0/libnm-util/crypto_nss.c 2008-09-11 16:22:29.000000000 -0400
@@ -29,27 +29,39 @@
#include <pk11pub.h>
#include <pkcs11t.h>
#include <cert.h>
+#include <prerror.h>
#include "crypto.h"
-static guint32 refcount = 0;
+static gboolean initialized = FALSE;
gboolean
crypto_init (GError **error)
{
- if (refcount == 0) {
- PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 1);
- NSS_NoDB_Init (NULL);
+ SECStatus ret;
+
+ if (initialized)
+ return TRUE;
+
+ PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 1);
+ ret = NSS_NoDB_Init (NULL);
+ if (ret != SECSuccess) {
+ PR_Cleanup ();
+ g_set_error (error, NM_CRYPTO_ERROR,
+ 0,
+ _("Failed to initialize the crypto engine: %d."),
+ PR_GetError ());
+ return FALSE;
}
- refcount++;
+
+ initialized = TRUE;
return TRUE;
}
void
crypto_deinit (void)
{
- refcount--;
- if (refcount == 0) {
+ if (initialized) {
NSS_Shutdown ();
PR_Cleanup ();
}
diff -up NetworkManager-0.7.0/libnm-util/nm-utils.c.crypto-init NetworkManager-0.7.0/libnm-util/nm-utils.c
--- NetworkManager-0.7.0/libnm-util/nm-utils.c.crypto-init 2008-08-22 12:14:12.000000000 -0400
+++ NetworkManager-0.7.0/libnm-util/nm-utils.c 2008-09-11 16:19:25.000000000 -0400
@@ -1152,7 +1152,6 @@ nm_utils_uuid_generate_from_string (cons
out:
g_free (uuid);
- crypto_deinit ();
return buf;
}