Comparison

mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 2814:1ffbd73c54ba

mod_storage_xmlarchive: Add a sanity check to prevent reading from internal storage archives
author Kim Alvefur <zash@zash.se>
date Thu, 09 Nov 2017 13:41:36 +0100
parent 2813:e5ce64aee4ac
child 2815:d48d4d9ccae7
comparison
equal deleted inserted replaced
2813:e5ce64aee4ac 2814:1ffbd73c54ba
267 end 267 end
268 return true; 268 return true;
269 end 269 end
270 270
271 function archive:dates(username) 271 function archive:dates(username)
272 return dm.list_load(username, self.host, self.store); 272 local dates, err = dm.list_load(username, self.host, self.store);
273 if not dates then return dates, err; end
274 assert(type(dates[1]) == "string" and type(dates[#dates]) == "string",
275 "Archive does not appear to be in xmlarchive format");
276 return dates;
273 end 277 end
274 278
275 local provider = {}; 279 local provider = {};
276 function provider:open(store, typ) 280 function provider:open(store, typ)
277 if typ ~= "archive" then return nil, "unsupported-store"; end 281 if typ ~= "archive" then return nil, "unsupported-store"; end