]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_cmds.c
Cleanup new timeout code for bconsole
[bacula/bacula] / bacula / src / dird / ua_cmds.c
index 2e5defaa99f08828645a544c1b0214a024445225..80fa7233e6594487288a15651a2637b90fccff3f 100644 (file)
@@ -122,7 +122,8 @@ static struct cmdstruct commands[] = {                                      /* C
  { NT_("delete"),     delete_cmd,    _("delete [volume=<vol-name> pool=<pool-name> job jobid=<id>]"), true},
  { NT_("disable"),    disable_cmd,   _("disable <job=name> -- disable a job"),        true},
  { NT_("enable"),     enable_cmd,    _("enable <job=name> -- enable a job"),          true},
- { NT_("estimate"),   estimate_cmd,  _("performs FileSet estimate, listing gives full listing"), true},
+ { NT_("estimate"),   estimate_cmd,  _("performs FileSet estimate, listing gives full listing"
+       "\n               you can make it more accurate with accurate=yes/no"), true},
  { NT_("exit"),       quit_cmd,      _("exit = quit"),                                false},
  { NT_("gui"),        gui_cmd,       _("gui [on|off] -- non-interactive gui mode"),   false},
  { NT_("help"),       help_cmd,      _("print this command"),                         false},
@@ -802,7 +803,7 @@ static void do_en_disable_cmd(UAContext *ua, bool setting)
 
    i = find_arg_with_value(ua, NT_("job")); 
    if (i < 0) { 
-      job = select_job_resource(ua);
+      job = select_enable_disable_job_resource(ua, setting);
       if (!job) {
          return;
       }
@@ -1137,6 +1138,7 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
    int listing = 0;
    char since[MAXSTRING];
    JCR *jcr = ua->jcr;
+   int accurate=-1;
 
    jcr->set_JobLevel(L_FULL);
    for (int i=1; i<ua->argc; i++) {
@@ -1148,6 +1150,10 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
                ua->error_msg(_("Client \"%s\" not found.\n"), ua->argv[i]);
                return 1;
             }
+            if (!acl_access_ok(ua, Client_ACL, client->name())) {
+               ua->error_msg(_("No authorization for Client \"%s\"\n"), client->name());
+               return 1;
+            }
             continue;
          } else {
             ua->error_msg(_("Client name missing.\n"));
@@ -1204,6 +1210,12 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
            return 1;
          }
       }
+      if (strcasecmp(ua->argk[i], NT_("accurate")) == 0) {
+         if (!is_yesno(ua->argv[i], &accurate)) {
+            ua->error_msg(_("Invalid value for accurate. " 
+                            "It must be yes or no.\n"));
+         }
+      }
    }
    if (!job && !(client && fileset)) {
       if (!(job = select_job_resource(ua))) {
@@ -1270,6 +1282,13 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
       goto bail_out;
    }
 
+   /* The level string change if accurate mode is enabled */
+   if (accurate >= 0) {
+      jcr->accurate = accurate;
+   } else {
+      jcr->accurate = job->accurate;
+   }
+
    if (!send_level_command(jcr)) {
       goto bail_out;
    }
@@ -1278,7 +1297,7 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
     * If the job is in accurate mode, we send the list of
     * all files to FD.
     */
-   jcr->accurate = job->accurate;
+   Dmsg1(40, "estimate accurate=%d\n", jcr->accurate);
    if (!send_accurate_current_files(jcr)) {
       goto bail_out;
    }