sniper Mon Mar 14 16:01:03 2005 EDT Modified files: (Branch: PHP_4_3) /php-src NEWS /php-src/ext/openssl openssl.c Log: MFH: - Fixed bug #18613 (Multiple OUs in x509 certificate not handled properly) http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.855&r2=1.1247.2.856&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.855 php-src/NEWS:1.1247.2.856 --- php-src/NEWS:1.1247.2.855 Mon Mar 14 04:03:08 2005 +++ php-src/NEWS Mon Mar 14 16:01:01 2005 @@ -100,6 +100,7 @@ - Fixed bug #28067 (partially incorrect utf8 to htmlentities mapping). (Derick, Benjamin Greiner) - Fixed bug #27633 (Double \r problem on ftp_get in ASCII mode on Win32). (Ilia) +- Fixed bug #18613 (Multiple OUs in x509 certificate not handled properly). (Jani) - Fixed bug #7782 (Cannot use PATH_INFO fully with php isapi). (Unknown) 15 Dec 2004, Version 4.3.10 http://cvs.php.net/diff.php/php-src/ext/openssl/openssl.c?r1=1.52.2.20&r2=1.52.2.21&ty=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.52.2.20 php-src/ext/openssl/openssl.c:1.52.2.21 --- php-src/ext/openssl/openssl.c:1.52.2.20 Thu Feb 17 04:26:10 2005 +++ php-src/ext/openssl/openssl.c Mon Mar 14 16:01:02 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.52.2.20 2005/02/17 09:26:10 sniper Exp $ */ +/* $Id: openssl.c,v 1.52.2.21 2005/03/14 21:01:02 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -208,9 +208,9 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname TSRMLS_DC) { - zval * subitem; - int i; - char * sn, * ln; + zval *subitem, *subentries; + int i, j = -1, last = -1, obj_cnt = 0; + char *sname; int nid; X509_NAME_ENTRY * ne; ASN1_STRING * str; @@ -222,14 +222,39 @@ for (i = 0; i < X509_NAME_entry_count(name); i++) { ne = X509_NAME_get_entry(name, i); obj = X509_NAME_ENTRY_get_object(ne); - str = X509_NAME_ENTRY_get_data(ne); nid = OBJ_obj2nid(obj); + obj_cnt = 0; + if (shortname) { - sn = (char*)OBJ_nid2sn(nid); - add_assoc_stringl(subitem, sn, str->data, str->length, 1); + sname = (char *) OBJ_nid2sn(nid); + } else { + sname = (char *) OBJ_nid2ln(nid); + } + + MAKE_STD_ZVAL(subentries); + array_init(subentries); + + last = -1; + for (;;) { + j = X509_NAME_get_index_by_OBJ(name, obj, last); + if (j < 0) { + if (last != -1) break; + } else { + obj_cnt++; + ne = X509_NAME_get_entry(name, j); + str = X509_NAME_ENTRY_get_data(ne); + add_next_index_stringl(subentries, str->data, str->length, 1); + } + last = j; + } + i = last; + + if (obj_cnt > 1) { + add_assoc_zval_ex(subitem, sname, strlen(sname) + 1, subentries); } else { - ln = (char*)OBJ_nid2ln(nid); - add_assoc_stringl(subitem, ln, str->data, str->length, 1); + zval_dtor(subentries); + FREE_ZVAL(subentries); + add_assoc_stringl(subitem, sname, str->data, str->length, 1); } } zend_hash_update(HASH_OF(val), key, strlen(key) + 1, (void *)&subitem, sizeof(subitem), NULL);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php