NetworkManager r4042 - in trunk: . libnm-util
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r4042 - in trunk: . libnm-util
- Date: Fri, 5 Sep 2008 18:10:39 +0000 (UTC)
Author: dcbw
Date: Fri Sep 5 18:10:39 2008
New Revision: 4042
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4042&view=rev
Log:
2008-09-05 Dan Williams <dcbw redhat com>
* libnm-util/crypto_nss.c
libnm-util/crypto_gnutls.c
libnm-util/crypto.h
- (crypto_init): return error when init fails
Modified:
trunk/ChangeLog
trunk/libnm-util/crypto.h
trunk/libnm-util/crypto_gnutls.c
trunk/libnm-util/crypto_nss.c
Modified: trunk/libnm-util/crypto.h
==============================================================================
--- trunk/libnm-util/crypto.h (original)
+++ trunk/libnm-util/crypto.h Fri Sep 5 18:10:39 2008
@@ -29,6 +29,7 @@
enum {
NM_CRYPTO_ERR_NONE = 0,
+ NM_CRYPTO_ERR_INIT_FAILED,
NM_CRYPTO_ERR_CANT_READ_FILE,
NM_CRYPTO_ERR_PEM_FORMAT_INVALID,
NM_CRYPTO_ERR_CERT_FORMAT_INVALID,
Modified: trunk/libnm-util/crypto_gnutls.c
==============================================================================
--- trunk/libnm-util/crypto_gnutls.c (original)
+++ trunk/libnm-util/crypto_gnutls.c Fri Sep 5 18:10:39 2008
@@ -34,8 +34,16 @@
gboolean
crypto_init (GError **error)
{
- if (refcount == 0)
- gnutls_global_init();
+ if (refcount == 0) {
+ if (gnutls_global_init() != 0) {
+ gnutls_global_deinit();
+ g_set_error (error, NM_CRYPTO_ERROR,
+ NM_CRYPTO_ERR_INIT_FAILED,
+ "%s",
+ _("Failed to initialize the crypto engine."));
+ return FALSE;
+ }
+ }
refcount++;
return TRUE;
}
Modified: trunk/libnm-util/crypto_nss.c
==============================================================================
--- trunk/libnm-util/crypto_nss.c (original)
+++ trunk/libnm-util/crypto_nss.c Fri Sep 5 18:10:39 2008
@@ -29,6 +29,7 @@
#include <pk11pub.h>
#include <pkcs11t.h>
#include <cert.h>
+#include <prerror.h>
#include "crypto.h"
@@ -38,8 +39,17 @@
crypto_init (GError **error)
{
if (refcount == 0) {
+ SECStatus ret;
+
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 1);
- NSS_NoDB_Init (NULL);
+ ret = NSS_NoDB_Init (NULL);
+ if (ret != SECSuccess) {
+ g_set_error (error, NM_CRYPTO_ERROR,
+ NM_CRYPTO_ERR_INIT_FAILED,
+ _("Failed to initialize the crypto engine: %d."),
+ PR_GetError ());
+ return FALSE;
+ }
}
refcount++;
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]