diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-07-24 14:22:30 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-07-24 14:22:30 -0300 |
commit | 18138fcda1184333e4df572da6f8e3c2c34da05c (patch) | |
tree | e545133bebc908b93bad69ef59e2ae84dc40ea8b /src/leap/config | |
parent | d56790c4cddab8768e14a83a3c9fcb15bda1dee5 (diff) | |
parent | 11b3b47ba3ab5ed25b77aab3ce5759c55c9c9627 (diff) |
Merge remote-tracking branch 'chiiph/bug/escape_domain' into develop
Diffstat (limited to 'src/leap/config')
-rw-r--r-- | src/leap/config/providerconfig.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/leap/config/providerconfig.py b/src/leap/config/providerconfig.py index 8b72153a..744199f8 100644 --- a/src/leap/config/providerconfig.py +++ b/src/leap/config/providerconfig.py @@ -60,8 +60,26 @@ class ProviderConfig(BaseConfig): def get_description(self): return self._safe_get_value("description") + @classmethod + def sanitize_path_component(cls, component): + """ + If the provider tries to instrument the component of a path + that is controlled by them, this will take care of + removing/escaping all the necessary elements. + + :param component: Path component to process + :type component: unicode or str + + :returns: The path component properly escaped + :rtype: unicode or str + """ + # TODO: Fix for windows, names like "aux" or "con" aren't + # allowed. + return component.replace(os.path.sep, "") + def get_domain(self): - return self._safe_get_value("domain") + return ProviderConfig.sanitize_path_component( + self._safe_get_value("domain")) def get_enrollment_policy(self): """ |