git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3083 e7ae566f-a301-0410-adde-c780ea21d3b5
| ... | ... |
@@ -804,6 +804,20 @@ string_mod_const (const char *str, |
| 804 | 804 |
return NULL; |
| 805 | 805 |
} |
| 806 | 806 |
|
| 807 |
+void |
|
| 808 |
+string_replace_leading (char *str, const char match, const char replace) |
|
| 809 |
+{
|
|
| 810 |
+ ASSERT (match != '\0'); |
|
| 811 |
+ while (*str) |
|
| 812 |
+ {
|
|
| 813 |
+ if (*str == match) |
|
| 814 |
+ *str = replace; |
|
| 815 |
+ else |
|
| 816 |
+ break; |
|
| 817 |
+ ++str; |
|
| 818 |
+ } |
|
| 819 |
+} |
|
| 820 |
+ |
|
| 807 | 821 |
#ifdef CHARACTER_CLASS_DEBUG |
| 808 | 822 |
|
| 809 | 823 |
#define CC_INCLUDE (CC_PRINT) |
| ... | ... |
@@ -615,6 +615,8 @@ const char *string_mod_const (const char *str, |
| 615 | 615 |
const char replace, |
| 616 | 616 |
struct gc_arena *gc); |
| 617 | 617 |
|
| 618 |
+void string_replace_leading (char *str, const char match, const char replace); |
|
| 619 |
+ |
|
| 618 | 620 |
#ifdef CHARACTER_CLASS_DEBUG |
| 619 | 621 |
void character_class_debug (void); |
| 620 | 622 |
#endif |
| ... | ... |
@@ -554,6 +554,9 @@ verify_callback (int preverify_ok, X509_STORE_CTX * ctx) |
| 554 | 554 |
|
| 555 | 555 |
/* enforce character class restrictions in X509 name */ |
| 556 | 556 |
string_mod (subject, X509_NAME_CHAR_CLASS, 0, '_'); |
| 557 |
+ string_replace_leading (subject, '-', '_'); |
|
| 558 |
+ |
|
| 559 |
+ msg (M_INFO, "X509: '%s'", subject); // JYFIXME |
|
| 557 | 560 |
|
| 558 | 561 |
/* extract the common name */ |
| 559 | 562 |
#ifdef USE_OLD_EXTRACT_X509_FIELD |