X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Fdiskfile.c;h=b25b749af1a7705d0d5f445a26169e2189dd2ef6;hb=c6f0a88c567f8536c498f554285aed1f8150da18;hp=71e2ef55cb7a54a656e949288e5a44dd2883fe43;hpb=cd0b924f27312d57bd42f6c4fae2b795139e2d0b;p=debian%2Famanda
diff --git a/server-src/diskfile.c b/server-src/diskfile.c
index 71e2ef5..b25b749 100644
--- a/server-src/diskfile.c
+++ b/server-src/diskfile.c
@@ -341,6 +341,7 @@ free_disklist(
while (dl->head != NULL) {
dp = dequeue_disk(dl);
+ amfree(dp->filename);
amfree(dp->name);
amfree(dp->hostname);
amfree(dp->device);
@@ -423,6 +424,28 @@ parse_diskline(
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);
@@ -540,6 +563,7 @@ parse_diskline(
}
if (!disk) {
disk = alloc(SIZEOF(disk_t));
+ disk->filename = g_strdup(filename);
disk->line = line_num;
disk->hostname = hostname;
disk->name = diskname;
@@ -1227,7 +1251,45 @@ optionstr(
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, " \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, " yes\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 \n");
+
+ g_free(xml_app->result);
+ xml_app->result = g_string_free(strbuf, FALSE);
+}
+
char *
xml_optionstr(
disk_t * dp,
@@ -1483,6 +1545,21 @@ xml_optionstr(
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,
@@ -1521,10 +1598,13 @@ xml_estimate(
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;
@@ -1544,45 +1624,39 @@ clean_dle_str_for_client(
#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, " \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, " yes\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 "\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, "");
+ pscript = strstr(rval_dle_str, "