Imported Upstream version 2.6.1p1
[debian/amanda] / common-src / amfeatures.c
index 675a647eba48691b24f243c874f9271ff8fb9f02..5364ae4181204a94483662f893d6d224bc0e79a7 100644 (file)
@@ -72,7 +72,7 @@ am_init_feature_set(void)
 
        am_add_feature(f, fe_program_dump);
        am_add_feature(f, fe_program_gnutar);
-       am_add_feature(f, fe_program_backup_api);
+       am_add_feature(f, fe_program_application_api);
 
        am_add_feature(f, fe_options_compress_fast);
        am_add_feature(f, fe_options_compress_best);
@@ -147,6 +147,13 @@ am_init_feature_set(void)
        am_add_feature(f, fe_req_options_config);
 
        am_add_feature(f, fe_rep_sendsize_quoted_error);
+       am_add_feature(f, fe_req_xml);
+       am_add_feature(f, fe_pp_script);
+       am_add_feature(f, fe_amindexd_DLE);
+       am_add_feature(f, fe_amrecover_dle_in_header);
+       am_add_feature(f, fe_xml_estimate);
+       am_add_feature(f, fe_xml_property_priority);
+       am_add_feature(f, fe_sendsize_rep_warning);
     }
     return f;
 }
@@ -401,6 +408,7 @@ am_string_to_feature(
     am_feature_t               *f = NULL;
     size_t                     i;
     int                                ch1, ch2;
+    char *                     orig = s;
 
     if (s != NULL && strcmp(s,"UNKNOWNFEATURE") != 0) {
        f = am_allocate_feature_set();
@@ -411,10 +419,10 @@ am_string_to_feature(
                ch1 -= 'a';
                ch1 += 10;
            } else if (ch1 >= 'A' && ch1 <= 'F') {
-               ch1 -= 'a';
+               ch1 -= 'A';
                ch1 += 10;
            } else {
-               break;
+               goto bad;
            }
            ch2 = *s++;
            if (isdigit(ch2)) {
@@ -423,16 +431,23 @@ am_string_to_feature(
                ch2 -= 'a';
                ch2 += 10;
            } else if (ch2 >= 'A' && ch2 <= 'F') {
-               ch2 -= 'a';
+               ch2 -= 'A';
                ch2 += 10;
-           } else {
-               amfree(f);                              /* bad conversion */
+           } else if (ch2 == '\0') {
+               g_warning("odd number of digits in amfeature string; truncating");
                break;
+           } else {
+               goto bad;
            }
            f->bytes[i] = (unsigned char)((ch1 << 4) | ch2);
        }
     }
     return f;
+
+bad:
+    g_warning("Bad feature string '%s'", orig);
+    am_release_feature_set(f);
+    return NULL;
 }
 
 #if defined(TEST)