tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Overwriting config files that are symlinked



I regularily get bitten by security/pam-ldap overwriting my etc/ldap.conf 
because that's a symlink to openldap/ldap.conf.

What about the following patch that adds a check for an existing symlink?

Index: pkginstall/files
===================================================================
RCS file: /cvsroot/pkgsrc/mk/pkginstall/files,v
retrieving revision 1.6
diff -p -u -r1.6 files
--- pkginstall/files    25 Sep 2008 14:01:46 -0000      1.6
+++ pkginstall/files    28 Mar 2012 14:44:17 -0000
@@ -159,6 +159,8 @@ ADD)
                        
*f*:*:*|[!r]:yes:*|[!r][!r]:yes:*|[!r][!r][!r]:yes:*|*r*:yes:yes)
                                if ${TEST} -f "$file"; then
                                        ${ECHO} "${PKGNAME}: $file already 
exists"
+                               elif ${TEST} -h "$file"; then
+                                       ${ECHO} "${PKGNAME}: $file is a symlink"
                                elif ${TEST} -f "$f_eg" -o -c "$f_eg"; then
                                        ${ECHO} "${PKGNAME}: copying $f_eg to 
$file"
                                        ${CP} $f_eg $file


Home | Main Index | Thread Index | Old Index