fix spurious directory inclusion that causes piuparts errors
[debian/amanda] / server-src / amadmin.c
index 7930e0bd2dc86cef8d9d700e758530d47db522dc..bd26906c1553ac5e6ce6131dae8d209206967b9b 100644 (file)
@@ -1183,14 +1183,6 @@ find(
                afind->next = new_output_find;
                new_output_find = afind;
            } else {
-               amfree(afind->timestamp);
-               amfree(afind->write_timestamp);
-               amfree(afind->hostname);
-               amfree(afind->diskname);
-               amfree(afind->label);
-               amfree(afind->status);
-               amfree(afind->dump_status);
-               amfree(afind->message);
                amfree(afind);
            }
        }
@@ -1644,13 +1636,16 @@ export_one(
 {
     info_t info;
     int i,l;
+    char *qhost, *qdisk;
 
     if(get_info(dp->host->hostname, dp->name, &info)) {
        g_fprintf(stderr, _("Warning: no curinfo record for %s:%s\n"),
                dp->host->hostname, dp->name);
        return;
     }
-    g_printf(_("host: %s\ndisk: %s\n"), dp->host->hostname, dp->name);
+    qhost = quote_string(dp->host->hostname);
+    qdisk = quote_string(dp->name);
+    g_printf(_("host: %s\ndisk: %s\n"), qhost, qdisk);
     g_printf(_("command: %u\n"), info.command);
     g_printf(_("last_level: %d\n"),info.last_level);
     g_printf(_("consecutive_runs: %d\n"),info.consecutive_runs);
@@ -1682,6 +1677,8 @@ export_one(
               (intmax_t)info.history[l].date);
     }
     g_printf("//\n");
+    amfree(qhost);
+    amfree(qdisk);
 }
 
 /* ----------------------------------------------- */
@@ -1726,7 +1723,10 @@ import_db(
     skip_whitespace(s, ch);
     if(ch == '\0'
        || sscanf(s - 1, "%d.%d.%d", &vers_maj, &vers_min, &vers_patch) != 3) {
-       goto bad_header;
+       vers_patch = -1;
+       if (sscanf(s - 1, "%d.%d", &vers_maj, &vers_min) != 2) {
+           goto bad_header;
+       }
     }
 
     skip_integer(s, ch);                       /* skip over major */
@@ -1735,11 +1735,15 @@ import_db(
     }
     ch = *s++;
     skip_integer(s, ch);                       /* skip over minor */
-    if(ch != '.') {
-       goto bad_header;
+    if (vers_patch != -1) {
+       if (ch != '.') {
+           goto bad_header;
+       }
+       ch = *s++;
+       skip_integer(s, ch);                    /* skip over patch */
+    } else {
+       vers_patch = 0;
     }
-    ch = *s++;
-    skip_integer(s, ch);                       /* skip over patch */
 
     hdr = "comment";
     if(ch == '\0') {
@@ -1828,9 +1832,9 @@ import_one(void)
     skip_whitespace(s, ch);
     if(ch == '\0') goto parse_err;
     fp = s-1;
-    skip_non_whitespace(s, ch);
+    skip_quoted_string(s, ch);
     s[-1] = '\0';
-    hostname = stralloc(fp);
+    hostname = unquote_string(fp);
     s[-1] = (char)ch;
 
     skip_whitespace(s, ch);
@@ -1845,9 +1849,9 @@ import_one(void)
     skip_whitespace(s, ch);
     if(ch == '\0') goto parse_err;
     fp = s-1;
-    skip_non_whitespace(s, ch);
+    skip_quoted_string(s, ch);
     s[-1] = '\0';
-    diskname = stralloc(fp);
+    diskname = unquote_string(fp);
     s[-1] = (char)ch;
 
     amfree(line);
@@ -2096,7 +2100,7 @@ disklist_one(
     hp = dp->host;
     ip = hp->netif;
 
-    g_printf("line %d:\n", dp->line);
+    g_printf("line %d (%s):\n", dp->line, dp->filename);
 
     g_printf("    host %s:\n", hp->hostname);
     g_printf("        interface %s\n",
@@ -2296,6 +2300,15 @@ disklist_one(
        free(*r1);
        }
     }
+    if (dumptype_seen(dtype, DUMPTYPE_DUMP_LIMIT)) {
+       char **rl, **r1;
+       rl = val_t_display_strs(dumptype_getconf((dtype),
+                               DUMPTYPE_DUMP_LIMIT), 1);
+       for(r1 = rl; *r1 != NULL; r1++) {
+           g_printf("        dump-limit %s\n", *r1);
+       free(*r1);
+       }
+    }
     g_printf("        spindle %d\n", dp->spindle);
     pp_scriptlist = dp->pp_scriptlist;
     while (pp_scriptlist != NULL) {