[dovecot-cvs] dovecot/src/master ssl-init-openssl.c,1.6,1.7

cras at dovecot.org cras at dovecot.org
Wed May 31 16:54:23 EEST 2006


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv16314

Modified Files:
	ssl-init-openssl.c 
Log Message:
Give a nicer error message if i2d_DHparams() returns 0, which apparently it
does in some cases.



Index: ssl-init-openssl.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/ssl-init-openssl.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ssl-init-openssl.c	15 Jan 2006 12:35:04 -0000	1.6
+++ ssl-init-openssl.c	31 May 2006 13:54:21 -0000	1.7
@@ -6,6 +6,7 @@
 
 #ifdef HAVE_OPENSSL
 
+#include <openssl/err.h>
 #include <openssl/ssl.h>
 
 /* 2 or 5. Haven't seen their difference explained anywhere, but 2 is the
@@ -24,7 +25,13 @@
 
 	len = i2d_DHparams(dh, NULL);
 	if (len < 0)
-		i_fatal("i2d_DHparams() failed");
+		i_fatal("i2d_DHparams() failed: %lu", ERR_get_error());
+
+	if (len == 0) {
+		i_fatal("i2d_DHparams() returned 0 for data from "
+			"DH_generate_parameters(bits=%d, generator=%d)",
+			bitsize, DH_GENERATOR);
+	}
 
 	buf = p = i_malloc(len);
 	len = i2d_DHparams(dh, &p);



More information about the dovecot-cvs mailing list