Skip to content

Commit 6d7e50d

Browse files
committed
Fix missing addition to acceptedNonlocalSymlinks
... after updating test that showed a bug existed.
1 parent fd21647 commit 6d7e50d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,7 @@ private boolean acceptSymlink(Path absolute, File canonical, AcceptSymlinkRet re
10321032
* will allow all others in the set.
10331033
*/
10341034
if (canonical1.equals(allowedTarget)) {
1035+
acceptedNonlocalSymlinks.put(canonical1, absolute1);
10351036
return true;
10361037
}
10371038
}

opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexDatabaseSymlinksTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ public void testSymlinksWithFullCanonicalRoot() throws IOException, IndexerExcep
144144

145145
Path dupeLinkDir = links.resolve("zzz");
146146
assertTrue(dupeLinkDir + " should exist", dupeLinkDir.toFile().exists());
147+
assertTrue(dupeLinkDir + " should be symlink", Files.isSymbolicLink(dupeLinkDir));
147148
}
148149

149150
@Test
@@ -172,11 +173,12 @@ public void testSymlinksWithOneAllowedSymlink() throws IOException, IndexerExcep
172173

173174
Path dupeLinkDir = links.resolve("zzz");
174175
/*
175-
* zzz is an implicitly-allowed symlink because its target, the gz
176-
* symlink, is explictly allowed as well as reachable by traversal by
176+
* zzz is an implicitly-allowed symlink because its target matches an
177+
* already-accepted symlink, gt, and is reachable upon traversal by
177178
* indexDown() (to affirm that any intermediate symlinks are allowed).
178179
*/
179-
assertTrue(dupeLinkDir + " should not exist", dupeLinkDir.toFile().exists());
180+
assertTrue(dupeLinkDir + " should exist", dupeLinkDir.toFile().exists());
181+
assertTrue(dupeLinkDir + " should be symlink", Files.isSymbolicLink(dupeLinkDir));
180182
}
181183

182184
private static void runIndexer() throws IndexerException, IOException {

0 commit comments

Comments
 (0)