Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 public static string EscapeHost(string value)
 {
     // Note: RFC 952 with _ exception.
     return(UtilsString.StringPruneCharsNotIn(value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_"));
 }
Beispiel #3
0
 public static string EscapeAlphaNumeric(string value)
 {
     return(UtilsString.StringPruneCharsNotIn(value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"));
 }