[gmime] Parse the signer values for ERRSIG too



commit d12911738689762ac8aec70585dd32695dc74a63
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Fri Mar 4 18:57:07 2011 -0500

    Parse the signer values for ERRSIG too
    
    2011-03-04  Jeffrey Stedfast  <fejj novell com>
    
    	* gmime/gmime-gpg-context.c (gpg_ctx_parse_signer_info): Make
    	* sure
    	to extract the pubkey_algo, hash_algo, sig_class, sig_expires,
    and
    	return-code values for ERRSIG.

 ChangeLog                 |    6 ++++++
 gmime/gmime-gpg-context.c |   35 +++++++++++++++++++++++++++--------
 2 files changed, 33 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f6c4ab6..fa94992 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-03-04  Jeffrey Stedfast  <fejj novell com>
 
+	* gmime/gmime-gpg-context.c (gpg_ctx_parse_signer_info): Make sure
+	to extract the pubkey_algo, hash_algo, sig_class, sig_expires, and
+	return-code values for ERRSIG.
+
+2011-03-04  Jeffrey Stedfast  <fejj novell com>
+
 	Implemented bug #641319.
 
 	* gmime/gmime-crypto-context.c (g_mime_crypto_recipient_*): New
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index 6351603..7be7e4c 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -903,20 +903,39 @@ gpg_ctx_parse_signer_info (struct _GpgCtx *gpg, char *status)
 		/* get the key id of the signer */
 		status = next_token (status, &signer->keyid);
 		
-		/* skip the pubkey_algo */
-		status = next_token (status, NULL);
+		/* the second token is the public-key algorithm id */
+		signer->pubkey_algo = gpg_pubkey_algo (strtoul (status, &inend, 10));
+		if (inend == status || *inend != ' ')
+			return;
 		
-		/* skip the digest_algo */
-		status = next_token (status, NULL);
+		status = inend + 1;
 		
-		/* skip the class */
-		status = next_token (status, NULL);
+		/* the third token is the hash algorithm id */
+		signer->hash_algo = gpg_hash_algo (strtoul (status, &inend, 10));
+		if (inend == status || *inend != ' ')
+			return;
 		
-		/* get the signature expiration date (or 0 for never) */
+		status = inend + 1;
+		
+		/* the fourth token is the signature class */
+		signer->sig_class = strtoul (status, &inend, 10);
+		if (inend == status || *inend != ' ') {
+			signer->sig_class = 0;
+			return;
+		}
+		
+		status = inend + 1;
+		
+		/* the fifth token is the signature expiration date (or 0 for never) */
 		signer->sig_expires = strtoul (status, &inend, 10);
+		if (inend == status || *inend != ' ') {
+			signer->sig_expires = 0;
+			return;
+		}
+		
 		status = inend + 1;
 		
-		/* get the return code */
+		/* the sixth token is the return code */
 		switch (strtol (status, NULL, 10)) {
 		case 4: signer->errors |= GMIME_SIGNER_ERROR_UNSUPP_ALGO; break;
 		case 9: signer->errors |= GMIME_SIGNER_ERROR_NO_PUBKEY; break;



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