summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satserver/util/Util.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-01-23 19:19:58 +0100
committerSimon Rettberg2015-01-23 19:19:58 +0100
commit2eb5cea8578c2884c6f30fa379212bbfc1554bed (patch)
tree12d4eb781782e07e41b084444a2185a978e90c98 /src/main/java/org/openslx/satserver/util/Util.java
parentPimp my boot menu (diff)
downloadtmlite-bwlp-2eb5cea8578c2884c6f30fa379212bbfc1554bed.tar.gz
tmlite-bwlp-2eb5cea8578c2884c6f30fa379212bbfc1554bed.tar.xz
tmlite-bwlp-2eb5cea8578c2884c6f30fa379212bbfc1554bed.zip
Stuff
Diffstat (limited to 'src/main/java/org/openslx/satserver/util/Util.java')
-rw-r--r--src/main/java/org/openslx/satserver/util/Util.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/satserver/util/Util.java b/src/main/java/org/openslx/satserver/util/Util.java
index 2df4c73..fcf10ed 100644
--- a/src/main/java/org/openslx/satserver/util/Util.java
+++ b/src/main/java/org/openslx/satserver/util/Util.java
@@ -22,6 +22,8 @@ public class Util
*/
public static boolean startsWith( String stringToCheck, String... compareTo )
{
+ if ( stringToCheck == null )
+ return false;
for ( String check : compareTo ) {
if ( stringToCheck.startsWith( check ) )
return true;
@@ -77,4 +79,12 @@ public class Util
FileUtils.writeStringToFile( file, string, StandardCharsets.UTF_8 );
}
+ private static final String[] DEFAULT_ALLOWED_DIRS =
+ { "/tmp/", "/opt/openslx/configs/" };
+
+ public static boolean isAllowedDir( String dir )
+ {
+ return startsWith( dir, DEFAULT_ALLOWED_DIRS );
+ }
+
}