Display all SSL certificates from the chain to the user to approve.

This commit is contained in:
Klaas Freitag 2012-12-19 18:06:36 +01:00
parent 3343601179
commit a880949836

View file

@ -389,17 +389,19 @@ static void addSSLWarning( char *ptr, const char *warn, int len )
*/ */
#define LEN 4096 #define LEN 4096
static int verify_sslcert(void *userdata, int failures, static int verify_sslcert(void *userdata, int failures,
const ne_ssl_certificate *cert) const ne_ssl_certificate *certificate)
{ {
char problem[LEN]; char problem[LEN];
char buf[MAX(NE_SSL_DIGESTLEN, NE_ABUFSIZ)]; char buf[MAX(NE_SSL_DIGESTLEN, NE_ABUFSIZ)];
int ret = -1; int ret = -1;
const ne_ssl_certificate *cert = certificate;
(void) userdata; (void) userdata;
(void) cert;
(void) userdata; (void) userdata;
memset( problem, 0, LEN ); memset( problem, 0, LEN );
while( cert ) {
addSSLWarning( problem, "There are problems with the SSL certificate:\n", LEN ); addSSLWarning( problem, "There are problems with the SSL certificate:\n", LEN );
if( failures & NE_SSL_NOTYETVALID ) { if( failures & NE_SSL_NOTYETVALID ) {
addSSLWarning( problem, " * The certificate is not yet valid.\n", LEN ); addSSLWarning( problem, " * The certificate is not yet valid.\n", LEN );
@ -427,8 +429,9 @@ static int verify_sslcert(void *userdata, int failures,
addSSLWarning( problem, buf, LEN ); addSSLWarning( problem, buf, LEN );
addSSLWarning( problem, "\n", LEN ); addSSLWarning( problem, "\n", LEN );
} }
cert = ne_ssl_cert_signedby( cert );
addSSLWarning( problem, "Do you want to accept the certificate anyway?\nAnswer yes to do so and take the risk: ", LEN ); }
addSSLWarning( problem, "Do you want to accept the certificate chain anyway?\nAnswer yes to do so and take the risk: ", LEN );
if( _authcb ){ if( _authcb ){
/* call the csync callback */ /* call the csync callback */