comparison cinst/mozilla.c @ 390:eab288779e07

Added debug output in NSS_cert_name on failure
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Apr 2014 20:26:05 +0200
parents 81a205fc651e
children 17e1c8f37d72
comparison
equal deleted inserted replaced
389:3be838c3e4d8 390:eab288779e07
364 * @param[in] secitemp ponts to an SECItem holding the DER certificate. 364 * @param[in] secitemp ponts to an SECItem holding the DER certificate.
365 * @retruns a string of the from "CN of Subject - O of Subject" 365 * @retruns a string of the from "CN of Subject - O of Subject"
366 */ 366 */
367 static char * 367 static char *
368 nss_cert_name(SECItem *secitemp) 368 nss_cert_name(SECItem *secitemp)
369 { char *cn_str, *o_str, *name; 369 {
370 char *cn_str, *o_str, *name;
370 size_t name_len; 371 size_t name_len;
371 cn_str = x509_parse_subject(secitemp->data, secitemp->len, CERT_OID_CN); 372 cn_str = x509_parse_subject(secitemp->data, secitemp->len, CERT_OID_CN);
372 o_str = x509_parse_subject(secitemp->data, secitemp->len, CERT_OID_O); 373 o_str = x509_parse_subject(secitemp->data, secitemp->len, CERT_OID_O);
373 if (!cn_str || !o_str) 374 if (!cn_str || !o_str)
374 { 375 {
375 DEBUGPRINTF("FATAL: Could not parse certificate!"); 376 DEBUGPRINTF("FATAL: Could not parse certificate!");
377 DEBUGPRINTF("data len: %u \n", secitemp->len);
376 exit(ERR_INVALID_CERT); 378 exit(ERR_INVALID_CERT);
377 } 379 }
378 name_len = strlen(cn_str) + strlen(o_str) + 4; 380 name_len = strlen(cn_str) + strlen(o_str) + 4;
379 name = (char *)xmalloc(name_len); 381 name = (char *)xmalloc(name_len);
380 snprintf(name, name_len, "%s - %s", cn_str, o_str); 382 snprintf(name, name_len, "%s - %s", cn_str, o_str);

http://wald.intevation.org/projects/trustbridge/