Commit 0fdc9b48 authored by Simon Morlat's avatar Simon Morlat

Finally implement a way to get otherName attribute of x509 v3 extensions.

parent a8b247cc
......@@ -11,7 +11,7 @@ dnl information on the package
dnl ---------------------------
dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
AC_INIT([sofia-sip], [1.13.37bc])
AC_INIT([sofia-sip], [1.13.38bc])
AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.13])
......
......@@ -753,6 +753,31 @@ int tls_post_connection_check(tport_t *self, tls_t *tls)
continue;
vp = X509V3_EXT_get(ext); if (!vp) continue;
const unsigned char *in = ext->value->data;
GENERAL_NAMES *names = d2i_GENERAL_NAMES(NULL, &in, ext->value->length);
if (names == NULL) {
SU_DEBUG_7(("%s(%p): GENERAL_NAMES not found.\n",
__func__, (void *) self));
continue;
}
int nbr_of_names = sk_GENERAL_NAME_num(names);
int j, nid;
for (j=0; j<nbr_of_names; j++) {
const GENERAL_NAME *current_name = sk_GENERAL_NAME_value(names, j);
if (current_name->type == GEN_OTHERNAME){
const char *str = (const char*)ASN1_STRING_data(current_name->d.otherName->
value->value.asn1_string);
if (str){
SU_DEBUG_7(("%s(%p): subjectAltName otherName found with value '%s'.\n",
__func__, (void *) self, str));
su_strlst_dup_append(tls->subjects, str);
}
}
}
GENERAL_NAMES_free(names);
d2i = X509V3_EXT_d2i(ext);
values = vp->i2v(vp, d2i, NULL);
......@@ -764,8 +789,6 @@ int tls_post_connection_check(tport_t *self, tls_t *tls)
su_strlst_dup_append(tls->subjects, value->value);
else if (strcmp(value->name, "URI") == 0)
su_strlst_dup_append(tls->subjects, value->value);
else if (strcasecmp(value->name, "otherName") == 0)
su_strlst_dup_append(tls->subjects, value->value);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment