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

Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
Stanislav Laznicka 2017-05-09 17:49:56 +02:00 committed by Tomas Krizek
parent 6c061b6836
commit 33b3d7ad7a
No known key found for this signature in database
GPG Key ID: 22A2A94B5E49415A

View File

@ -170,7 +170,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: