pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0124-cert-show-writable-files-does-not-mean-dirs.patch

ac7d03
From 348fdfd66d9b3ab0214af91d193ae93b9969610e Mon Sep 17 00:00:00 2001
ac7d03
From: Stanislav Laznicka <slaznick@redhat.com>
ac7d03
Date: Tue, 9 May 2017 17:49:56 +0200
ac7d03
Subject: [PATCH] cert-show: writable files does not mean dirs
ac7d03
ac7d03
ipalib.util.check_writable_file didn't check whether the argument
ac7d03
is an actual file which is now fixed.
ac7d03
ac7d03
https://pagure.io/freeipa/issue/6883
ac7d03
ac7d03
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
ac7d03
---
ac7d03
 ipalib/util.py | 2 +-
ac7d03
 1 file changed, 1 insertion(+), 1 deletion(-)
ac7d03
ac7d03
diff --git a/ipalib/util.py b/ipalib/util.py
ac7d03
index 8973a19abf56d1d1c5ba04f6edb4228dd2329e65..713fc107e9374eefe7805bc4e1abc40b6d150c32 100644
ac7d03
--- a/ipalib/util.py
ac7d03
+++ b/ipalib/util.py
ac7d03
@@ -170,7 +170,7 @@ def check_writable_file(filename):
ac7d03
     if filename is None:
ac7d03
         raise errors.FileError(reason=_('Filename is empty'))
ac7d03
     try:
ac7d03
-        if os.path.exists(filename):
ac7d03
+        if os.path.isfile(filename):
ac7d03
             if not os.access(filename, os.W_OK):
ac7d03
                 raise errors.FileError(reason=_('Permission denied: %(file)s') % dict(file=filename))
ac7d03
         else:
ac7d03
-- 
ac7d03
2.9.3
ac7d03