public void AppendDirective(string name, string body, string comment) { name = UtilsString.StringPruneCharsNotIn(name.Trim(), AllowedCharsInDirectiveName); // Eddie-special: If start with -, remove. if (name.StartsWith("-")) { if (Directives.ContainsKey(name.Substring(1))) { Directives.Remove(name.Substring(1)); } } else { if (IsMultipleDirective(name)) { if (Directives.ContainsKey(name) == false) { Directives[name] = new List <Directive>(); } } else { Directives[name] = new List <Directive>(); } if (Engine.Instance.Storage.GetBool("openvpn.allow.script-security") == false) { if (IsGroupAllowScriptSecurity(name)) { return; } } Directive d = new Directive(); d.Text = body.Trim(); d.Comment = comment.Trim(); Directives[name].Add(d); } }
public static string EscapeHost(string value) { // Note: RFC 952 with _ exception. return(UtilsString.StringPruneCharsNotIn(value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_")); }
public static string EscapeAlphaNumeric(string value) { return(UtilsString.StringPruneCharsNotIn(value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")); }