Re: [vchkpw] MySQL going down results in 5xx error

2006-01-27 Thread Joshua Megerman
> #if defined CHKUSER_ENABLE_VAUTH_OPEN
>  if (db_already_open != 1) {
>  if (CHKUSER_VAUTH_OPEN_CALL () == 0) {
>  db_already_open == 1;
>  } else {
>  retstat = CHKUSER_ERR_AUTH_RESOURCE;
>  }
>  };
> #endif
Minor Bug: you nead a "break;" on the line after "retstat = ...",
otherwise you keep testing on a failed resource...

Josh
-- 
Joshua Megerman
SJGames MIB #5273 - OGRE AI Testing Division
You can't win; You can't break even; You can't even quit the game.
  - Layman's translation of the Laws of Thermodynamics
[EMAIL PROTECTED]




Re: [vchkpw] MySQL going down results in 5xx error

2006-01-27 Thread Joshua Megerman
> Yes, here are changes. I've already tried them and it works. Just
studying the name of calls it may be adapted to Postgres also (it should
be enough to use vauth_open() ).
>
> In chkuser_settings.h enable
> #define CHKUSER_ENABLE_VAUTH_OPEN
> and add one of the following lines:
> /* use this if you are using replicated MySQL, with read access */
#define CHKUSER_VAUTH_OPEN_CALL vauth_open
> or
> /* use this if you are using standalone MySQL, with readwrite access */
#define CHKUSER_VAUTH_OPEN_CALL vauth_open_update
>
FYI - with MySQL it's vauth_open_read not vauth_open.  I'm thinking of
submitting a patch to vpopmail to unify the call, so that it can be
published globally.  It would be nice if vauth_open would work no matter
what the backend auth mechanism...



> Another comment on side effects of restarting MySQL.
> Courier auth daemon must be restarted, because it does not try to reopen
any MySQL connection.
>
> It would be nice to have a simple perl script monitoring MySQL (an
attach every x minutes), and in case of problem:
>  - running a script for shutting down Courier and other mail
> services
>  - stopping/restarting MySQL
>  - running a script for restarting all mail services
>
Does authdaemon die if it loses its connection to MySQL?  If so why not
just run it under daemontools.  If not, perhaps it should...

I haven't looked at authdaemon/courier-imap v4 lately, but I dislike the
mechanism somewhat because there's no way to get the TCPREMOTEIP info from
the imap daemon to vpopmail, which I use to determine if I even need to
update the relay table (I don't if it's in my permanently allowed subnet,
or from my local webmail server...) which saves time on heavily loaded
servers...

Josh
-- 
Joshua Megerman
SJGames MIB #5273 - OGRE AI Testing Division
You can't win; You can't break even; You can't even quit the game.
  - Layman's translation of the Laws of Thermodynamics
[EMAIL PROTECTED]




Re: [vchkpw] MySQL going down results in 5xx error

2006-01-27 Thread tonix (Antonio Nati)


At 15.15 25/01/2006, you wrote:
> If you are using chkuser,
there is a small change you can do (I'm going to
> publish nextly this change with next version of chkuser).
>
> If you are interested I'll anticipate this small change so it may
help
> people to handle this error.
>
Can you post the change here so that those of us who want to look at
it
and test it can?

Yes, here are changes. I've already tried them and it works. Just
studying the name of calls it may be adapted to Postgres also (it should
be enough to use vauth_open() ).
In chkuser_settings.h enable

#define CHKUSER_ENABLE_VAUTH_OPEN 
and add one of the following lines:

/* use this if you are using replicated MySQL, with read access */
#define CHKUSER_VAUTH_OPEN_CALL vauth_open
or

/* use this if you are using standalone MySQL, with readwrite access
*/
#define CHKUSER_VAUTH_OPEN_CALL vauth_open_update
In chkuser.c, just substitute the following lines:

#if defined CHKUSER_ENABLE_VAUTH_OPEN

   
if (db_already_open != 1) {

   
if (vauth_open () == 0) {

   
db_already_open == 1;

   
} else {

   
retstat = CHKUSER_ERR_AUTH_RESOURCE;

   
}

   
};
#endif
with:

#if defined CHKUSER_ENABLE_VAUTH_OPEN 

   
if (db_already_open != 1) { 

   
if (CHKUSER_VAUTH_OPEN_CALL () == 0) { 

   
db_already_open == 1; 

   
} else { 

   
retstat = CHKUSER_ERR_AUTH_RESOURCE; 

   
} 

   
}; 
#endif 
Any input/comment is welcome.
Another comment on side effects of restarting MySQL.
Courier auth daemon must be restarted, because it does not try to reopen
any MySQL connection.
It would be nice to have a simple perl script monitoring MySQL (an attach
every x minutes), and in case of problem:
- running
a script for shutting down Courier and other mail services
-
stopping/restarting MySQL
- running
a script for restarting all mail services
Tonino
Thanks,
Josh
-- 
Joshua Megerman
SJGames MIB #5273 - OGRE AI Testing Division
You can't win; You can't break even; You can't even quit the game.
  - Layman's translation of the Laws of Thermodynamics
[EMAIL PROTECTED]