joewalker/prosody-modules

[mod_register_json] crashes due to code bug

GoogleCodeExporter opened this issue · 0 comments

What steps will reproduce the problem?
1. Try to register using invalid base64

What is the expected output? 
Should give an error

What do you see instead?
Gives me 400 error with bad response

Server logs show this

Jul 11 02:41:15 general warn    Attempt to read a non-existent global 'user'
stack traceback:
    ...od_register_json/register_json/mod_register_json.lua:100: in function '?'
    /usr/lib/prosody/util/events.lua:67: in function 'fire_event'
    /usr/lib/prosody/net/http/server.lua:217: in function </usr/lib/prosody/net/http/server.lua:160>
    (tail call): ?
    [C]: in function 'xpcall'
    /usr/lib/prosody/net/http/server.lua:108: in function 'process_next'
    /usr/lib/prosody/net/http/server.lua:124: in function 'success_cb'
    /usr/lib/prosody/net/http/parser.lua:150: in function 'feed'
    /usr/lib/prosody/net/http/server.lua:146: in function </usr/lib/prosody/net/http/server.lua:145>
    (tail call): ?
    /usr/lib/prosody/net/server_select.lua:847: in function </usr/lib/prosody/net/server_select.lua:829>
    [C]: in function 'xpcall'
    /usr/bin/prosody:372: in function 'loop'
    /usr/bin/prosody:402: in main chunk
    [C]: ?


What version of the product are you using? On what operating system?
Latest prosody modules from this repo and prosody 0.9


Please provide any additional information below.

The problem is at line 100:
Module:log("debug", "Data submitted for user registration by %s failed to 
Decode.", user)

There is no user variable, it shouldn't be there at all.

Original issue reported on code.google.com by andysav...@wowwee.com.hk on 11 Jul 2014 at 8:30