summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Harmsen <mharmsen@redhat.com>2012-09-20 20:10:13 -0700
committerMatthew Harmsen <mharmsen@redhat.com>2012-09-25 17:50:02 -0700
commitd45052552e228dd46151b322ffc565b14f1fc6c3 (patch)
tree53557171236a033c610db65d938484a8f667c5f6
parent4ba74f71daa07abfd974546f6efae2fe518187c8 (diff)
downloadpki-d45052552e228dd46151b322ffc565b14f1fc6c3.zip
pki-d45052552e228dd46151b322ffc565b14f1fc6c3.tar.gz
pki-d45052552e228dd46151b322ffc565b14f1fc6c3.tar.xz
Correctly resolve symlinks in subdirectories
* TRAC Ticket #338 - Dogtag 10: pkihelper.py directory.set_mode() does not resolve symlinks correctly This patch fixes the problem that although top-level symlinks are correctly identified as symbolic links, symlinks which exist under a subdirectory are incorrectly identified as files, and thus the 'chown' and 'chmod' commands are applied to the symlink which in turn actually get applied to the target file instead.
-rw-r--r--base/deploy/src/scriptlets/pkihelper.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/base/deploy/src/scriptlets/pkihelper.py b/base/deploy/src/scriptlets/pkihelper.py
index 8145a02..0ae6ba9 100644
--- a/base/deploy/src/scriptlets/pkihelper.py
+++ b/base/deploy/src/scriptlets/pkihelper.py
@@ -1186,8 +1186,9 @@ class directory:
if recursive_flag == True:
for root, dirs, files in os.walk(name):
for name in files:
- if not os.path.islink(name):
- file = os.path.join(root, name)
+ entity = os.path.join(root, name)
+ if not os.path.islink(entity):
+ file = entity
config.pki_log.debug(
log.PKIHELPER_IS_A_FILE_1, file,
extra=config.PKI_INDENTATION_LEVEL_3)
@@ -1215,7 +1216,7 @@ class directory:
record.acls = file_acls
manifest.database.append(record)
else:
- symlink = os.path.join(root, name)
+ symlink = entity
config.pki_log.debug(
log.PKIHELPER_IS_A_SYMLINK_1, symlink,
extra=config.PKI_INDENTATION_LEVEL_3)