account specific external auth problems

Hi,
I'm running ejabberd2.0.2_2 under Windows with external authentication python script and generally it works fine. However, for some specific user accounts (It's undetermined yet what is so special about those accounts) we getting wrong jabber input during isuser command: instead of 2 initial bytes with command length we getting only one byte containing zero.
Here is our python script example:

def ejabberd_in():
    logging.debug("trying to read 2 bytes from ejabberd:")
    try:
        input_length = sys.stdin.read(2)
    except IOError:
        logging.debug("ioerror")
    if len(input_length) is not 2:
        logging.debug("ejabberd sent us wrong things!")
        raise EjabberdInputError('Wrong input from ejabberd!')
    logging.debug('got 2 bytes via stdin')

Basically, it raises 'Wrong input from ejabberd!' exception.
Once again, sorry for repetition, but I think it's important: this problem happened only with limited number of accounts and it persisted to those accounts. Account names are not malformed.

Any ideas or recommendations how to fix the problem are highly appreciated.
Thanks,
-Igor.

Some vague test ideas

dikman wrote:

Any ideas or recommendations how to fix the problem are highly appreciated.

It is impossible to fix the problem if the reason for the problem is unknown.

I don't know what is the reason of the problem. If you want to see what does ejabberd prepare to send, you can apply this patch to ejabberd 2.0.2 file extauth.erl, then compile and overwrite in your installed ejabberd. You can compile in Linux and copy the extauth.beam to your Windows machine. But I don't know if that will help you to find the problem.

--- extauth.erl (revisión: 1672)
+++ extauth.erl (copia de trabajo)
@@ -64,7 +64,9 @@
 loop(Port) ->
     receive
        {call, Caller, Msg} ->
-           Port ! {self(), {command, encode(Msg)}},
+           Encoded = encode(Msg),
+           Port ! {self(), {command, Encoded}},
+            ?INFO_MSG("The message:~n  ~p~nis encoded into:~n  ~p~n", [Msg, Encoded]),
            receive
                {Port, {data, Data}} ->
                    Caller ! {eauth, decode(Data)}

dikman wrote:

I'm running ejabberd2.0.2_2 under Windows with external authentication python script

You can check with a network sniffer (like Wireshark) that ejabberd really sends strange packet.

You can try a different extauth script, like the example Perl script.

More data on that issue - please help!

We are still struggling with this problem. Some more facts we've discovered:
1. Problem happened only with 6-letter user names.
2. problem occurs somewhere between erlang port driver and python script. Our printout in erlang shows perfectly formed 'isuser' request, but python getting exception as described in original post.
3. The problem looks box specific, i.e some boxes have this problem even after re-installation of ejabberd,
other machines are fine.

Please, any ideas or suggestions!
Thanks,
-Igor.

Syndicate content