Add config option to allow symbolic links for files.

Dieser Commit ist enthalten in:
Wizjany 2012-12-25 18:08:03 -05:00
Ursprung a7b4913f6c
Commit a54c7437fc
4 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -107,6 +107,7 @@ public abstract class LocalConfiguration {
public int butcherDefaultRadius = -1; public int butcherDefaultRadius = -1;
public int butcherMaxRadius = -1; public int butcherMaxRadius = -1;
public boolean allowExtraDataValues = false; public boolean allowExtraDataValues = false;
public boolean allowSymlinks = false;
/** /**
* Loads the configuration. * Loads the configuration.

Datei anzeigen

@ -825,7 +825,7 @@ public class WorldEdit {
String filePath = f.getCanonicalPath(); String filePath = f.getCanonicalPath();
String dirPath = dir.getCanonicalPath(); String dirPath = dir.getCanonicalPath();
if (!filePath.substring(0, dirPath.length()).equals(dirPath)) { if (!filePath.substring(0, dirPath.length()).equals(dirPath) && !config.allowSymlinks) {
throw new FilenameResolutionException(filename, throw new FilenameResolutionException(filename,
"Path is outside allowable root"); "Path is outside allowable root");
} }

Datei anzeigen

@ -93,6 +93,8 @@ public class YAMLConfiguration extends LocalConfiguration {
saveDir = config.getString("saving.dir", saveDir); saveDir = config.getString("saving.dir", saveDir);
allowSymlinks = config.getBoolean("files.allow-symbolic-links", false);
disallowedBlocks = new HashSet<Integer>(config.getIntList("limits.disallowed-blocks", null)); disallowedBlocks = new HashSet<Integer>(config.getIntList("limits.disallowed-blocks", null));
allowedDataCycleBlocks = new HashSet<Integer>(config.getIntList("limits.allowed-data-cycle-blocks", null)); allowedDataCycleBlocks = new HashSet<Integer>(config.getIntList("limits.allowed-data-cycle-blocks", null));

Datei anzeigen

@ -16,6 +16,7 @@
# #
limits: limits:
allow-extra-data-values: false
max-blocks-changed: max-blocks-changed:
default: -1 default: -1
maximum: -1 maximum: -1
@ -56,6 +57,9 @@ scripting:
saving: saving:
dir: schematics dir: schematics
files:
allow-symbolic-links: false
history: history:
size: 15 size: 15
expiration: 10 expiration: 10