mod_storage_xmlarchive: Add a sanity check to prevent reading from internal storage archives
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Thu Nov 09 13:34:05 2017 +0100
+++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Thu Nov 09 13:41:36 2017 +0100
@@ -269,7 +269,11 @@
end
function archive:dates(username)
- return dm.list_load(username, self.host, self.store);
+ local dates, err = dm.list_load(username, self.host, self.store);
+ if not dates then return dates, err; end
+ assert(type(dates[1]) == "string" and type(dates[#dates]) == "string",
+ "Archive does not appear to be in xmlarchive format");
+ return dates;
end
local provider = {};