URL: https://github.com/freeipa/freeipa/pull/726 Author: Akasurde Title: #726: Add check for directory name Action: opened
PR body: """ Fix adds check to verify if user provided input is not a directory when filename is required. Fixes: https://pagure.io/freeipa/issue/6883 Signed-off-by: Abhijeet Kasurde <akasu...@redhat.com> """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/726/head:pr726 git checkout pr726
From 2bb6825daf43925772357be3d5483cfc9996f8f5 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde <akasu...@redhat.com> Date: Fri, 21 Apr 2017 10:11:38 +0530 Subject: [PATCH] Add check for directory name Fix adds check to verify if user provided input is not a directory when filename is required. Fixes: https://pagure.io/freeipa/issue/6883 Signed-off-by: Abhijeet Kasurde <akasu...@redhat.com> --- ipalib/util.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ipalib/util.py b/ipalib/util.py index e9d4105..7c267e7 100644 --- a/ipalib/util.py +++ b/ipalib/util.py @@ -170,6 +170,10 @@ def check_writable_file(filename): """ if filename is None: raise errors.FileError(reason=_('Filename is empty')) + + if os.path.isdir(filename): + raise errors.FileError(reason=_('Directory name found instead of ' + 'Filename')) try: if os.path.exists(filename): if not os.access(filename, os.W_OK):
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code