alexk / rpms / rpm

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