From d87ed8eae12c3e573c328e0e0614510e82cecde0 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 11 Feb 2010 18:44:42 +0000 Subject: mod_privacy: Fix potential traceback in stanza validation, and fix some zero-based indexing :) --- plugins/mod_privacy.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_privacy.lua b/plugins/mod_privacy.lua index df65da7f..4e95e6e4 100644 --- a/plugins/mod_privacy.lua +++ b/plugins/mod_privacy.lua @@ -343,13 +343,14 @@ module:hook("iq/bare/jabber:iq:privacy:query", function(data) end if valid ~= true then - if valid[0] == nil then - valid[0] = "cancel"; - end + valid = valid or { "cancel", "bad-request", "Couldn't understand request" }; if valid[1] == nil then - valid[1] = "bad-request"; + valid[1] = "cancel"; + end + if valid[2] == nil then + valid[2] = "bad-request"; end - origin.send(st.error_reply(stanza, valid[0], valid[1], valid[2])); + origin.send(st.error_reply(stanza, valid[1], valid[2], valid[3])); else datamanager.store(origin.username, origin.host, "privacy", privacy_lists); end -- cgit v1.2.3