Mercurial > pidgin
comparison libpurple/plugins/ssl/ssl-nss.c @ 19071:d224a1e4b919
- x509_nss get_subject_name (x509_common_name)
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Fri, 03 Aug 2007 07:26:32 +0000 |
parents | 7ccb5ab3e07e |
children | 4bdf4ce3473b |
comparison
equal
deleted
inserted
replaced
19070:7ccb5ab3e07e | 19071:d224a1e4b919 |
---|---|
477 } | 477 } |
478 | 478 |
479 static gchar * | 479 static gchar * |
480 x509_common_name (PurpleCertificate *crt) | 480 x509_common_name (PurpleCertificate *crt) |
481 { | 481 { |
482 return NULL; | 482 CERTCertificate *crt_dat; |
483 char *nss_cn; | |
484 gchar *ret_cn; | |
485 | |
486 g_return_val_if_fail(crt, NULL); | |
487 g_return_val_if_fail(crt->scheme == &x509_nss, NULL); | |
488 | |
489 crt_dat = X509_NSS_DATA(crt); | |
490 g_return_val_if_fail(crt_dat, NULL); | |
491 | |
492 /* Q: | |
493 Why get a newly allocated string out of NSS, strdup it, and then | |
494 return the new copy? | |
495 | |
496 A: | |
497 The NSS LXR docs state that I should use the NSPR free functions on | |
498 the strings that the NSS cert functions return. Since the libpurple | |
499 API expects a g_free()-able string, we make our own copy and return | |
500 that. | |
501 | |
502 NSPR is something of a prima donna. */ | |
503 | |
504 nss_cn = CERT_GetCommonName( &(crt_dat->subject) ); | |
505 ret_cn = g_strdup(nss_cn); | |
506 PORT_Free(nss_cn); | |
507 | |
508 return ret_cn; | |
483 } | 509 } |
484 | 510 |
485 static gboolean | 511 static gboolean |
486 x509_check_name (PurpleCertificate *crt, const gchar *name) | 512 x509_check_name (PurpleCertificate *crt, const gchar *name) |
487 { | 513 { |