[ejabberd] extauth issue - script aborting due to exception vs. quitting because of shutdown of ejabberd

Jesse Thompson jesse.thompson at doit.wisc.edu
Tue Aug 10 18:27:48 MSD 2010


On 08/09/2010 01:54 PM, David Gregory wrote:
> I’m having an issue where my .py authentication script is shutting down
> due to an exception. I’m using a close variation of this:
>
> http://tkabber.jabber.ru/files/contributions/check_mysql_python.txt
>
> The way this is written, it will abort on any exception. Leaving
> ejabberd with no external authentication. This isn’t very fault tolerant.
>
> In my particular case, the exception is mysql related:
>
> File "/etc/ejabberd/JabberAuth.py", line 135, in ?
>
> op_result = auth(ejab_request[1], ejab_request[2], ejab_request[3])
>
> File "/etc/ejabberd/JabberAuth.py", line 98, in auth
>
> data=db_entry(in_user)
>
> File "/etc/ejabberd/JabberAuth.py", line 84, in db_entry
>
> dbcur.execute("SELECT %s,%s FROM %s WHERE %s
> ='%s'"%(db_username_field,db_password_field , db_table,
> db_username_field, in_user))
>
> File "/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py", line 163,
> in execute
>
> self.errorhandler(self, exc, value)
>
> File "/usr/lib64/python2.4/site-packages/MySQLdb/connections.py", line
> 35, in defaulterrorhandler
>
> raise errorclass, errorvalue
>
> _mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')
>
> This particular exception isn’t anything to do with ejabberd, obviously.
> It’s my problem.
>
> I could, on certain exceptions, keep looping and waiting for input,
> rather than quitting the python script.
>
> However----
>
> If I do that, and I have to restart ejabberd for other reasons, I get
> multiple JabberAuth.py instances running. I don’t want that.
>
> Here’s my question: How does ejabberd tell an extauth script to quit
> gracefully? It seems like, at the moment, it sends “bad input”, which
> causes an exception, which causes the script to quit – This is a guess,
> however. How can I have my script detect the difference between a
> legitimate quit request and an exception?
>
> The protocol listed here:
>
> https://git.process-one.net/ejabberd/mainline/blobs/raw/2.1.x/doc/dev.html#htoc8
>
> doesn’t seem to provide any answers. I’m hoping someone can help me.

I think that you need to exit() if if len(input_length) is not 2

Jesse


>
> Thanks!
>
> -Dave
>
>
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3403 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20100810/4d548bb4/attachment.bin>


More information about the ejabberd mailing list