comparison libpurple/plugins/ssl/ssl-gnutls.c @ 19493:e147c3a821dd

- Errorchecking in x509_cert_dn
author William Ehlhardt <williamehlhardt@gmail.com>
date Mon, 20 Aug 2007 03:15:30 +0000
parents 447470c8111a
children 280c6ec32ca6
comparison
equal deleted inserted replaced
19492:447470c8111a 19493:e147c3a821dd
764 g_return_val_if_fail(crt, NULL); 764 g_return_val_if_fail(crt, NULL);
765 g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); 765 g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL);
766 766
767 cert_dat = X509_GET_GNUTLS_DATA(crt); 767 cert_dat = X509_GET_GNUTLS_DATA(crt);
768 768
769 /* TODO: Note return values? */
770
771 /* Figure out the length of the Distinguished Name */ 769 /* Figure out the length of the Distinguished Name */
772 /* Claim that the buffer is size 0 so GnuTLS just tells us how much 770 /* Claim that the buffer is size 0 so GnuTLS just tells us how much
773 space it needs */ 771 space it needs */
774 dn_size = 0; 772 dn_size = 0;
775 gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size); 773 gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size);
776 774
777 /* Now allocate and get the Distinguished Name */ 775 /* Now allocate and get the Distinguished Name */
778 dn = g_new0(gchar, dn_size); 776 dn = g_new0(gchar, dn_size);
779 gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size); 777 if (0 != gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size)) {
778 purple_debug_error("gnutls/x509",
779 "Failed to get Distinguished Name\n");
780 g_free(dn);
781 return NULL;
782 }
780 783
781 return dn; 784 return dn;
782 } 785 }
783 786
784 static gchar * 787 static gchar *