- findINCEXE *incexe = (findINCEXE *)fileset->include_list.get(i);
- fileset->incexe = incexe;
- /*
- * By setting all options, we in effect or the global options
- * which is what we want.
- */
- for (j=0; j<incexe->opts_list.size(); j++) {
- findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j);
- ff->flags |= fo->flags;
- ff->GZIP_level = fo->GZIP_level;
- ff->fstypes = fo->fstype;
- bstrncat(ff->VerifyOpts, fo->VerifyOpts, sizeof(ff->VerifyOpts));
- }
- for (j=0; j<incexe->name_list.size(); j++) {
- Dmsg1(100, "F %s\n", (char *)incexe->name_list.get(j));
- char *fname = (char *)incexe->name_list.get(j);
- if (find_one_file(jcr, ff, our_callback, his_pkt, fname, (dev_t)-1, 1) == 0) {
- return 0; /* error return */
- }
- }
- }
- } else {
- struct s_included_file *inc = NULL;
-
- /* This is the old deprecated way */
- while (!job_canceled(jcr) && (inc = get_next_included_file(ff, inc))) {
- /* Copy options for this file */
- bstrncat(ff->VerifyOpts, inc->VerifyOpts, sizeof(ff->VerifyOpts));
- Dmsg1(100, "find_files: file=%s\n", inc->fname);
- if (!file_is_excluded(ff, inc->fname)) {
- if (find_one_file(jcr, ff, callback, his_pkt, inc->fname, (dev_t)-1, 1) ==0) {
- return 0; /* error return */
- }
- }
+ findINCEXE *incexe = (findINCEXE *)fileset->include_list.get(i);
+ fileset->incexe = incexe;
+
+ /* Here, we reset some values between two different Include{} */
+ strcpy(ff->VerifyOpts, "V");
+ strcpy(ff->AccurateOpts, "Cmcs"); /* mtime+ctime+size by default */
+ strcpy(ff->BaseJobOpts, "Jspug5"); /* size+perm+user+group+chk */
+ ff->plugin = NULL;
+ ff->opt_plugin = false;
+
+ /*
+ * By setting all options, we in effect OR the global options
+ * which is what we want.
+ */
+ for (j=0; j<incexe->opts_list.size(); j++) {
+ findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j);
+ /* TODO options are "simply" reset by Options block that come next
+ * For example :
+ * Options { IgnoreCase = yes }
+ * ATTN: some plugins use AddOptions() that create extra Option block
+ * Also see accept_file() below that could suffer of the same problem
+ */
+ ff->flags |= fo->flags;
+ /* If the compress option was set in the previous block, overwrite the
+ * algorithm only if defined
+ */
+ if ((ff->flags & FO_COMPRESS) && fo->Compress_algo != 0) {
+ ff->Compress_algo = fo->Compress_algo;
+ ff->Compress_level = fo->Compress_level;
+ }
+ ff->strip_path = fo->strip_path;
+ ff->fstypes = fo->fstype;
+ ff->drivetypes = fo->drivetype;
+ if (fo->plugin != NULL) {
+ ff->plugin = fo->plugin; /* TODO: generate a plugin event ? */
+ ff->opt_plugin = true;
+ }
+ bstrncat(ff->VerifyOpts, fo->VerifyOpts, sizeof(ff->VerifyOpts)); /* TODO: Concat or replace? */
+ if (fo->AccurateOpts[0]) {
+ bstrncpy(ff->AccurateOpts, fo->AccurateOpts, sizeof(ff->AccurateOpts));
+ }
+ if (fo->BaseJobOpts[0]) {
+ bstrncpy(ff->BaseJobOpts, fo->BaseJobOpts, sizeof(ff->BaseJobOpts));
+ }
+ }
+ Dmsg4(50, "Verify=<%s> Accurate=<%s> BaseJob=<%s> flags=<%lld>\n",
+ ff->VerifyOpts, ff->AccurateOpts, ff->BaseJobOpts, ff->flags);
+ dlistString *node;
+ foreach_dlist(node, &incexe->name_list) {
+ char *fname = node->c_str();
+ Dmsg1(dbglvl, "F %s\n", fname);
+
+ ff->top_fname = fname;
+ /* Convert the filename if needed */
+ if (ff->snapshot_convert_fct) {
+ ff->snapshot_convert_fct(jcr, ff, &incexe->name_list, node);
+ }
+
+ if (find_one_file(jcr, ff, our_callback, ff->top_fname, (dev_t)-1, true) == 0) {
+ return 0; /* error return */
+ }
+
+ if (job_canceled(jcr)) {
+ return 0;
+ }
+ }
+ foreach_dlist(node, &incexe->plugin_list) {
+ char *fname = node->c_str();
+ if (!plugin_save) {
+ Jmsg(jcr, M_FATAL, 0, _("Plugin: \"%s\" not found.\n"), fname);
+ return 0;
+ }
+ Dmsg1(dbglvl, "PluginCommand: %s\n", fname);
+ ff->top_fname = fname;
+ ff->cmd_plugin = true;
+
+ /* Make sure that opt plugin is not set
+ * The current implementation doesn't allow option plugin
+ * and command plugin to run at the same time
+ */
+ ff->opt_plugin = false;
+ ff->plugin = NULL;
+
+ plugin_save(jcr, ff, true);
+ ff->cmd_plugin = false;
+ if (job_canceled(jcr)) {
+ return 0;
+ }
+ }