Displaying 1 result from an estimated 1 matches for "x509_n_gtbn".
2006 Jun 01
1
ssl-proxy: client certificates and crl check
...ar buf[256];
const char *name;
if (!ssl_proxy_has_valid_client_cert(proxy))
@@ -508,10 +508,16 @@
if (x509 == NULL)
return NULL; /* we should have had it.. */
- X509_NAME_oneline(X509_get_subject_name(x509), buf, sizeof(buf));
- name = t_strndup(buf, sizeof(buf));
+ /* HJHJ */
+ /* the X509_N_gtbN can return -1 without 0-terminating buf */
+ /* if the call succeeds buf is 0-terminated (openssl 0.9.7e / 0.9.8b src) */
+ buf[0] = '\0';
+ if( X509_NAME_get_text_by_NID(X509_get_subject_name(x509),NID_commonName,buf,sizeof(buf)) < 0 )
+ { buf[0] = '\0'; }
+ name = t_strndup(bu...