Lookups: dsearch subdir with leading "..". Bug 2994
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 1 Jun 2024 15:32:22 +0000 (16:32 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 1 Jun 2024 15:32:22 +0000 (16:32 +0100)
doc/doc-txt/ChangeLog
src/src/lookups/dsearch.c
test/aux-fixed/2500.dir/..subdir/regfile [new file with mode: 0644]
test/scripts/2500-dsearch/2500
test/stdout/2500

index e1cec9e15257714c1253aeadb6a4bfe4f0d7705f..f154430f3d2481f823120fa17e3a6f9bfec2db80 100644 (file)
@@ -158,6 +158,9 @@ JH/31 Bug 3027: For -bh / -bhc tests change to using the compressed form of
 JH/32 Bug 3096: MAIL before HELO/EHLO, where required by hosts_require_helo, is
       now classed as a protocol error and subject to smtp_max_synprot_errors.
 
+JH/33 Bug 2994: A subdir dsearch lookup should permit a directory name that starts
+      ".." and has following characters.
+
 
 Exim version 4.97
 -----------------
index 22003f4e5dd449abf29f2a43f51c687712e60899..8258a121e40f090edf3de117725555a7442dae11 100644 (file)
@@ -132,7 +132,7 @@ if (  Ulstat(filename, &statbuf) >= 0
                 && S_ISDIR(statbuf.st_mode)
         && (  flags & FILTER_DIR
            || keystring[0] != '.'
-           || keystring[1] && keystring[1] != '.'
+           || keystring[1] && (keystring[1] != '.' || keystring[2])
    )  )  )  )
   {
   /* Since the filename exists in the filesystem, we can return a
diff --git a/test/aux-fixed/2500.dir/..subdir/regfile b/test/aux-fixed/2500.dir/..subdir/regfile
new file mode 100644 (file)
index 0000000..e69de29
index 1690256dae31bef482a31136973b4551cfe149cc..ba524105d6fb9b74b5e69e0db789e0509da4064a 100644 (file)
@@ -18,6 +18,7 @@ ok,subdir:  ${lookup{TESTNUM.dir} dsearch,filter=subdir {DIR/aux-fixed}{$value}{
 fail,subdir(..):${lookup{..}          dsearch,filter=subdir {DIR/aux-fixed}{$value}{FAIL}}
 fail,subdir(.) :${lookup{.}           dsearch,filter=subdir {DIR/aux-fixed}{$value}{FAIL}}
 fail,subdir(f) :${lookup{TESTNUM.tst} dsearch,filter=subdir {DIR/aux-fixed}{$value}{FAIL}}
+ok,subdir(..d) :${lookup{..subdir}    dsearch,filter=subdir {DIR/aux-fixed/TESTNUM.dir}{$value}{FAIL}}
 fail.path:  ${lookup{TESTNUM.dir/regfile} dsearch          {DIR/aux-fixed}{$value}{FAIL}}
 ok.path:    ${lookup{TESTNUM.dir/regfile} dsearch,key=path {DIR/aux-fixed}{$value}{FAIL}}
 
index 065004bf27860cc179fd3ba9c0c14e738123ac61..dd6b4bdd67772bc70cab6832a3b9b17de7da31a5 100644 (file)
@@ -15,6 +15,7 @@
 > fail,subdir(..):FAIL
 > fail,subdir(.) :FAIL
 > fail,subdir(f) :FAIL
+> ok,subdir(..d) :..subdir
 > Failed: lookup of "2500.dir/regfile" gave DEFER: key for dsearch lookup contains a slash: 2500.dir/regfile
 > ok.path:    2500.dir/regfile
 >