diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-10-20 11:51:22 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-10-20 11:51:22 +0000 |
commit | 714e2b00ac93e59563a6e0dbfef29a718b133701 (patch) | |
tree | fc5c33eef8d9c3e92ee75dfc1650fe7b14865362 | |
parent | e61f8660d64b4d9c53ef2d2ea4db03562db6ecb8 (diff) | |
download | gnutls-714e2b00ac93e59563a6e0dbfef29a718b133701.tar.gz |
print teletex strings if they contain only ASCII characters.
-rw-r--r-- | lib/x509/common.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c index 13144ac175..f992b5e07b 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -219,7 +219,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). @@ -228,6 +228,9 @@ 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); @@ -241,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; @@ -563,7 +577,7 @@ time_t _gnutls_x509_utcTime2gtime(const char *ttime) /* returns a time value that contains the given time. * The given time is expressed as: - * YEAR(2)|MONTH(2)|DAY(2)|HOUR(2)|MIN(2) + * YEAR(2)|MONTH(2)|DAY(2)|HOUR(2)|MIN(2)|SEC(2) */ int _gnutls_x509_gtime2utcTime(time_t gtime, char *str_time, int str_time_size) |