From d45052552e228dd46151b322ffc565b14f1fc6c3 Mon Sep 17 00:00:00 2001 From: Matthew Harmsen Date: Thu, 20 Sep 2012 20:10:13 -0700 Subject: 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. --- base/deploy/src/scriptlets/pkihelper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'base/deploy/src/scriptlets/pkihelper.py') diff --git a/base/deploy/src/scriptlets/pkihelper.py b/base/deploy/src/scriptlets/pkihelper.py index 8145a02d8..0ae6ba97e 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) -- cgit