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

2006-02-09 Thread Jennifer Abel
 -Original Message-
 From: Tonix [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, January 25, 2006 3:48 AM
 To: vchkpw@inter7.com
 Subject: Re: [vchkpw] MySQL going down results in 5xx error
 
 
  Hello,
 
  I have recently inherited a qmail server. This server is utilizing
  vpopmail version: 5.4.6 and MySQL Ver 4.0.25. We are 
 currently suffering
  from the problem mentioned here:
  http://marc.theaimsgroup.com/?l=vchkpwm=108925077224259w=2 and
  
 https://sourceforge.net/tracker/index.php?func=detailaid=1043
549group_
 id=85937atid=577798. The problem is that a 550 is being returned if
the
 database is inaccessible. I have modified the my.cnf so that this
rarely
 happens now. However I do not want to send a 550 when the database is
 unavailable. I see in many posts that there is a fix. I have looked
 through the changelogs for each of the releases and have not seen
 anything that says that it fixes this issue specifically. Can someone
 let me know if this issue has been resolved, and if so, in which very
 was it fixed.

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.

Tonino


 Thank You!
 Jenn



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 La tua posta elettronica senza virus su UfficioPostale.IT
   Your virus free electronic mail on UfficioPostale.IT


Tonino,

Thank you, but I couldn't find anything on the system to make me think
that it is using chkuser.

Its using qpsmtpd which uses plugin check_delivery.
Check_delivery calls a script called vpopmail_user_check.pl which
performs vuserinfo -d $address 21. This returns an error because it
cannot talk to the database. I'm walking through all of the code now to
see if I can work with or change the return codes.

I'm sorry if I sound clueless, but I'm still trying to figure this
system out.

Thanks again for the quick reply! Looks like it helped others too.


Jenn


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

2006-02-09 Thread Ed McLain
Does vuserinfo return a different exit code on database failure?  If so
then you can catch this in your vpopmail_user_check.pl and thus exit
back a different code or whatever to check_delivery.  In check_delivery
you can catch that and return a DENY_SOFT instead of DENY.  This will
issue a 4xx code back to the smtp sender and thus cause then to resend
the message, that is unless it is Groupwise or a number of other broken
smtp servers which take 4xx messages as fatal.


On Thu, 2006-02-09 at 16:33 -0500, Jennifer Abel wrote:
  -Original Message-
  From: Tonix [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, January 25, 2006 3:48 AM
  To: vchkpw@inter7.com
  Subject: Re: [vchkpw] MySQL going down results in 5xx error
  
  
   Hello,
  
   I have recently inherited a qmail server. This server is utilizing
   vpopmail version: 5.4.6 and MySQL Ver 4.0.25. We are 
  currently suffering
   from the problem mentioned here:
   http://marc.theaimsgroup.com/?l=vchkpwm=108925077224259w=2 and
   
  https://sourceforge.net/tracker/index.php?func=detailaid=1043
 549group_
  id=85937atid=577798. The problem is that a 550 is being returned if
 the
  database is inaccessible. I have modified the my.cnf so that this
 rarely
  happens now. However I do not want to send a 550 when the database is
  unavailable. I see in many posts that there is a fix. I have looked
  through the changelogs for each of the releases and have not seen
  anything that says that it fixes this issue specifically. Can someone
  let me know if this issue has been resolved, and if so, in which very
  was it fixed.
 
 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.
 
 Tonino
 
 
  Thank You!
  Jenn
 
 
 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  La tua posta elettronica senza virus su UfficioPostale.IT
Your virus free electronic mail on UfficioPostale.IT
 
 
 Tonino,
 
 Thank you, but I couldn't find anything on the system to make me think
 that it is using chkuser.
 
 Its using qpsmtpd which uses plugin check_delivery.
 Check_delivery calls a script called vpopmail_user_check.pl which
 performs vuserinfo -d $address 21. This returns an error because it
 cannot talk to the database. I'm walking through all of the code now to
 see if I can work with or change the return codes.
 
 I'm sorry if I sound clueless, but I'm still trying to figure this
 system out.
 
 Thanks again for the quick reply! Looks like it helped others too.
 
 
 Jenn
-- 
Thanks,
Ed McLain



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

2006-01-29 Thread Rick Widmer

Joshua Megerman wrote:

Yes, here are changes. I've already tried them and it works. Just

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...


That and a number of other changes that unify the database back-ends are
already in 5.5.  It just needs some testing on various platforms before
it can be released.





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

2006-01-28 Thread tonix (Antonio Nati)


At 21.30 27/01/2006, you wrote:
 #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...
Yes, you are right. Actually it would not give fake results, but it will
perform useless checks.
Code becomes: 

#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; 


break; 


} 


}; 
#endif 
Thanks,
Tonino
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-28 Thread tonix (Antonio Nati)

At 20.18 27/01/2006, you wrote:

 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.


Yes, sorry, the correct name is vauth_open_read with replica enabled 
and read access.

Just a memory problem (age starts to work :-) ).


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...


That is what I was expecting for a while (as told here a lot of time 
ago), but probably priorities of development have been others (I do 
not blame them of course).


But, as different DB have different kind of calls (vauth_open would 
only work for read operation on one, while it would work for all the 
operations on the other) It could be enough simply adding a common 
#define for the routine opening the database (in read mode or the 
best equivalent mode).


So chkuser will simply call that define (better, will call that 
#define if that #define exists), simplifying any further operation.



snip

 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...


No, authdaemon seems to be simply opening a connection when starting 
and then trying the same connection for all future operations. So, 
after MySQL has been stopped, that connection cannot work anymore.


Tonino



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]




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...

snip

 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 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-25 Thread Tonix
 Hello,

 I have recently inherited a qmail server. This server is utilizing
 vpopmail version: 5.4.6 and MySQL Ver 4.0.25. We are currently suffering
 from the problem mentioned here:
 http://marc.theaimsgroup.com/?l=vchkpwm=108925077224259w=2 and
 https://sourceforge.net/tracker/index.php?func=detailaid=1043549group_
 id=85937atid=577798. The problem is that a 550 is being returned if the
 database is inaccessible. I have modified the my.cnf so that this rarely
 happens now. However I do not want to send a 550 when the database is
 unavailable. I see in many posts that there is a fix. I have looked
 through the changelogs for each of the releases and have not seen
 anything that says that it fixes this issue specifically. Can someone
 let me know if this issue has been resolved, and if so, in which very
 was it fixed.

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.

Tonino


 Thank You!
 Jenn



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 La tua posta elettronica senza virus su UfficioPostale.IT
   Your virus free electronic mail on UfficioPostale.IT




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

2006-01-25 Thread Joshua Megerman
 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?

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]