summaryrefslogtreecommitdiffstats
path: root/buffer.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-07-19 00:29:31 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-07-19 00:29:31 +0000
commit7621883663b7948faccc610e12e017cd8f0b16df (patch)
tree304a23d3a68569ad287734b9dff71751d029f9ca /buffer.c
parentd1dcc3e706c5e7de69e79e70a3c431ca4ce27881 (diff)
downloadopenvpn-7621883663b7948faccc610e12e017cd8f0b16df.tar.gz
openvpn-7621883663b7948faccc610e12e017cd8f0b16df.tar.xz
openvpn-7621883663b7948faccc610e12e017cd8f0b16df.zip
Replace leading dash ('-') characters in an X509 name with underbars ('_')
before calling user-defined scripts, to preclude the chance of a leading dash being interpreted as an option prefix. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3083 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 8febc91..c90ff9f 100644
--- a/buffer.c
+++ b/buffer.c
@@ -804,6 +804,20 @@ string_mod_const (const char *str,
return NULL;
}
+void
+string_replace_leading (char *str, const char match, const char replace)
+{
+ ASSERT (match != '\0');
+ while (*str)
+ {
+ if (*str == match)
+ *str = replace;
+ else
+ break;
+ ++str;
+ }
+}
+
#ifdef CHARACTER_CLASS_DEBUG
#define CC_INCLUDE (CC_PRINT)