check for missing parts in the certificates
authorColin Leroy <colin@colino.net>
Sat, 16 Nov 2002 14:47:31 +0000 (14:47 +0000)
committerColin Leroy <colin@colino.net>
Sat, 16 Nov 2002 14:47:31 +0000 (14:47 +0000)
ChangeLog.claws
configure.in
src/ssl_certificate.c

index 4af941c..89a22c8 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-15 [colin]     0.8.5claws157
+
+       * src/ssl_certificate.c
+               Check for missing parts in the certificates
+
 2002-11-15 [colin]     0.8.5claws156
 
        * src/folderview.c
index 118c15b..8b5a353 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws156
+EXTRA_VERSION=claws157
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index f2d7ff5..c467f97 100644 (file)
@@ -121,33 +121,53 @@ char* ssl_certificate_to_string(SSLCertificate *cert)
        unsigned char md[EVP_MAX_MD_SIZE];      
        
        /* issuer */    
-        X509_NAME_get_text_by_NID(X509_get_issuer_name(cert->x509_cert), 
-                                       NID_commonName, buf, 100);
-        issuer_commonname = g_strdup(buf);
-        X509_NAME_get_text_by_NID(X509_get_issuer_name(cert->x509_cert), 
-                                       NID_localityName, buf, 100);
-        issuer_location = g_strdup(buf);
-        X509_NAME_get_text_by_NID(X509_get_issuer_name(cert->x509_cert), 
-                                       NID_countryName, buf, 100);
-        issuer_location = g_strconcat(issuer_location,", ",buf, NULL);
-        X509_NAME_get_text_by_NID(X509_get_issuer_name(cert->x509_cert), 
-                                       NID_organizationName, buf, 100);
-        issuer_organization = g_strdup(buf);
+       if (X509_NAME_get_text_by_NID(X509_get_issuer_name(cert->x509_cert), 
+                                      NID_commonName, buf, 100) >= 0)
+               issuer_commonname = g_strdup(buf);
+       else
+               issuer_commonname = g_strdup(_("<not in certificate>"));
+       if (X509_NAME_get_text_by_NID(X509_get_issuer_name(cert->x509_cert), 
+                                      NID_localityName, buf, 100) >= 0) {
+               issuer_location = g_strdup(buf);
+               if (X509_NAME_get_text_by_NID(X509_get_issuer_name(cert->x509_cert), 
+                                      NID_countryName, buf, 100))
+                       issuer_location = g_strconcat(issuer_location,", ",buf, NULL);
+       } else if (X509_NAME_get_text_by_NID(X509_get_issuer_name(cert->x509_cert), 
+                                      NID_countryName, buf, 100) >= 0)
+               issuer_location = g_strdup(buf);
+       else
+               issuer_location = g_strdup(_("<not in certificate>"));
 
-       /* issuer */    
-        X509_NAME_get_text_by_NID(X509_get_subject_name(cert->x509_cert), 
-                                       NID_commonName, buf, 100);
-        subject_commonname = g_strdup(buf);
-        X509_NAME_get_text_by_NID(X509_get_subject_name(cert->x509_cert), 
-                                       NID_localityName, buf, 100);
-        subject_location = g_strdup(buf);
-        X509_NAME_get_text_by_NID(X509_get_subject_name(cert->x509_cert), 
-                                       NID_countryName, buf, 100);
-        subject_location = g_strconcat(subject_location,", ",buf, NULL);
-        X509_NAME_get_text_by_NID(X509_get_subject_name(cert->x509_cert), 
-                                       NID_organizationName, buf, 100);
-        subject_organization = g_strdup(buf);
-                
+       if (X509_NAME_get_text_by_NID(X509_get_issuer_name(cert->x509_cert), 
+                                      NID_organizationName, buf, 100) >= 0)
+               issuer_organization = g_strdup(buf);
+       else 
+               issuer_organization = g_strdup(_("<not in certificate>"));
+        
+       /* subject */   
+       if (X509_NAME_get_text_by_NID(X509_get_subject_name(cert->x509_cert), 
+                                      NID_commonName, buf, 100) >= 0)
+               subject_commonname = g_strdup(buf);
+       else
+               subject_commonname = g_strdup(_("<not in certificate>"));
+       if (X509_NAME_get_text_by_NID(X509_get_subject_name(cert->x509_cert), 
+                                      NID_localityName, buf, 100) >= 0) {
+               subject_location = g_strdup(buf);
+               if (X509_NAME_get_text_by_NID(X509_get_subject_name(cert->x509_cert), 
+                                      NID_countryName, buf, 100) >= 0)
+                       subject_location = g_strconcat(subject_location,", ",buf, NULL);
+       } else if (X509_NAME_get_text_by_NID(X509_get_subject_name(cert->x509_cert), 
+                                      NID_countryName, buf, 100) >= 0)
+               subject_location = g_strdup(buf);
+       else
+               subject_location = g_strdup(_("<not in certificate>"));
+
+       if (X509_NAME_get_text_by_NID(X509_get_subject_name(cert->x509_cert), 
+                                      NID_organizationName, buf, 100) >= 0)
+               subject_organization = g_strdup(buf);
+       else 
+               subject_organization = g_strdup(_("<not in certificate>"));
+        
        /* fingerprint */
        X509_digest(cert->x509_cert, EVP_md5(), md, &n);
        fingerprint = readable_fingerprint(md, (int)n);