1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-19 13:24:57 +03:00

Allow single/double quotes around Include dirs

This commit is contained in:
James Kasten
2015-09-22 08:15:11 -07:00
parent f16e651794
commit 6e4faac9c0
2 changed files with 11 additions and 1 deletions

View File

@@ -390,6 +390,9 @@ class ApacheParser(object):
# logger.error("Error: Invalid regexp characters in %s", arg)
# return []
# Remove beginning and ending quotes
arg = arg.strip("'\"")
# Standardize the include argument based on server root
if not arg.startswith("/"):
# Normpath will condense ../

View File

@@ -78,7 +78,7 @@ class ComplexParserTest(util.ParserTest):
# This is in an IfDefine
self.assertTrue("ssl_module" in self.parser.modules)
self.assertTrue("mod_ssl.c" in self.parser.modules)
#
def verify_fnmatch(self, arg, hit=True):
"""Test if Include was correctly parsed."""
from letsencrypt_apache import parser
@@ -89,6 +89,7 @@ class ComplexParserTest(util.ParserTest):
else:
self.assertFalse(self.parser.find_dir("FNMATCH_DIRECTIVE"))
# NOTE: Only run one test per function otherwise you will have inf recursion
def test_include(self):
self.verify_fnmatch("test_fnmatch.?onf")
@@ -101,6 +102,12 @@ class ComplexParserTest(util.ParserTest):
def test_include_fullpath_trailing_slash(self):
self.verify_fnmatch(self.config_path + "//")
def test_include_single_quotes(self):
self.verify_fnmatch("'" + self.config_path + "'")
def test_include_double_quotes(self):
self.verify_fnmatch('"' + self.config_path + '"')
def test_include_variable(self):
self.verify_fnmatch("../complex_parsing/${fnmatch_filename}")