]> git.sur5r.net Git - openldap/commitdiff
Partial fix for non-string types in cert DNs. (Need to add explicit support
authorHoward Chu <hyc@openldap.org>
Fri, 10 Dec 2010 02:05:18 +0000 (02:05 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 10 Dec 2010 02:05:18 +0000 (02:05 +0000)
for Bitstring, maybe a few others.)

libraries/libldap/tls2.c

index f258bbbd530e382f2761cc2ccc74061ec004c0d0..eea1b37f2e83cb0769e7f1e8dd97b11e17e55ba7 100644 (file)
@@ -1109,6 +1109,8 @@ ldap_X509dn2bv( void *x509_name, struct berval *bv, LDAPDN_rewrite_func *func,
                                        newAVA->la_attr = oidname->name;
                                }
                        }
+                       newAVA->la_private = NULL;
+                       newAVA->la_flags = LDAP_AVA_STRING;
                        tag = ber_get_stringbv( ber, &Val, LBER_BV_NOTERM );
                        switch(tag) {
                        case LBER_TAG_UNIVERSAL:
@@ -1123,20 +1125,22 @@ ldap_X509dn2bv( void *x509_name, struct berval *bv, LDAPDN_rewrite_func *func,
 to_utf8:               rc = ldap_ucs_to_utf8s( &Val, csize, &newAVA->la_value );
                                newAVA->la_flags |= LDAP_AVA_FREE_VALUE;
                                if (rc != LDAP_SUCCESS) goto nomem;
-                               newAVA->la_flags = LDAP_AVA_NONPRINTABLE;
+                               newAVA->la_flags |= LDAP_AVA_NONPRINTABLE;
                                break;
                        case LBER_TAG_UTF8:
-                               newAVA->la_flags = LDAP_AVA_NONPRINTABLE;
+                               newAVA->la_flags |= LDAP_AVA_NONPRINTABLE;
                                /* This is already in UTF-8 encoding */
                        case LBER_TAG_IA5:
                        case LBER_TAG_PRINTABLE:
                                /* These are always 7-bit strings */
                                newAVA->la_value = Val;
+                               break;
                        default:
-                               ;
+                               /* Not a string type at all */
+                               newAVA->la_flags = 0;
+                               newAVA->la_value = Val;
+                               break;
                        }
-                       newAVA->la_private = NULL;
-                       newAVA->la_flags = LDAP_AVA_STRING;
                        newAVA++;
                }
                *newRDN++ = NULL;