summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/exchange/taler-exchange-httpd_terms.c34
-rw-r--r--src/exchange/taler-exchange-httpd_terms.h9
2 files changed, 41 insertions, 2 deletions
diff --git a/src/exchange/taler-exchange-httpd_terms.c b/src/exchange/taler-exchange-httpd_terms.c
index dadc1588f..8c25e5383 100644
--- a/src/exchange/taler-exchange-httpd_terms.c
+++ b/src/exchange/taler-exchange-httpd_terms.c
@@ -311,6 +311,13 @@ load_terms (const char *path,
const char *mime;
} mm[] = {
{ .ext = "html", .mime = "text/html" },
+ { .ext = "htm", .mime = "text/html" },
+ { .ext = "txt", .mime = "text/plain" },
+ { .ext = "pdf", .mime = "application/pdf" },
+ { .ext = "jpg", .mime = "image/jpeg" },
+ { .ext = "jpeg", .mime = "image/jpeg" },
+ { .ext = "png", .mime = "image/png" },
+ { .ext = "gif", .mime = "image/gif" },
{ .ext = NULL, .mime = NULL }
};
const char *ext = strrchr (name, '.');
@@ -325,6 +332,18 @@ load_terms (const char *path,
lang);
return;
}
+ if (0 != strncmp (terms_etag,
+ name,
+ ext - name - 1))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Filename `%s' does not match Etag `%s' in directory `%s/%s'. Ignoring it.\n",
+ name,
+ terms_etag,
+ path,
+ lang);
+ return;
+ }
mime = NULL;
for (unsigned int i = 0; NULL != mm[i].ext; i++)
if (0 == strcasecmp (mm[i].ext,
@@ -477,14 +496,25 @@ TEH_load_terms (const struct GNUNET_CONFIGURATION_Handle *cfg)
DIR *d;
if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "exchange",
+ "TERMS_ETAG",
+ &terms_etag))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+ "exchange",
+ "TERMS_ETAG");
+ return;
+ }
+ if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg,
"exchange",
- "terms",
+ "TERMS_DIR",
&path))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
"exchange",
- "TERMS");
+ "TERMS_DIR");
return;
}
diff --git a/src/exchange/taler-exchange-httpd_terms.h b/src/exchange/taler-exchange-httpd_terms.h
index 1cfd8239f..18a42809d 100644
--- a/src/exchange/taler-exchange-httpd_terms.h
+++ b/src/exchange/taler-exchange-httpd_terms.h
@@ -46,4 +46,13 @@ TEH_handler_terms (struct TEH_RequestHandler *rh,
const char *upload_data,
size_t *upload_data_size);
+/**
+ * Load our terms of service as per configuration.
+ *
+ * @param cfg configuration to process
+ */
+void
+TEH_load_terms (const struct GNUNET_CONFIGURATION_Handle *cfg);
+
+
#endif