/* Verify using all signerInfos */
list_for_each_entry ( info, &sig->info, list ) {
cert = x509_first ( info->chain );
- if ( name && ( strcmp ( name, cert->subject.name ) != 0 ) )
+ if ( name && ( ( cert->subject.name == NULL ) ||
+ ( strcmp ( cert->subject.name, name ) != 0 ) ) )
continue;
if ( ( rc = cms_verify_signer_info ( sig, info, data, len,
time, root ) ) != 0 )
return rc;
}
- /* Allocate name */
+ /* Allocate and copy name */
*name = zalloc ( name_cursor.len + 1 /* NUL */ );
if ( ! *name )
return -ENOMEM;
return 0;
}
+ /* Certificates may not have a commonName */
DBGC ( cert, "X509 %p no commonName found:\n", cert );
- DBGC_HDA ( cert, 0, raw->data, raw->len );
- return -ENOENT;
+ return 0;
}
/**
assert ( cert != NULL );
/* Verify server name */
- if ( strcmp ( tls->name, cert->subject.name ) != 0 ) {
+ if ( ( cert->subject.name == NULL ) ||
+ ( strcmp ( cert->subject.name, tls->name ) != 0 ) ) {
DBGC ( tls, "TLS %p server name incorrect (expected %s, got "
"%s)\n", tls, tls->name, cert->subject.name );
return -EACCES_WRONG_NAME;