summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2005-02-18 09:59:27 +0000
committerAndreas Gruenbacher <agruen@suse.de>2005-02-18 09:59:27 +0000
commitc0e3fedb48ca32520cc58478c5e8d591ed2dabd7 (patch)
tree8b09adadb4ef701691f60a41e315759d03cc4190
parentd19ec29dec7210bc30dbd715a9a7a26bd2a1eee2 (diff)
downloadquilt-c0e3fedb48ca32520cc58478c5e8d591ed2dabd7.tar.gz
- quilt add: Add check to ensure that no files below patches/
or .pc/ will be added.
-rw-r--r--quilt.changes6
-rw-r--r--quilt/add.in29
2 files changed, 35 insertions, 0 deletions
diff --git a/quilt.changes b/quilt.changes
index ae66dbc..d4322ec 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Fri Feb 18 11:01:57 CET 2005 - agruen@suse.de
+
+- quilt add: Add check to ensure that no files below patches/
+ or .pc/ will be added.
+
+-------------------------------------------------------------------
Thu Feb 10 12:02:21 CET 2005 - agruen@suse.de
- quilt remove: Update restored file's timestamp. Also, some uses
diff --git a/quilt/add.in b/quilt/add.in
index 3440f82..c605394 100644
--- a/quilt/add.in
+++ b/quilt/add.in
@@ -36,6 +36,30 @@ patches already applied on top of the specified patch cannot be added.
fi
}
+in_valid_dir()
+{
+ local p=$1 path
+
+ path=${p%/*}
+ while [ "$p" != "$path" ]
+ do
+ if [ "$path" -ef "$QUILT_PATCHES" ]
+ then
+ printf $"File \`%s' is located below \`%s'\n" \
+ "$1" "$QUILT_PATCHES/"
+ return 1
+ fi
+ if [ "$path" -ef "$QUILT_PC" ]
+ then
+ printf $"File \`%s' is located below \`%s'\n" \
+ "$1" "$QUILT_PC/"
+ return 1
+ fi
+ p=$path
+ path=${path%/*}
+ done
+}
+
options=`getopt -o p:h -- "$@"`
if [ $? -ne 0 ]
@@ -87,6 +111,11 @@ fi
status=0
for file in $*
do
+ if ! in_valid_dir $SUBDIR$file
+ then
+ status=1
+ continue
+ fi
if file_in_patch $SUBDIR$file $patch
then
printf $"File %s is already in patch %s\n" \