return config_errors(NULL);
}
+am_host_t *
+get_hostlist(void)
+{
+ return hostlist;
+}
+
am_host_t *
lookup_host(
const char *hostname)
while (dl->head != NULL) {
dp = dequeue_disk(dl);
+ amfree(dp->filename);
amfree(dp->name);
amfree(dp->hostname);
amfree(dp->device);
fp = s - 1;
skip_non_whitespace(s, ch);
s[-1] = '\0';
+ if (g_str_equal(fp, "includefile")) {
+ char *include_name;
+ char *include_filename;
+ skip_whitespace(s, ch);
+ if (ch == '\0' || ch == '#') {
+ disk_parserror(filename, line_num, _("include filename name expected"));
+ return (-1);
+ }
+ fp = s - 1;
+ skip_quoted_string(s, ch);
+ s[-1] = '\0';
+ include_name = unquote_string(fp);
+ include_filename = config_dir_relative(include_name);
+ read_diskfile(include_filename, lst);
+ g_free(include_filename);
+ g_free(include_name);
+ if (config_errors(NULL) >= CFGERR_WARNINGS) {
+ return -1;
+ } else {
+ return 0;
+ }
+ }
host = lookup_host(fp);
if (host == NULL) {
hostname = stralloc(fp);
}
if (!disk) {
disk = alloc(SIZEOF(disk_t));
+ disk->filename = g_strdup(filename);
disk->line = line_num;
disk->hostname = hostname;
disk->name = diskname;
disk->comprate[0] = dumptype_get_comprate(dtype)[0];
disk->comprate[1] = dumptype_get_comprate(dtype)[1];
disk->data_path = dumptype_get_data_path(dtype);
+ disk->dump_limit = dumptype_get_dump_limit(dtype);
/*
* Boolean parameters with no value (Appears here as value 2) defaults
return result;
}
-
+typedef struct {
+ am_feature_t *features;
+ char *result;
+} xml_app_t;
+
+/* A GHFunc (callback for g_hash_table_foreach) */
+static void xml_property(
+ gpointer key_p,
+ gpointer value_p,
+ gpointer user_data_p)
+{
+ char *tmp;
+ property_t *property = value_p;
+ xml_app_t *xml_app = user_data_p;
+ GSList *value;
+ GString *strbuf;
+
+ strbuf = g_string_new(xml_app->result);
+
+ tmp = amxml_format_tag("name", (char *)key_p);
+ g_string_append_printf(strbuf, " <property>\n %s\n", tmp);
+ g_free(tmp);
+
+ // TODO if client have fe_xml_property_priority
+ if (property->priority
+ && am_has_feature(xml_app->features, fe_xml_property_priority))
+ g_string_append(strbuf, " <priority>yes</priority>\n");
+
+ for (value = property->values; value != NULL; value = value->next) {
+ tmp = amxml_format_tag("value", value->data);
+ g_string_append_printf(strbuf, " %s", tmp);
+ g_free(tmp);
+ }
+ g_string_append_printf(strbuf, "\n </property>\n");
+
+ g_free(xml_app->result);
+ xml_app->result = g_string_free(strbuf, FALSE);
+}
+
char *
xml_optionstr(
disk_t * dp,
return result;
}
+char *
+xml_dumptype_properties(
+ disk_t *dp)
+{
+ xml_app_t xml_dumptype;
+
+ xml_dumptype.result = g_strdup("");
+ xml_dumptype.features = NULL;
+ if (dp && dp->config) {
+ g_hash_table_foreach(dumptype_get_property(dp->config), xml_property,
+ &xml_dumptype);
+ }
+ return xml_dumptype.result;
+}
+
char *
xml_estimate(
estimatelist_t estimatelist,
char *
clean_dle_str_for_client(
- char *dle_str)
+ char *dle_str,
+ am_feature_t *their_features)
{
char *rval_dle_str;
char *hack1, *hack2;
+ char *pend, *pscript, *pproperty, *eproperty;
+ int len;
if (!dle_str)
return NULL;
#undef SC
#undef SC_LEN
- return rval_dle_str;
-}
-
-typedef struct {
- am_feature_t *features;
- char *result;
-} xml_app_t;
-
-/* A GHFunc (callback for g_hash_table_foreach) */
-static void xml_property(
- gpointer key_p,
- gpointer value_p,
- gpointer user_data_p)
-{
- char *property_s = key_p;
- char *b64property;
- property_t *property = value_p;
- char *b64value_data;
- xml_app_t *xml_app = user_data_p;
- GSList *value;
-
- b64property = amxml_format_tag("name", property_s);
- vstrextend(&xml_app->result, " <property>\n",
- " ", b64property, "\n", NULL);
- // TODO if client have fe_xml_property_priority
- if (property->priority &&
- am_has_feature(xml_app->features, fe_xml_property_priority)) {
- vstrextend(&xml_app->result, " <priority>yes</priority>\n", NULL);
- }
- for(value = property->values; value != NULL; value = value->next) {
- b64value_data = amxml_format_tag("value", value->data);
- vstrextend(&xml_app->result, " ", b64value_data, "\n", NULL);
- amfree(b64value_data);
+ if (!am_has_feature(their_features, fe_dumptype_property)) {
+#define SC "</property>\n"
+#define SC_LEN strlen(SC)
+ /* remove all dle properties, they are before backup-program or script
+ properties */
+ hack1 = rval_dle_str;
+ pend = strstr(rval_dle_str, "<backup-program>");
+ pscript = strstr(rval_dle_str, "<script>");
+ if (pscript && pscript < pend)
+ pend = pscript;
+ if (!pend) /* the complete string */
+ pend = rval_dle_str + strlen(rval_dle_str);
+ while (hack1) {
+ pproperty = strstr(hack1, " <property>");
+ if (pproperty && pproperty < pend) { /* remove it */
+ eproperty = strstr(pproperty, SC);
+ len = eproperty + SC_LEN - pproperty;
+ memmove(pproperty, eproperty + SC_LEN, strlen(eproperty + SC_LEN) + 1);
+ pend -= len;
+ hack1 = pproperty;
+ } else {
+ hack1 = NULL;
+ }
+ }
+ } else {
}
- vstrextend(&xml_app->result, " </property>\n", NULL);
+#undef SC
+#undef SC_LEN
- amfree(b64property);
+ return rval_dle_str;
}
+
char *
xml_application(
disk_t *dp G_GNUC_UNUSED,
{
char *plugin;
char *b64plugin;
+ char *client_name;
xml_app_t xml_app;
proplist_t proplist;
proplist = application_get_property(application);
g_hash_table_foreach(proplist, xml_property, &xml_app);
+ client_name = application_get_client_name(application);
+ if (client_name && strlen(client_name) > 0 &&
+ am_has_feature(their_features, fe_application_client_name)) {
+ char *b64client_name = amxml_format_tag("client_name", client_name);
+ vstrextend(&xml_app.result, " ", b64client_name, "\n", NULL);
+ }
+
vstrextend(&xml_app.result, " </backup-program>\n", NULL);
amfree(b64plugin);
return xml_app.result;
}
-
+
char *
xml_scripts(
identlist_t pp_scriptlist,
{
char *plugin;
char *b64plugin;
+ char *client_name;
char *xml_scr;
char *xml_scr1;
char *str = "";
execute_on = pp_script_get_execute_on(pp_script);
sep = "";
- eo_str = NULL;
+ eo_str = stralloc("");
if (execute_on & EXECUTE_ON_PRE_DLE_AMCHECK) {
eo_str = vstrextend(&eo_str, sep, "PRE-DLE-AMCHECK", NULL);
sep = ",";
proplist = pp_script_get_property(pp_script);
xml_app.result = stralloc("");
g_hash_table_foreach(proplist, xml_property, &xml_app);
+
+ client_name = pp_script_get_client_name(pp_script);
+ if (client_name && strlen(client_name) > 0 &&
+ am_has_feature(their_features, fe_script_client_name)) {
+ char *b64client_name = amxml_format_tag("client_name",
+ client_name);
+ vstrextend(&xml_app.result, " ", b64client_name, "\n", NULL);
+ }
+
xml_scr = vstrextend(&xml_scr, xml_scr1, xml_app.result, " </script>\n", NULL);
amfree(b64plugin);
amfree(xml_app.result);
dp->todo = 1;
match_a_disk = 1;
prev_match = 0;
- } else { /* dp->todo == 0 */
+ } else if (dp->todo == 0) {
match_a_disk = 1;
prev_match = 0;
dp_skip = dp;
+ } else { /* dp->todo == 1 */
+ match_a_disk = 1;
+ prev_match = 0;
}
}
}