changeset 3424:6ae875c98daf

mod_atom: Check whether user exists This is in order to prevent creation of PEP service objects for non-existant users.
author Kim Alvefur <zash@zash.se>
date Thu, 03 Jan 2019 11:39:28 +0100
parents 4a8fa0364f35
children 461429e0db58
files mod_atom/mod_atom.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_atom/mod_atom.lua	Thu Jan 03 11:36:01 2019 +0100
+++ b/mod_atom/mod_atom.lua	Thu Jan 03 11:39:28 2019 +0100
@@ -3,6 +3,7 @@
 
 local mod_pep = module:depends"pep";
 
+local um = require "core.usermanager";
 local nodeprep = require "util.encodings".stringprep.nodeprep;
 local st = require "util.stanza";
 
@@ -15,6 +16,9 @@
 
 			user = nodeprep(user);
 			if not user then return 400; end
+			if not um.user_exists(user, module.host) then
+				return 404;
+			end
 
 			local pubsub_service = mod_pep.get_pep_service(user);
 			local ok, items = pubsub_service:get_items("urn:xmpp:microblog:0", actor);