- if(recursive)
- {
- lreply(200, " Opaque recursive list of %s", dir);
- for (dir_item = get_dir_list(); dir_item != NULL;
- dir_item = dir_item->next) {
- if(am_has_feature(their_features, fe_amindexd_fileno_in_ORLD)){
- fast_lreply(201, " %s %d %-16s %d %s",
- dir_item->dump->date, dir_item->dump->level,
- dir_item->dump->tape, dir_item->dump->file,
- dir_item->path);
- }
- else {
- fast_lreply(201, " %s %d %-16s %s",
- dir_item->dump->date, dir_item->dump->level,
- dir_item->dump->tape, dir_item->path);
- }
- }
- reply(200, " Opaque recursive list of %s", dir);
- }
- else
- {
- lreply(200, " Opaque list of %s", dir);
- for (dir_item = get_dir_list(); dir_item != NULL;
- dir_item = dir_item->next) {
- if(am_has_feature(their_features, fe_amindexd_fileno_in_OLSD)){
- lreply(201, " %s %d %-16s %d %s",
- dir_item->dump->date, dir_item->dump->level,
- dir_item->dump->tape, dir_item->dump->file,
- dir_item->path);
- }
- else {
- lreply(201, " %s %d %-16s %s",
- dir_item->dump->date, dir_item->dump->level,
- dir_item->dump->tape, dir_item->path);
- }
- }
- reply(200, " Opaque list of %s", dir);
+ lreply(200, " Opaque list of %s", dir);
+ for (dir_item = get_dir_list(); dir_item != NULL;
+ dir_item = dir_item->next) {
+ char *tapelist_str;
+
+ if (!am_has_feature(their_features, marshall_feature) &&
+ (num_entries(dir_item->dump->tapes) > 1 ||
+ dir_item->dump->tapes->numfiles > 1)) {
+ fast_lreply(501, " ERROR: Split dumps not supported"
+ " with old version of amrecover.");
+ break;
+ } else {
+ if (am_has_feature(their_features, marshall_feature)) {
+ tapelist_str = marshal_tapelist(dir_item->dump->tapes, 1);
+ } else {
+ tapelist_str = dir_item->dump->tapes->label;
+ }
+
+ if((!recursive && am_has_feature(their_features,
+ fe_amindexd_fileno_in_OLSD))
+ ||
+ (recursive && am_has_feature(their_features,
+ fe_amindexd_fileno_in_ORLD))) {
+ str_buffer_size = strlen(dir_item->dump->date) +
+ NUM_STR_SIZE + strlen(tapelist_str) +
+ strlen(dir_item->path) + NUM_STR_SIZE + 9;
+ fast_lreply(201, " %s %d %s %d %s",
+ dir_item->dump->date, dir_item->dump->level,
+ tapelist_str, dir_item->dump->file,
+ dir_item->path);
+ }
+ else {
+ str_buffer_size = strlen(dir_item->dump->date) +
+ NUM_STR_SIZE + strlen(tapelist_str) +
+ strlen(dir_item->path) + 9;
+ fast_lreply(201, " %s %d %s %s",
+ dir_item->dump->date, dir_item->dump->level,
+ tapelist_str, dir_item->path);
+ }
+ if(am_has_feature(their_features, marshall_feature)) {
+ amfree(tapelist_str);
+ }
+ str_buffer_size = STR_SIZE;
+ }