+GPtrArray *
+validate_optionstr(
+ disk_t *dp)
+{
+ GPtrArray *errarray;
+ int nb_exclude;
+ int nb_include;
+ am_feature_t *their_features = dp->host->features;
+
+ assert(dp != NULL);
+ assert(dp->host != NULL);
+
+ errarray = g_ptr_array_new();
+
+ if (!am_has_feature(their_features, fe_options_auth)) {
+ if (strcasecmp(dp->auth, "bsd") == 0)
+ if (!am_has_feature(their_features, fe_options_bsd_auth))
+ g_ptr_array_add(errarray, _("does not support auth"));
+ }
+
+ switch(dp->compress) {
+ case COMP_FAST:
+ if (!am_has_feature(their_features, fe_options_compress_fast)) {
+ g_ptr_array_add(errarray, _("does not support fast compression"));
+ }
+ break;
+ case COMP_BEST:
+ if (!am_has_feature(their_features, fe_options_compress_best)) {
+ g_ptr_array_add(errarray, _("does not support best compression"));
+ }
+ break;
+ case COMP_CUST:
+ if (am_has_feature(their_features, fe_options_compress_cust)) {
+ if (dp->clntcompprog == NULL || strlen(dp->clntcompprog) == 0) {
+ g_ptr_array_add(errarray, _("client custom compression with no compression program specified"));
+ }
+ } else {
+ g_ptr_array_add(errarray, _("does not support client custom compression"));
+ }
+ break;
+ case COMP_SERVER_FAST:
+ break;
+ case COMP_SERVER_BEST:
+ break;
+ case COMP_SERVER_CUST:
+ if (dp->srvcompprog == NULL || strlen(dp->srvcompprog) == 0) {
+ g_ptr_array_add(errarray, _("server custom compression with no compression program specified"));
+ }
+ break;
+ }
+
+ switch(dp->encrypt) {
+ case ENCRYPT_CUST:
+ if (am_has_feature(their_features, fe_options_encrypt_cust)) {
+ if (dp->clnt_decrypt_opt) {
+ if (!am_has_feature(their_features, fe_options_client_decrypt_option)) {
+ g_ptr_array_add(errarray, _("does not support client decrypt option"));
+ }
+ }
+ if (dp->clnt_encrypt == NULL || strlen(dp->clnt_encrypt) == 0) {
+ g_ptr_array_add(errarray, _("encrypt client with no encryption program specified"));
+ }
+ if (dp->compress == COMP_SERVER_FAST ||
+ dp->compress == COMP_SERVER_BEST ||
+ dp->compress == COMP_SERVER_CUST ) {
+ g_ptr_array_add(errarray, _("Client encryption with server compression is not supported. See amanda.conf(5) for detail"));
+ }
+ } else {
+ g_ptr_array_add(errarray, _("does not support client data encryption"));
+ }
+ break;
+ case ENCRYPT_SERV_CUST:
+ if (dp->srv_encrypt == NULL || strlen(dp->srv_encrypt) == 0) {
+ g_ptr_array_add(errarray, _("No encryption program specified in dumptypes, Change the dumptype in the disklist or mention the encryption program to use in the dumptypes file"));
+ }
+ break;
+ }
+
+ if (!dp->record) {
+ if (!am_has_feature(their_features, fe_options_no_record)) {
+ g_ptr_array_add(errarray, _("does not support no record"));
+ }
+ }
+
+ if (dp->index) {
+ if (!am_has_feature(their_features, fe_options_index)) {
+ g_ptr_array_add(errarray, _("does not support index"));
+ }
+ }
+
+ if (dp->kencrypt) {
+ if (!am_has_feature(their_features, fe_options_kencrypt)) {
+ g_ptr_array_add(errarray, _("does not support kencrypt"));
+ }
+ }
+
+ nb_exclude = 0;
+ if (dp->exclude_file != NULL && dp->exclude_file->nb_element > 0) {
+ nb_exclude = dp->exclude_file->nb_element;
+ if (!am_has_feature(their_features, fe_options_exclude_file)) {
+ g_ptr_array_add(errarray, _("does not support exclude file"));
+ }
+ }
+
+ if (dp->exclude_list != NULL && dp->exclude_list->nb_element > 0) {
+ nb_exclude += dp->exclude_list->nb_element;
+ if (!am_has_feature(their_features, fe_options_exclude_list)) {
+ g_ptr_array_add(errarray, _("does not support exclude list"));
+ }
+ }
+
+ if (nb_exclude > 1 &&
+ !am_has_feature(their_features, fe_options_multiple_exclude)) {
+ g_ptr_array_add(errarray, _("does not support multiple exclude"));
+ }
+
+ nb_include = 0;
+ if (dp->include_file != NULL && dp->include_file->nb_element > 0) {
+ nb_include = dp->include_file->nb_element;
+ if (!am_has_feature(their_features, fe_options_include_file)) {
+ g_ptr_array_add(errarray, ("does not support include file"));
+ }
+ }
+
+ if (dp->include_list != NULL && dp->include_list->nb_element > 0) {
+ nb_include += dp->include_list->nb_element;
+ if (!am_has_feature(their_features, fe_options_include_list)) {
+ g_ptr_array_add(errarray, _("does not support include list"));
+ }
+ }
+
+ if (nb_include > 1 &&
+ !am_has_feature(their_features, fe_options_multiple_exclude)) {
+ g_ptr_array_add(errarray, _("does not support multiple include"));
+ }
+
+ if (dp->exclude_optional) {
+ if (!am_has_feature(their_features, fe_options_optional_exclude)) {
+ g_ptr_array_add(errarray, _("does not support optional exclude"));
+ }
+ }
+ if (dp->include_optional) {
+ if (!am_has_feature(their_features, fe_options_optional_include)) {
+ g_ptr_array_add(errarray, _("does not support optional include"));
+ }
+ }
+
+ return errarray;
+}
+