On 02.01.2011 19:35, Stefan Fritsch wrote: > On Sunday 02 January 2011, Rüdiger Plüm wrote: >>> Modified: httpd/httpd/trunk/modules/ssl/ssl_util_ssl.c >>> URL: >>> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_u >>> til_ssl.c?rev=1054323&r1=1054322&r2=1054323&view=diff >>> ================================================================ >>> ============== --- httpd/httpd/trunk/modules/ssl/ssl_util_ssl.c >>> (original) +++ httpd/httpd/trunk/modules/ssl/ssl_util_ssl.c Sat >>> Jan 1 23:56:24 2011 @@ -344,14 +344,32 @@ BOOL >>> SSL_X509_getBC(X509 *cert, int *ca, >>> >>> #endif >>> } >>> >>> +/* convert a NAME_ENTRY to UTF8 string */ >>> +char *SSL_X509_NAME_ENTRY_to_string(apr_pool_t *p, >>> X509_NAME_ENTRY *xsne) +{ >>> + char *result = NULL; >>> + BIO* bio; >>> + int len; >>> + >>> + if ((bio = BIO_new(BIO_s_mem())) == NULL) >>> + return NULL; >>> + ASN1_STRING_print_ex(bio, X509_NAME_ENTRY_get_data(xsne), >>> + >>> ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_UTF8_CONVERT); + len = >>> BIO_pending(bio); >>> + result = apr_palloc(p, len+1); >>> + len = BIO_read(bio, result, len); >>> + result[len] = NUL; >>> + BIO_free(bio); >>> + ap_xlate_proto_from_ascii(value, len); >> >> Shouldn't that be ap_xlate_proto_from_ascii(result, len); instead? > > Of course, thanks. Fixed in r1054453.
I would suggest to drop the ap_xlate_proto_from_ascii line completely, for several reasons: "result" is now a UTF-8 encoded string (i.e., might well include non-ASCII characters, differently encoded than ISO-8859-1), ap_xlate_proto_from_ascii is a NOOP for non-EBCDIC platforms, and third, on EBCDIC platforms, ap_xlate_proto_from_ascii simply does nothing (it calls apr_xlate_conv_buffer, which returns APR_ENOTIMPL, even in current versions of APR-util, IIMN). Kaspar