I am using ejabberd in one of my project, which is itself implemented in erlang. I am interested in gaining access to the authentication flow, so that i can integrate my user db without having to register them separately in ejabberd.
I have got most of the things right as described here: https://git.process-one.net/ejabberd/mainline/blobs/raw/2.1.x/doc/dev.html#htoc8
However, seemingly ejabberd never receive response from my escript. Below is a part of the code responsible for sending resopnse:
process_data(["auth", _User, _Server, _Pass]) ->
BB = <<1:16>>, %% result code 1 coded as short
AA = byte_size(BB), %% AA is byte length of result
Bin = <<AA:16,BB/binary>>, %% finally packing AA as short along with BB
io:put_chars(Bin);
From my logs i end up sending:
=DEBUG== 2011-05-25 21:05:15 == <0.2.0> == extauth:53 ===
sent <<0,2,0,1>>
which is exactly similar to what i used to do inside PHP:
fwrite($out, pack("nn", 2, $result_code));
I m not sure where i m messing up.
Also i am interested if there is a better way to integrate my user db, since my app is itself in erlang and i would probably like to take advantage of erlang message passing instead of reading/writing stdin/stdout inside extauth