URL: https://github.com/freeipa/freeipa/pull/770
Author: stlaz
 Title: #770: cert-show: writable files does not mean dirs
Action: opened

PR body:
"""
ipalib.util.check_writable_file didn't check whether the argument
is an actual file which is now fixed.

https://pagure.io/freeipa/issue/6883
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/770/head:pr770
git checkout pr770
From 8e14e41045971193649e8f3acc0bbab0c053b7a8 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 9 May 2017 17:49:56 +0200
Subject: [PATCH] cert-show: writable files does not mean dirs

ipalib.util.check_writable_file didn't check whether the argument
is an actual file which is now fixed.

https://pagure.io/freeipa/issue/6883
---
 ipalib/util.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipalib/util.py b/ipalib/util.py
index e9d4105..f89ac14 100644
--- a/ipalib/util.py
+++ b/ipalib/util.py
@@ -171,7 +171,7 @@ def check_writable_file(filename):
     if filename is None:
         raise errors.FileError(reason=_('Filename is empty'))
     try:
-        if os.path.exists(filename):
+        if os.path.isfile(filename):
             if not os.access(filename, os.W_OK):
                 raise errors.FileError(reason=_('Permission denied: %(file)s') % dict(file=filename))
         else:
-- 
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

Reply via email to