diff options
author | Aurélien Aptel <aurelien.aptel@gmail.com> | 2013-07-19 18:35:01 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2014-02-19 18:22:28 +0100 |
commit | 82dce8f7a8d340a39e08dcc12fb38b8ed254dc64 (patch) | |
tree | 9ac132f896090cec5e8acfffae679185d34781ad /source3/client/clitar.c | |
parent | fc05ff32fd7e8484f00e02a27d000e05748cdf74 (diff) | |
download | samba-82dce8f7a8d340a39e08dcc12fb38b8ed254dc64.tar.gz samba-82dce8f7a8d340a39e08dcc12fb38b8ed254dc64.tar.xz samba-82dce8f7a8d340a39e08dcc12fb38b8ed254dc64.zip |
clitar.c: honor regex flag, emulate old behaviour (and quirks), add tests
Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
[ddiss@samba.org: split from test changes already upstream]
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/client/clitar.c')
-rw-r--r-- | source3/client/clitar.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source3/client/clitar.c b/source3/client/clitar.c index cf31f45c4ce..adb0ab4bfad 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -354,9 +354,17 @@ static bool tar_extract_skip_path(struct tar *t, { const bool skip = true; const char *fullpath = archive_entry_pathname(entry); - bool in; + bool in = true; + + if (t->path_list_size <= 0) { + return !skip; + } - in = t->path_list_size > 0 ? tar_path_in_list(t, fullpath, false) : true; + if (t->mode.regex) { + in = mask_match_list(fullpath, t->path_list, t->path_list_size, true); + } else { + in = tar_path_in_list(t, fullpath, false); + } if (t->mode.selection == TAR_EXCLUDE) { in = !in; @@ -405,7 +413,15 @@ static bool tar_create_skip_path(struct tar *t, } /* we are now in exclude mode */ - if (t->path_list_size > 0) { + + /* no matter the selection, no list => include everything */ + if (t->path_list_size <= 0) { + return !skip; + } + + if (t->mode.regex) { + in = mask_match_list(fullpath, t->path_list, t->path_list_size, true); + } else { in = tar_path_in_list(t, fullpath, isdir && !exclude); } |