Issue Details (XML | Word | Printable)

Key: EJAB-627
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Low Low
Assignee: Badlop
Reporter: Badlop
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ejabberd development

Extauth responses: log strange responses and add timeout

Created: 13/May/08 08:31 PM   Updated: 06/Nov/08 04:37 PM
Component/s: Authentification
Affects Version/s: None
Fix Version/s: ejabberd 2.1.0

Time Tracking:
Not Specified

Participants: Badlop and Yellowdog
Company: process-one.net (Find related issues)
Labels:
Days since last comment: 3 weeks, 6 days ago


 Description  « Hide
When ejabberd is waiting to receive responses from extauth script, it should:
  • If receives an unknown response from the extauth script, show error in log file
  • If doesn't receive a response in X seconds, show error in log file
  • The timeout for extauth could be at least 30 seconds.

This would allow the admin to be informed of a problematic extauth script.

Suggested by Yellowdog in the ejabberd chatroom.

I wrote this simple patch:

--- a/src/extauth.erl
+++ b/src/extauth.erl
@@ -67,7 +67,13 @@ loop(Port) ->
            Port ! {self(), {command, encode(Msg)}},
            receive
                {Port, {data, Data}} ->
-                   Caller ! {eauth, decode(Data)}
+                   ?DEBUG("extauth call '~p' received data response:~n~p", [Msg, Data]),
+                   Caller ! {eauth, decode(Data)};
+               {Port, Other} ->
+                   ?ERROR_MSG("extauth call '~p' received strange response:~n~p", [Msg, Other])
+           after
+               10000 -> %% Timeout is in milliseconds: 10 seconds == 10000
+                   ?ERROR_MSG("extauth call '~p' didn't receive response~n", [Msg])
            end,
            loop(Port);
        stop ->


 All   Comments   Work Log   Change History   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Badlop added a comment - 17/May/08 01:45 PM
Patch applied in ejabberd trunk SVN r1330. The timeout is 30 seconds.

Yellowdog added a comment - 04/Nov/08 06:19 PM
Here's the version of extauth.erl that we're using, maybe it is something that could become part of the main source:
http://pastebin.com/f27d4d74b

The differences are:

  • We've specified a different Initialization timeout to call timeout, because our external auth script loads information from a database.
  • We return unauthorized when a 'strange' response is received or the call times out. This is actually important, otherwise the client never gets an authorization response.

Badlop added a comment - 06/Nov/08 04:37 PM
Yellowdog's patch is committed in ejabberd trunk SVN r1673.