]> git.sur5r.net Git - bacula/bacula/commitdiff
Use Client Catalog resource in get_catalog_resource() if "client" is specified in...
authorEric Bollengier <eric@baculasystems.com>
Tue, 11 Aug 2015 13:26:23 +0000 (15:26 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 19 Dec 2015 08:20:48 +0000 (09:20 +0100)
bacula/src/dird/ua_select.c

index f0917070932c192e7f6fb969d52401e52aecf72d..d7efcf98f0bc2a432ffeac939411044cce9332c9 100644 (file)
@@ -227,6 +227,7 @@ CAT *get_catalog_resource(UAContext *ua)
 {
    char name[MAX_NAME_LENGTH];
    CAT *catalog = NULL;
+   CLIENT *client = NULL;
    int i;
 
    for (i=1; i<ua->argc; i++) {
@@ -236,6 +237,15 @@ CAT *get_catalog_resource(UAContext *ua)
             break;
          }
       }
+      if (strcasecmp(ua->argk[i], NT_("client")) == 0 && ua->argv[i]) {
+         if (acl_access_ok(ua, Client_ACL, ua->argv[i])) {
+            client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[i]);
+            break;
+         }
+      }
+   }
+   if (!catalog && client) {    /* Try to take the catalog from the client */
+      catalog = client->catalog;
    }
    if (ua->gui && !catalog) {
       LockRes();