vfs_preopen: introduce support for "preopen:posix-basic-regex = yes"
authorStefan Metzmacher <metze@samba.org>
Fri, 11 Jun 2021 19:07:03 +0000 (19:07 +0000)
committerStefan Metzmacher <metze@samba.org>
Thu, 1 Jul 2021 13:02:31 +0000 (13:02 +0000)
commitade3b16490e9afdf909a761828a38d80d6596fd1
treec940f48b8a87056e7bd63b002d4aa4aeba840609
parent67159410175a9ceccc7beda01601b9dc6656be04
vfs_preopen: introduce support for "preopen:posix-basic-regex = yes"

This will allow the usage of patterns as
'POSIX Basic Regular Expression'

      vfs objects = preopen
      preopen:posix-basic-regex = yes
      preopen:names = /Re7599Ex\([0-9]\).*\.txt/test\([0-9]*\)\.dat/

The key is that exactly one 'subexpression' starting with '\(' and
ending with '\)' is specified in order to select the position where
the digits are searched.

E.g. given a file name 'Re7599Ex01234.txt' will actually preopen:

  Re7599Ex01234.txt
  Re7599Ex11234.txt
  Re7599Ex21234.txt
  Re7599Ex31234.txt
  Re7599Ex41234.txt

As '\([0-9]\)' will only match the first digit after 'Re7599Ex'.

It also means it's now possible to have digits in the fixed part of the
filename, which was the actual motivation for this patchset.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
docs-xml/manpages/vfs_preopen.8.xml
source3/modules/vfs_preopen.c