[evolution-patches] 69615, s/mime cert auth crash




as in the bug report, libnss really only works with a single global password function.

this patch removes all knowledge of such a password function from camel, and leaves it to e-cert-db to work.  i think the e-cert-db is initialised at the start so it should always be available.

i dont have a cert handy so i don't know if it works in all cases.  or if bugs like http://bugzilla.ximian.com/show_bug.cgi?id=52835 come back as a result - i did one test viewing the one message i have, and it worked ok.

it also contains 2 lines from one of the previous unreviewed patches that i forgot to include in the previous patch, so that should be considered along with that one Jeff.

--
Michael Zucchi <notzed ximian com>
"Free Software, putting the Free back in Free Market."
Novell's Evolution and Free Software Developer
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2251.2.23
diff -u -p -r1.2251.2.23 ChangeLog
--- camel/ChangeLog	22 Nov 2004 01:51:18 -0000	1.2251.2.23
+++ camel/ChangeLog	23 Nov 2004 03:39:19 -0000
@@ -1,3 +1,11 @@
+2004-11-23  Not Zed  <NotZed Ximian com>
+
+	** See bug #69615.
+
+	* camel-smime-context.c (sm_get_passwd): removed.  All callers
+	that passed it now pass NULL.  This is so we don't override the
+	password function set by e-cert-db.  Seems to work ok, I think.
+
 2004-11-10  Not Zed  <NotZed Ximian com>
 
 	** See bug #69109.
Index: camel/camel-service.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-service.c,v
retrieving revision 1.90.14.5
diff -u -p -r1.90.14.5 camel-service.c
--- camel/camel-service.c	22 Nov 2004 01:51:18 -0000	1.90.14.5
+++ camel/camel-service.c	23 Nov 2004 03:39:20 -0000
@@ -969,15 +969,13 @@ cs_getnameinfo(void *data)
 
 	if (msg->host) {
 		g_free(msg->host);
-		msg->host = NULL;
 		if (msg->result == 0 && h.h_name && h.h_name[0]) {
 			msg->host = g_strdup(h.h_name);
-		} else if ((msg->flags & NI_NAMEREQD) == 0) {
+		} else {
 			unsigned char *in = (unsigned char *)&sin->sin_addr;
 			
 			/* sin_addr is always network order which is big-endian */
 			msg->host = g_strdup_printf("%u.%u.%u.%u", in[0], in[1], in[2], in[3]);
-			msg->result = 0;
 		}
 	}
 
Index: camel/camel-smime-context.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-smime-context.c,v
retrieving revision 1.37
diff -u -p -r1.37 camel-smime-context.c
--- camel/camel-smime-context.c	13 Jul 2004 04:05:10 -0000	1.37
+++ camel/camel-smime-context.c	23 Nov 2004 03:39:20 -0000
@@ -85,37 +85,6 @@ sm_decrypt_key(void *arg, SECAlgorithmID
 	return (PK11SymKey *)arg;
 }
 
-static char *
-sm_get_passwd(PK11SlotInfo *info, PRBool retry, void *arg)
-{
-	CamelSMIMEContext *context = arg;
-	char *pass, *nsspass = NULL;
-	char *prompt;
-	CamelException *ex;
-
-	ex = camel_exception_new();
-
-	/* we got a password, but its asking again, the password we had was wrong */
-	if (context->priv->password_tries > 0) {
-		camel_session_forget_password(((CamelCipherContext *)context)->session, NULL, NULL, PK11_GetTokenName(info), NULL);
-		context->priv->password_tries = 0;
-	}
-
-	prompt = g_strdup_printf(_("Enter security pass-phrase for `%s'"), PK11_GetTokenName(info));
-	pass = camel_session_get_password(((CamelCipherContext *)context)->session, NULL, NULL, prompt,
-					  PK11_GetTokenName(info), CAMEL_SESSION_PASSWORD_SECRET|CAMEL_SESSION_PASSWORD_STATIC, ex);
-	camel_exception_free(ex);
-	g_free(prompt);
-	if (pass) {
-		nsspass = PORT_Strdup(pass);
-		memset(pass, 0, strlen(pass));
-		g_free(pass);
-		context->priv->password_tries++;
-	}
-	
-	return nsspass;
-}
-
 /**
  * camel_smime_context_new:
  * @session: session
@@ -184,7 +153,7 @@ camel_smime_context_describe_part(CamelS
 
 		dec = NSS_CMSDecoder_Start(NULL, 
 					   NULL, NULL,
-					   sm_get_passwd, context,	/* password callback    */
+					   NULL, NULL,	/* password callback    */
 					   NULL, NULL); /* decrypt key callback */
 		
 		NSS_CMSDecoder_Update(dec, istream->buffer->data, istream->buffer->len);
@@ -422,8 +391,8 @@ sm_sign(CamelCipherContext *context, con
 
 	enc = NSS_CMSEncoder_Start(cmsg, 
 				   sm_write_stream, ostream, /* DER output callback  */
-				   NULL, NULL, /* destination storage  */
-				   sm_get_passwd, context, /* password callback    */
+				   NULL, NULL,     /* destination storage  */
+				   NULL, NULL,	   /* password callback    */
 				   NULL, NULL,     /* decrypt key callback */
 				   NULL, NULL );   /* detached digests    */
 	if (!enc) {
@@ -742,7 +711,7 @@ sm_verify(CamelCipherContext *context, C
 
 	dec = NSS_CMSDecoder_Start(NULL, 
 				   NULL, NULL, /* content callback     */
-				   sm_get_passwd, context,	/* password callback    */
+				   NULL, NULL, 	/* password callback    */
 				   NULL, NULL); /* decrypt key callback */
 
 	camel_data_wrapper_decode_to_stream(camel_medium_get_content_object((CamelMedium *)sigpart), (CamelStream *)mem);
@@ -870,7 +839,7 @@ sm_encrypt(CamelCipherContext *context, 
 	enc = NSS_CMSEncoder_Start(cmsg,
 				   sm_write_stream, ostream,
 				   NULL, NULL,
-				   sm_get_passwd, context,
+				   NULL, NULL,
 				   sm_decrypt_key, bulkkey,
 				   NULL, NULL);
 	if (enc == NULL) {
@@ -962,7 +931,7 @@ sm_decrypt(CamelCipherContext *context, 
 
 	dec = NSS_CMSDecoder_Start(NULL, 
 				   sm_write_stream, ostream, /* content callback     */
-				   sm_get_passwd, context,	/* password callback    */
+				   NULL, NULL,
 				   NULL, NULL); /* decrypt key callback */
 
 	if (NSS_CMSDecoder_Update(dec, istream->buffer->data, istream->buffer->len) != SECSuccess) {


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