On the svn-auth-x509 branch: Preserve all the issuer and subject attributes not
just the ones we know about.

Attributes are then accessible based on the string representation of their OIDs
(dotted decimal format) as keys to a hash.  An array of OIDs exists to preserve
the ordering of the OIDs in the certificate.  Well known OIDs are defined as
constants.

* subversion/include/svn_x509.h
  (SVN_X509_OID_COMMON_NAME, SVN_X509_OID_COUNTRY, SVN_X509_OID_LOCALITY,
   SVN_X509_OID_STATE, SVN_X509_OID_ORGANIZATION, SVN_X509_OID_ORG_UNIT,
   SVN_X509_OID_EMAIL): New constants.
  (svn_x509_certinfo_get_subject, svn_x509_certinfo_get_issuer): Add pool.
  (svn_x509_certinfo_get_subject_cn): Removed.
  (svn_x509_certinfo_get_subject_oids, svn_x509_certinfo_get_subject_attr):
    New functions.

* subversion/libsvn_subr/x509.h
  (asn1_oid): New private struct to store info about OIDs.
  (asn1_oids): Static list of asn1_oid entries for well known OIDs.
  (OID_X520, OID_PKCS9): Removed.
  (svn_x509_certinfo_t): Changed the issuer and subject from being
    stored as strings to stored as an array and hash pair.

* subversion/libsvn_subr/x509info.c
  (deep_copy_array, deep_copy_hash, oid_string_to_asn1_oid,
   oid_string_to_best_label, get_dn, svn_x509_certinfo_get_subject_oids,
   svn_x509_certinfo_get_subject_attr, svn_x509_certinfo_get_issuer_oids,
   svn_x509_certinfo_get_issuer_attr): New functions.
  (svn_x509_certinfo_dup): Update to copy the issuer and subject that are
    stored as a array and hash pair with the deep_copy_*().
  (svn_x509_certinfo_get_subject, svn_x509_certinfo_get_issuer): Update
    to use get_dn() instead of retrieving already calculated string.
  (svn_x509_certinfo_get_subject_cn): Removed.

* subversion/libsvn_subr/x509parse.c
  (starts_with, x509_dn_gets): Removed.
  (asn1_oid_to_string, x509_name_to_certinfo): New function.
  (is_hostname): Adjust to work on C strings instead of svn_string_t.
  (x509parse_get_hostnames): Rework to use the new storage for the subject.
  (svn_x509_parse_cert): Adjust to use new storage and functions.

* subversion/libsvn_subr/auth-cmd.c
  (show_cert): Pass pool to svn_x509_certinfo_get_subject() and
    svn_x509_certinfo_get_issuer().

* subversion/tests/libsvn_subr/x509-test.c
  (x509_test, cert_tests): Add list of OIDS to test struct.
  (compare_oids): New function.
  (compare_results): Update to pass pools to svn_x509_certinfo_get_subject() and
    svn_x509_certinfo_get_issuer() and check the OID list.



git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/svn-auth-x509@1634906 13f79535-47bb-0310-9956-ffa450edef68