aboutsummaryrefslogtreecommitdiff
path: root/bin/rdsquashfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-01-31 11:30:46 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-01-31 18:04:25 +0100
commit72c8155d9fc0eaeac72c053f46ebb7b231d4596a (patch)
tree5758865289c52fa93f56e3fe743bb40c283c5233 /bin/rdsquashfs
parentcdccc69c62579b0c13b35fad0728079652b8f3c9 (diff)
Reintegrate test code with library code
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/rdsquashfs')
-rw-r--r--bin/rdsquashfs/Makemodule.am8
-rw-r--r--bin/rdsquashfs/test/pathtraversal.sh.in12
-rw-r--r--bin/rdsquashfs/test/pathtraversal.sqfsbin0 -> 4096 bytes
3 files changed, 20 insertions, 0 deletions
diff --git a/bin/rdsquashfs/Makemodule.am b/bin/rdsquashfs/Makemodule.am
index f8f9d3d..380883e 100644
--- a/bin/rdsquashfs/Makemodule.am
+++ b/bin/rdsquashfs/Makemodule.am
@@ -9,3 +9,11 @@ rdsquashfs_LDADD += libfstree.a $(LZO_LIBS) $(PTHREAD_LIBS)
dist_man1_MANS += bin/rdsquashfs/rdsquashfs.1
bin_PROGRAMS += rdsquashfs
+
+if WINDOWS
+else
+check_SCRIPTS += bin/rdsquashfs/test/pathtraversal.sh
+TESTS += bin/rdsquashfs/test/pathtraversal.sh
+endif
+
+EXTRA_DIST += $(top_srcdir)/bin/rdsquashfs/test/pathtraversal.sqfs
diff --git a/bin/rdsquashfs/test/pathtraversal.sh.in b/bin/rdsquashfs/test/pathtraversal.sh.in
new file mode 100644
index 0000000..5b19c4d
--- /dev/null
+++ b/bin/rdsquashfs/test/pathtraversal.sh.in
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+RDSQFS="@abs_top_builddir@/rdsquashfs"
+REFFILE="@abs_top_srcdir@/bin/rdsquashfs/test/pathtraversal.sqfs"
+GOTCHA="/tmp/gotcha.txt"
+
+if "$RDSQFS" -u / -p . "$REFFILE"; then
+ if [ -e "$GOTCHA" ]; then
+ echo "Found $GOTCHA which should not be there"
+ exit 1
+ fi
+fi
diff --git a/bin/rdsquashfs/test/pathtraversal.sqfs b/bin/rdsquashfs/test/pathtraversal.sqfs
new file mode 100644
index 0000000..0c33bb3
--- /dev/null
+++ b/bin/rdsquashfs/test/pathtraversal.sqfs
Binary files differ