]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_dotcmds.c
update configure
[bacula/bacula] / bacula / src / dird / ua_dotcmds.c
index 086409e2f7a65d666deafea08cd058c137f7c557..2bd5f1f83503767e5880b5da1c60c393b0050571 100644 (file)
@@ -71,6 +71,7 @@ static bool mediatypescmd(UAContext *ua, const char *cmd);
 static bool locationscmd(UAContext *ua, const char *cmd);
 static bool mediacmd(UAContext *ua, const char *cmd);
 static bool aopcmd(UAContext *ua, const char *cmd);
+static bool catalogscmd(UAContext *ua, const char *cmd);
 
 static bool dot_bvfs_lsdirs(UAContext *ua, const char *cmd);
 static bool dot_bvfs_lsfiles(UAContext *ua, const char *cmd);
@@ -91,6 +92,7 @@ static struct cmdstruct commands[] = { /* help */  /* can be used in runscript *
  { NT_(".api"),        api_cmd,                  NULL,       false},
  { NT_(".backups"),    backupscmd,               NULL,       false},
  { NT_(".clients"),    clientscmd,               NULL,       true},
+ { NT_(".catalogs"),   catalogscmd,              NULL,       false},
  { NT_(".defaults"),   defaultscmd,              NULL,       false},
  { NT_(".die"),        admin_cmds,               NULL,       false},
  { NT_(".dump"),       admin_cmds,               NULL,       false},
@@ -168,8 +170,7 @@ bool do_a_dot_command(UAContext *ua)
       }
    }
    if (!found) {
-      pm_strcat(user->msg, _(": is an invalid command.\n"));
-      ua->error_msg("%s", user->msg);
+      ua->error_msg("%s%s", ua->argk[0], _(": is an invalid command.\n"));
       ok = false;
    }
    return ok;
@@ -789,6 +790,19 @@ static bool filesetscmd(UAContext *ua, const char *cmd)
    return true;
 }
 
+static bool catalogscmd(UAContext *ua, const char *cmd)
+{
+   CAT *cat;
+   LockRes();
+   foreach_res(cat, R_CATALOG) {
+      if (acl_access_ok(ua, Catalog_ACL, cat->name())) {
+         ua->send_msg("%s\n", cat->name());
+      }
+   }
+   UnlockRes();
+   return true;
+}
+
 static bool clientscmd(UAContext *ua, const char *cmd)
 {
    CLIENT *client;