File nm-openvpn-show-unencrypted-private-keys-files.patch of Package NetworkManager-openvpn

commit 6dd966d8a2e97cf2314eb5cd052055526135024c
Author: Dan Williams <dcbw@redhat.com>
Date:   Tue Jan 11 12:28:44 2011 -0600

    properties: fix showing unencrypted private keys in the file chooser (bgo #639191)

diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 0c0df63..2fa36e0 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -695,6 +695,7 @@ static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----";
 static const char *pem_dsa_key_begin = "-----BEGIN DSA PRIVATE KEY-----";
 static const char *pem_pkcs8_key_begin = "-----BEGIN ENCRYPTED PRIVATE KEY-----";
 static const char *pem_cert_begin = "-----BEGIN CERTIFICATE-----";
+static const char *pem_unenc_key_begin = "-----BEGIN PRIVATE KEY-----";
 
 static gboolean
 tls_default_filter (const GtkFileFilterInfo *filter_info, gpointer data)
@@ -760,6 +761,11 @@ tls_default_filter (const GtkFileFilterInfo *filter_info, gpointer data)
 		goto out;
 	}
 
+	if (find_tag (pem_unenc_key_begin, (const char *) contents, bytes_read)) {
+		show = TRUE;
+		goto out;
+	}
+
 out:
 	g_free (contents);
 	return show;
openSUSE Build Service is sponsored by