chantra / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
648606
commit 3ccd774255b8215733e0bdfdf5a683da9dd10923
648606
Author: Panu Matilainen <pmatilai@redhat.com>
648606
Date:   Wed Sep 24 10:31:51 2014 +0300
648606
648606
    Handle directory replaced with a symlink to one in verify (RhBug:1101861)
648606
    
648606
    - An unforced installation must not cause verification failures - we
648606
      permit directories to be replaced by directory symlinks during
648606
      install so we need to do the same in verify too.
648606
648606
diff --git a/lib/verify.c b/lib/verify.c
648606
index eb6f2e1..84e9843 100644
648606
--- a/lib/verify.c
648606
+++ b/lib/verify.c
648606
@@ -96,6 +96,12 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
648606
 	return 1;
648606
     }
648606
 
648606
+    /* If we expected a directory but got a symlink to one, follow the link */
648606
+    if (S_ISDIR(fmode) && S_ISLNK(sb.st_mode) && stat(fn, &sb) != 0) {
648606
+	*res |= RPMVERIFY_LSTATFAIL;
648606
+	return 1;
648606
+    }
648606
+
648606
     /* Links have no mode, other types have no linkto */
648606
     if (S_ISLNK(sb.st_mode))
648606
 	flags &= ~(RPMVERIFY_MODE);