# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1546511968 -3600
# Node ID 6ae875c98dafd855a07fabf6d296ad8cbae6cbe2
# Parent  4a8fa0364f3535784e19a6a950637260fb672624
mod_atom: Check whether user exists

This is in order to prevent creation of PEP service objects for
non-existant users.

diff -r 4a8fa0364f35 -r 6ae875c98daf mod_atom/mod_atom.lua
--- 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);