[gnome-keyring] [ssh-store] Don't warn on SSHv1 keys.



commit 18b360620e069d5e635378b89c1de519982f5e4c
Author: Stef Walter <stef memberwebs com>
Date:   Sun Feb 7 18:05:18 2010 +0000

    [ssh-store] Don't warn on SSHv1 keys.
    
    Fixes bug #584037. Don't print out any warning when
    encountering SSH v1 keys in ~/.ssh

 pkcs11/ssh-store/gck-ssh-module.c      |   10 ++++++----
 pkcs11/ssh-store/gck-ssh-openssh.c     |    7 +++++--
 pkcs11/ssh-store/gck-ssh-private-key.c |    6 ++++--
 3 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/pkcs11/ssh-store/gck-ssh-module.c b/pkcs11/ssh-store/gck-ssh-module.c
index 5e7813b..b9fa2cf 100644
--- a/pkcs11/ssh-store/gck-ssh-module.c
+++ b/pkcs11/ssh-store/gck-ssh-module.c
@@ -129,11 +129,13 @@ file_load (GckFileTracker *tracker, const gchar *path, GckSshModule *self)
 	
 	/* Parse the data into the key */
 	if (!gck_ssh_private_key_parse (key, path, private_path, &error)) {
-		g_message ("couldn't parse data: %s: %s", path,
-		           error && error->message ? error->message : "");
-		g_clear_error (&error);
+		if (error) {
+			g_message ("couldn't parse data: %s: %s", path,
+			           error->message ? error->message : "");
+			g_clear_error (&error);
+		}
 		gck_object_expose (GCK_OBJECT (key), FALSE);
-		
+
 	/* When successful register with the object manager */
 	} else {
 		gck_object_expose (GCK_OBJECT (key), TRUE);
diff --git a/pkcs11/ssh-store/gck-ssh-openssh.c b/pkcs11/ssh-store/gck-ssh-openssh.c
index 9fc621f..14195ff 100644
--- a/pkcs11/ssh-store/gck-ssh-openssh.c
+++ b/pkcs11/ssh-store/gck-ssh-openssh.c
@@ -306,8 +306,11 @@ gck_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
 	/* Parse the key type */
 	val = g_strndup ((gchar*)data, at - data);
 	algo = keytype_to_algo (val);
-	if (!algo) 
-		g_message ("Unsupported or unknown SSH key algorithm: %s", val);
+	if (!algo) {
+		/* A number usually means an SSH1 key, just quietly ignore */
+		if (atoi (val) == 0)
+			g_message ("Unsupported or unknown SSH key algorithm: %s", val);
+	}
 	g_free (val);
 	if (!algo)
 		return GCK_DATA_UNRECOGNIZED;
diff --git a/pkcs11/ssh-store/gck-ssh-private-key.c b/pkcs11/ssh-store/gck-ssh-private-key.c
index eb28786..fbf2bef 100644
--- a/pkcs11/ssh-store/gck-ssh-private-key.c
+++ b/pkcs11/ssh-store/gck-ssh-private-key.c
@@ -332,8 +332,10 @@ gck_ssh_private_key_parse (GckSshPrivateKey *self, const gchar *public_path,
 	/* Parse it */
 	res = gck_ssh_openssh_parse_public_key (public_data, n_public_data, &sexp, &comment);
 	g_free (public_data);
-	
-	if (res != GCK_DATA_SUCCESS) {
+
+	if (res == GCK_DATA_UNRECOGNIZED) {
+		return FALSE;
+	} else if (res != GCK_DATA_SUCCESS) {
 		g_set_error_literal (error, GCK_DATA_ERROR, res, _("Couldn't parse public SSH key"));
 		return FALSE;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]