X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Famfeatures.c;h=78bf0d406433d49cf05bd804a70e834ff2803b9e;hb=c6f0a88c567f8536c498f554285aed1f8150da18;hp=5d03ed53f8f9a67565e7b0739b98e012ad10d787;hpb=2627875b7d18858bc1f9f7652811e4d8c15a23eb;p=debian%2Famanda diff --git a/common-src/amfeatures.c b/common-src/amfeatures.c index 5d03ed5..78bf0d4 100644 --- a/common-src/amfeatures.c +++ b/common-src/amfeatures.c @@ -89,7 +89,6 @@ am_init_feature_set(void) am_add_feature(f, fe_options_include_list); am_add_feature(f, fe_options_multiple_include); am_add_feature(f, fe_options_optional_include); - am_add_feature(f, fe_options_krb4_auth); am_add_feature(f, fe_options_kencrypt); am_add_feature(f, fe_req_options_maxdumps); @@ -107,7 +106,6 @@ am_init_feature_set(void) am_add_feature(f, fe_amidxtaped_disk); am_add_feature(f, fe_amidxtaped_datestamp); am_add_feature(f, fe_amidxtaped_header); - am_add_feature(f, fe_amidxtaped_nargs); am_add_feature(f, fe_amidxtaped_config); am_add_feature(f, fe_recover_splits); @@ -154,6 +152,20 @@ am_init_feature_set(void) am_add_feature(f, fe_xml_estimate); am_add_feature(f, fe_xml_property_priority); am_add_feature(f, fe_sendsize_rep_warning); + am_add_feature(f, fe_xml_estimatelist); + am_add_feature(f, fe_xml_level_server); + am_add_feature(f, fe_xml_data_path); + am_add_feature(f, fe_xml_directtcp_list); + am_add_feature(f, fe_amidxtaped_datapath); + am_add_feature(f, fe_sendbackup_noop); + am_add_feature(f, fe_amrecover_origsize_in_header); + am_add_feature(f, fe_amidxtaped_abort); + am_add_feature(f, fe_amrecover_correct_disk_quoting); + am_add_feature(f, fe_amindexd_quote_label); + am_add_feature(f, fe_amrecover_receive_unfiltered); + am_add_feature(f, fe_application_client_name); + am_add_feature(f, fe_script_client_name); + am_add_feature(f, fe_dumptype_property); } return f; } @@ -194,7 +206,6 @@ am_set_default_feature_set(void) am_add_feature(f, fe_options_index); am_add_feature(f, fe_options_exclude_file); am_add_feature(f, fe_options_exclude_list); - am_add_feature(f, fe_options_krb4_auth); am_add_feature(f, fe_options_kencrypt); am_add_feature(f, fe_req_options_maxdumps); @@ -408,6 +419,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(); @@ -418,10 +430,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)) { @@ -430,88 +442,28 @@ am_string_to_feature( ch2 -= 'a'; ch2 += 10; } else if (ch2 >= 'A' && ch2 <= 'F') { - ch2 -= 'a'; + ch2 -= 'A'; ch2 += 10; - } else { - am_release_feature_set(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) -int -main( - int argc, - char ** argv) +am_feature_t * +am_features( + am_feature_t *f) { - am_feature_t *f; - am_feature_t *f1; - char *s; - char *s1; - int i; - int n; - - /* - * Configure program for internationalization: - * 1) Only set the message locale for now. - * 2) Set textdomain for all amanda related programs to "amanda" - * We don't want to be forced to support dozens of message catalogs. - */ - setlocale(LC_MESSAGES, "C"); - textdomain("amanda"); - - f = am_init_feature_set(); - if (f == NULL) { - g_fprintf(stderr, _("cannot initialize feature set\n")); - return 1; - } - - s = am_feature_to_string(f); - g_printf(_("base features=%s\n"), s); - - f1 = am_string_to_feature(s); - s1 = am_feature_to_string(f1); - if (strcmp(s, s1) != 0) { - g_fprintf(stderr, _("base feature -> string -> feature set mismatch\n")); - g_fprintf(stderr, _("conv features=%s\n"), s); - } - - amfree(s1); - amfree(s); - - for (i = 1; i < argc; i++) { - if (argv[i][0] == '+') { - n = atoi(&argv[i][1]); - if (am_add_feature(f, (am_feature_e)n)) { - g_printf(_("added feature number %d\n"), n); - } else { - g_printf(_("could not add feature number %d\n"), n); - } - } else if (argv[i][0] == '-') { - n = atoi(&argv[i][1]); - if (am_remove_feature(f, (am_feature_e)n)) { - g_printf(_("removed feature number %d\n"), n); - } else { - g_printf(_("could not remove feature number %d\n"), n); - } - } else { - n = atoi(argv[i]); - if (am_has_feature(f, (am_feature_e)n)) { - g_printf(_("feature %d is set\n"), n); - } else { - g_printf(_("feature %d is not set\n"), n); - } - } - } - - s = am_feature_to_string(f); - g_printf(_(" new features=%s\n"), s); - amfree(s); - - return 0; + return f; } -#endif