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

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