Mercurial > prosody-modules
comparison mod_tcpproxy/mod_tcpproxy.lua @ 153:31e24026e4fd
mod_tcpproxy: Handle gracefully invalid base64 data, fixes #2 (thanks dersd)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 19 May 2010 14:02:19 +0100 |
| parents | 4db80a46b064 |
| children | 07c1c3eaf0c4 |
comparison
equal
deleted
inserted
replaced
| 152:4ca382e8a4c5 | 153:31e24026e4fd |
|---|---|
| 82 conn = server.wrapclient(conn, to_host, to_port, listener, "*a" ); | 82 conn = server.wrapclient(conn, to_host, to_port, listener, "*a" ); |
| 83 new_session(jid, sid, conn); | 83 new_session(jid, sid, conn); |
| 84 elseif ibb_tag.name == "data" then | 84 elseif ibb_tag.name == "data" then |
| 85 local conn = open_connections[stanza.attr.from][ibb_tag.attr.sid]; | 85 local conn = open_connections[stanza.attr.from][ibb_tag.attr.sid]; |
| 86 if conn then | 86 if conn then |
| 87 conn:write(unb64(ibb_tag:get_text())); | 87 local data = unb64(ibb_tag:get_text()); |
| 88 if data then | |
| 89 conn:write(data); | |
| 90 else | |
| 91 return origin.send( | |
| 92 st.error_reply(stanza, "modify", "bad-request", "Invalid data (base64?)") | |
| 93 ); | |
| 94 end | |
| 88 else | 95 else |
| 89 return origin.send(st.error_reply(stanza, "cancel", "item-not-found")); | 96 return origin.send(st.error_reply(stanza, "cancel", "item-not-found")); |
| 90 end | 97 end |
| 91 elseif ibb_tag.name == "close" then | 98 elseif ibb_tag.name == "close" then |
| 92 if close_session(stanza.attr.from, ibb_tag.attr.sid) then | 99 if close_session(stanza.attr.from, ibb_tag.attr.sid) then |
