]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_dotcmds.c
- Back port changes to 1.38.5
[bacula/bacula] / bacula / src / dird / ua_dotcmds.c
index 8770d38258625d3467c3aad37a86e12a5afd4fc9..e426ed89696d72b87162d2ccb7efdfab8c0de8b9 100644 (file)
@@ -11,7 +11,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2002-2005 Kern Sibbald
+   Copyright (C) 2002-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -258,8 +258,12 @@ static int defaultscmd(UAContext *ua, const char *cmd)
    STORE *storage;
    POOL *pool;
 
+   if (ua->argc != 2 || !ua->argv[1]) {
+      return 1;
+   }
+
    /* Job defaults */   
-   if (ua->argc == 2 && strcmp(ua->argk[1], "job") == 0) {
+   if (strcmp(ua->argk[1], "job") == 0) {
       job = (JOB *)GetResWithName(R_JOB, ua->argv[1]);
       if (job) {
          STORE *store;
@@ -273,10 +277,11 @@ static int defaultscmd(UAContext *ua, const char *cmd)
          bsendmsg(ua, "level=%s", level_to_str(job->JobLevel));
          bsendmsg(ua, "type=%s", job_type_to_str(job->JobType));
          bsendmsg(ua, "fileset=%s", job->fileset->hdr.name);
+         bsendmsg(ua, "enabled=%d", job->enabled);
       }
    } 
    /* Client defaults */
-   else if(ua->argc == 2 && strcmp(ua->argk[1], "client") == 0) {
+   else if (strcmp(ua->argk[1], "client") == 0) {
      client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[1]);
      if (client) {
        bsendmsg(ua, "client=%s", client->hdr.name);
@@ -288,27 +293,30 @@ static int defaultscmd(UAContext *ua, const char *cmd)
      }
    }
    /* Storage defaults */
-   else if(ua->argc == 2 && strcmp(ua->argk[1], "storage") == 0) {
+   else if (strcmp(ua->argk[1], "storage") == 0) {
      storage = (STORE *)GetResWithName(R_STORAGE, ua->argv[1]);
-     DEVICE *device = (DEVICE *)storage->device->first();
+     DEVICE *device;
      if (storage) {
        bsendmsg(ua, "storage=%s", storage->hdr.name);
        bsendmsg(ua, "address=%s", storage->address);
+       bsendmsg(ua, "enabled=%d", storage->enabled);
        bsendmsg(ua, "media_type=%s", storage->media_type);
        bsendmsg(ua, "sdport=%d", storage->SDport);
+       device = (DEVICE *)storage->device->first();
        bsendmsg(ua, "device=%s", device->hdr.name);
-       if (storage->device->size() > 1)
-        while ((device = (DEVICE *)storage->device->next()))
-          bsendmsg(ua, ",%s", device->hdr.name);
+       if (storage->device->size() > 1) {
+         while ((device = (DEVICE *)storage->device->next()))
+           bsendmsg(ua, ",%s", device->hdr.name);
+       }
      }
    }
    /* Pool defaults */
-   else if(ua->argc == 2 && strcmp(ua->argk[1], "pool") == 0) {
+   else if (strcmp(ua->argk[1], "pool") == 0) {
      pool = (POOL *)GetResWithName(R_POOL, ua->argv[1]);
      if (pool) {
        bsendmsg(ua, "pool=%s", pool->hdr.name);
        bsendmsg(ua, "pool_type=%s", pool->pool_type);
-       bsendmsg(ua, "label_format=%s", pool->label_format);
+       bsendmsg(ua, "label_format=%s", pool->label_format?pool->label_format:"");
        bsendmsg(ua, "use_volume_once=%d", pool->use_volume_once);
        bsendmsg(ua, "accept_any_volume=%d", pool->accept_any_volume);
        bsendmsg(ua, "purge_oldest_volume=%d", pool->purge_oldest_volume);