diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-10-20 11:51:33 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-10-20 11:51:33 +0000 |
commit | 9bd46d6cc63ae17f963901f3e9a4bf17fdd6768a (patch) | |
tree | fdd937bb7909d8f15e352c791ab2d426cfc42cb0 | |
parent | b314f363ec824ff119cd8b1b30aaf9a712418ba6 (diff) | |
download | gnutls-9bd46d6cc63ae17f963901f3e9a4bf17fdd6768a.tar.gz |
print teletex strings if they contain only ASCII characters.
-rw-r--r-- | lib/x509/common.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c index 4dcba991ae..e33b089638 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -220,7 +220,7 @@ int _gnutls_x509_oid_data2string(const char *oid, void *value, *res_size = len; } else { /* CHOICE */ str[len] = 0; - int non_printable = 0; + int non_printable = 0, teletex = 0; /* Note that we do not support strings other than * UTF-8 (thus ASCII as well). @@ -229,6 +229,8 @@ int _gnutls_x509_oid_data2string(const char *oid, void *value, strcmp(str, "utf8String") != 0) { non_printable = 1; } + if (strcmp( str, "teletexString")==0) + teletex = 1; _gnutls_str_cpy(tmpname, sizeof(tmpname), str); @@ -242,6 +244,17 @@ int _gnutls_x509_oid_data2string(const char *oid, void *value, asn1_delete_structure(&tmpasn); + if (teletex != 0) { + int ascii = 0, i; + /* HACK: if the teletex string contains only ascii + * characters then treat it as printable. + */ + for(i=0;i<len;i++) + if(!isascii(str[i])) ascii=1; + + if (ascii==0) non_printable = 0; + } + if (res) { if (non_printable == 0) { str[len] = 0; |