diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-02-11 18:44:42 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-02-11 18:44:42 +0000 |
commit | d87ed8eae12c3e573c328e0e0614510e82cecde0 (patch) | |
tree | d29d63934f488b98870851286cd3fc3bb580d67c /plugins | |
parent | 70b942fd9db49a93af4e520beaec55c704a5f5e9 (diff) | |
download | prosody-d87ed8eae12c3e573c328e0e0614510e82cecde0.tar.gz prosody-d87ed8eae12c3e573c328e0e0614510e82cecde0.zip |
mod_privacy: Fix potential traceback in stanza validation, and fix some zero-based indexing :)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_privacy.lua | 11 |
1 files changed, 6 insertions, 5 deletions
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 |