[ejabberd] extauth - does the script need to run continuously?

Myers Carpenter mcarpenter at rosettastone.com
Wed Jul 29 18:02:43 MSD 2009

On Jul 28, 2009, at 5:36 PM, Belorion wrote:

> I've been playing around w/ extauth for authenticating users against  
> a different datasource - namely via a C# exe that authenticates  
> against a SQL Server database.
> One thing I noticed - only the first user to authenticate against  
> the system worked.  All subsequent attempts failed.  It *appeared*  
> to be caused by the fact that the authenticating executable was  
> terminating after the first authentication.

Yes, it need to keep running in a loop.

> This seemed to "fix" the problem of only authenticating once - but  
> is that the right thing to do?  This seems like it could potentially  
> break if it recieved 2 auth requests super-close together (as in,  
> before the first one was processed).

No, because the second request would just sit in the STDIN buffer  
until your program read from the buffer.

> Also, I noticed that when I execute the "stop ejabberd" shortcut,  
> the server stops, but the authentication executable continues -  
> *plus*, instead of idling happily at 0% CPU while it waits for stdin  
> input, it suddently spikes to use the 100% CPU (or, in my case, 50%,  
> or all of one core) and just continues like that until I kill it  
> manually.
> <ATT00001.txt>

The perl example file does this:

my $nread = sysread STDIN,$buf,2;
do { syslog LOG_INFO,"port closed"; exit; } unless $nread == 2;

which basicly does this

  * read from STDIN
  * if you get back less than 2 bytes, exit

Does your C# code do that?


More information about the ejabberd mailing list