Changeset

2589:39f5a068dc41

mod_privacy: Fix potential traceback in stanza validation, and fix some zero-based indexing :)
author Matthew Wild <mwild1@gmail.com>
date Thu, 11 Feb 2010 18:44:42 +0000
parents 2588:741302471a23
children 2590:2d7e2a28d1d5
files plugins/mod_privacy.lua
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_privacy.lua	Thu Feb 11 12:10:06 2010 +0000
+++ b/plugins/mod_privacy.lua	Thu Feb 11 18:44:42 2010 +0000
@@ -343,13 +343,14 @@
 		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
-			origin.send(st.error_reply(stanza, valid[0], valid[1], valid[2]));
+			if valid[2] == nil then
+				valid[2] = "bad-request";
+			end
+			origin.send(st.error_reply(stanza, valid[1], valid[2], valid[3]));
 		else
 			datamanager.store(origin.username, origin.host, "privacy", privacy_lists);
 		end