Re: [vchkpw] Vpopmail 5.4.5 released

2004-06-29 Thread François Wautier
Hi,

 I see. You said, in your previous message:
 The code in vpopmail was first trying to connect to the server for a given
 database. If that was failing, it would try the server only and if that
 succeeded, it was considering that the server was fine but that the DB was
 not created.

 So, wouldnt it be safer to consider the second try, if it succeeds? Sorry,
 I dont understand why consider that the database was not created only
 because it took 2 tries to connect to the database.

The way the program before patch was working was

if(openDB( Host, Database) != OK) {
if(openDB(Host) == OK) {
create database
}
}

After the patch it is

if(openDB(Host) != OK) {
return Can not connect
}

if(useDB(Database) != OK) {
create database
}

A trivial patch really.

In the pre-patch case, if the first openDB fails, it could be because the DB 
is not available...And it goes downhill from there

Best Regards,
François


Re: [vchkpw] Vpopmail 5.4.5 released

2004-06-28 Thread François Wautier
Hi,

Since I submitted that patch.. I guess I should answer.

The code in vpopmail was first trying to connect to the server for a given 
database. If that was failing, it would try the server only and if that 
succeeded, it was considering that the server was fine but that the DB was 
not created.

Apparently, under some load, it could happen that the first request would 
fail, but the second would be accepted... 

All the patch does is make the code connect to the server first and then use 
the Database. If the first call fails, the delivery fails (temporary failure) 
and the message is delivered later.

Cheers,
François


 On Fri, 25 Jun 2004 18:17:53 -0700

 Tom Collins [EMAIL PROTECTED] wrote:
  http://vpopmail.sf.net
 
  Release Notes:
 
  There are significant changes in here for MySQL and Postgres backends.
 
  If you've had errors stating couldn't create table/database because it
  already exists with MySQL, you should definitely upgrade.

 Well, I was having such errors with 5.4.3, and I did upgrade. It seems to
 be working fine, now. I noticed that this error occured only with the
 server under heavy load (over 8, 10). Since it is fixed now in 5.4.5, I
 have a question out of curiosity: What was the bug that was causing this
 error?

 Thanks,

 Jean


Re: [vchkpw] Vpopmail 5.4.5 released

2004-06-28 Thread François Wautier
Hi,

The patch applies does not solve the underlying problem, the fact that you 
cannot connect to the DB server. It just makes sure the system behaves 
properly even when one cannot access the DB.

In the case of email delivery, proper behaviour means that the message is put 
back into the queue for later delivery.  

In other cases, proper behaviour may means that the system complains it does 
not know your user. I do not know.

Now that I think about it, that could be the problem I am having. When using 
IMP-Courier imap-vpopmail  some of my users need to login many times. It 
could be that, because of the problem, authentication fails and they have to 
loggin again.

Best Regards,
François




l
 On Mon, 28 Jun 2004 21:54:55 +0700

 François Wautier [EMAIL PROTECTED] wrote:
  Hi,
 
  Since I submitted that patch.. I guess I should answer.
 
  The code in vpopmail was first trying to connect to the server for a
  given database. If that was failing, it would try the server only and if
  that succeeded, it was considering that the server was fine but that the
  DB was not created.
 
  Apparently, under some load, it could happen that the first request would
  fail, but the second would be accepted...
 
  All the patch does is make the code connect to the server first and then
  use the Database. If the first call fails, the delivery fails (temporary
  failure) and the message is delivered later.
 
  Cheers,
  François

 Thanks for the explanation, François :)

 I was having this problem, not only when delivering messages, but specially
 when checking POP3 mail (vchkpw). Will that be fixed too? Or am I going to
 get a different error? Also, using Antonio Nati's qmail-smtpd-chkusr patch
 (as in http://www.interazioni.it/qmail/qmail-smtpd-chkusr-10.html), what
 will be the effect with the new corrected mysql patch? I was getting some
 no such user errors before...

 thanks!

 Jean


Re: [vchkpw] Strange Error

2004-06-07 Thread François Wautier
Rick,

 François Wautier wrote:
  Hi,
 
  Duly noting the near absolute lack of interest in my previous email (Only
  Devendra Singh  responded indicating he had the same problem),  I decided
  to go and figure out things my way.

 Good job.  I use CDB, and don't know enough about using MySQL with
 vpopmail to find something like that.  Unless someone objects I plan to
 put this in HEAD, and suggest it go into the stable branch too.

 I like the fact that this patch separates hard errors from soft errors,
 checking first if it can open the database connection at all and
 aborting on failure.  It works well with the changes in error handling
 that I am working on.


I thought it made sense too.

 I wish I understood the base problem better, I don't know if we are just
 covering up a database problem.  

Could be... but is unlikely.

 You are sure you aren't running out of 
 MySQL children at peak loads, right?  Being on the border of having too
 many requests for the number of MySQL children allowed could cause what
 you are seeing.


I don't really have any load to speak of. And if the problem was that, I think 
the client would not connect, not report Lost connection to MySQL server 
during query. 

I would also get more complains from the websites not being able to get the 
data.

In any case, my simplistic patch  does handle that type of problem better.

Cheers,
François

 Even if that turns out to be your real problem I think this is a better
 way to handle opening the database.  I have posted the patch on
 SourceFORGE.  [967994]

 Rick


Re: [vchkpw] Strange Error

2004-06-06 Thread François Wautier
Hi,

Duly noting the near absolute lack of interest in my previous email (Only 
Devendra Singh  responded indicating he had the same problem),  I decided to 
go and figure out things my way.

At first, I wrote a small script that would look for the Delivered-To line 
emails found in the catch-all account and would redirect them 
appropriately.

But that was too much of a hack, so I did look at the problem itself.

And now, the end is near and so I face the final problem. My Friends, I'll say 
it clear, I'll state my case, I'm almost certain. I've looked the source in 
full, I've followed each and every pathway. But more, I found the bug and 
killed it my way.

In vmysql.c, the function vauth_open_update works like this

If (NOT OK(Connect to given Host/Database) {
   If( OK (Connect to given Host)
Create the Database;
} else Complain
   } else Use it.

The initial test is done using the 
mysql_real_connect function

When given both a Host and a Database (+ user name, password and so on) It 
sometimes fails. The reason stated being Lost connection to MySQL server 
during query. The subsequent connect, without a DB name, succeeding, the 
system tries to create the (already existing) database... and it's all 
downhill from there.

The change I made was to to change the logic to

If(Not OK(Connect to given host)
Complain and return

If(Not OK (Select given Database)
Created it and select it

Use it.


And, in my case at leat, it solved the problem.

I do not know why the problem occurred with the apparently correct original 
code, all I can say is that I now longer have the problem I described before.

I attache a patch in case someone is foolhardy enough to try it.


Cheers,
François

 Hi,

 I am new to this list.

 I recently installed on a Gentoo linux

   qmail  1.03 (r13)
   vpopmail 5.4.0
   maildrop 1.5.3
   qmail-scanner 1.16  ( With some modifs)


 Everything was working well until today.

 Today, I took my local domain and made it a virtual domain on my hosts.

 Things are mostly working, but every now and then I get the following error
 message

 @400040b3436602b4f094 delivery 2035: success:
 vmysql:_sql_error[1]:_Can't_create_database_'vpopmail'._Database_exists/vmy
sql:_sql_error[3]:
 _No_Database_Selected/could_not_create_limits_table_CREATE_TABLE_limits_(_d
  The whole SQL query..
 _No_Database_Selected/user_does_not_exist,but_will_deliver_to_/var/vpopmail
/domains/mydomain/mycatchall/


 Because I have a catchall account, the emails get delivered there instead
 of the correct mailbox. I can see that the Delivered-To header is set to
 the correct user.   I can't seem to find a pattern in the occurrence of the
 problem  The only thing is that I get the feeling it is related to the use
 of aliases  ( .qmaol-myalias)  but I am not sure.

 Has anyone experienced the same problem? Has anyone found a solution?

 Thanks
   François Wautier
diff -ru vpopmail-5.4.0/vmysql.c vpopmail-5.4.0-fw1/vmysql.c
--- vpopmail-5.4.0/vmysql.c	2004-01-14 06:56:41.0 +0700
+++ vpopmail-5.4.0-fw1/vmysql.c	2004-06-06 16:10:54.848660760 +0700
@@ -203,41 +203,36 @@
 mysql_init(mysql_update);
 mysql_options(mysql_update, MYSQL_OPT_CONNECT_TIMEOUT, (char *)timeout);
 
-/* Try to connect to the mysql update server with the specified database. */
+/* Try to connect to the mysql update server */
 if (!(mysql_real_connect(mysql_update, MYSQL_UPDATE_SERVER,
-MYSQL_UPDATE_USER, MYSQL_UPDATE_PASSWD,
-MYSQL_UPDATE_DATABASE, MYSQL_UPDATE_PORT, NULL, 0))) {
-
-/* Could not connect to the update mysql server with the database
- * so try to connect with no database specified
- */
-if (!(mysql_real_connect(mysql_update, MYSQL_UPDATE_SERVER,
-MYSQL_UPDATE_USER, MYSQL_UPDATE_PASSWD, NULL, MYSQL_UPDATE_PORT,
-NULL, 0))) {
-
-/* if we can not connect, report a error and return */
-verrori = VA_NO_AUTH_CONNECTION;
-return(VA_NO_AUTH_CONNECTION);
-}
-
-/* we were able to connect, so create the database */ 
-snprintf( SqlBufUpdate, SQL_BUF_SIZE, 
-create database %s, MYSQL_UPDATE_DATABASE );
-if (mysql_query(mysql_update,SqlBufUpdate)) {
-
-/* we could not create the database
- * so report the error and return 
- */
-fprintf(stderr, vmysql: sql error[1]: %s\n, mysql_error(mysql_update));
-return(-1);
-} 
-
-/* set the database */ 
-if (mysql_select_db(mysql_update, MYSQL_UPDATE_DATABASE)) {
-fprintf(stderr, could not enter %s database\n, MYSQL_UPDATE_DATABASE);
-return(-1);
-}
+			 MYSQL_UPDATE_USER, MYSQL_UPDATE_PASSWD, NULL

[vchkpw] Strange Error

2004-05-25 Thread François Wautier

Hi,

I am new to this list.

I recently installed on a Gentoo linux

qmail  1.03 (r13)
vpopmail 5.4.0
maildrop 1.5.3
qmail-scanner 1.16  ( With some modifs)


Everything was working well until today.  

Today, I took my local domain and made it a virtual domain on my hosts.

Things are mostly working, but every now and then I get the following error 
message

@400040b3436602b4f094 delivery 2035: success: 
vmysql:_sql_error[1]:_Can't_create_database_'vpopmail'._Database_exists/vmysql:_sql_error[3]:
_No_Database_Selected/could_not_create_limits_table_CREATE_TABLE_limits_(_d
 The whole SQL query..
_No_Database_Selected/user_does_not_exist,but_will_deliver_to_/var/vpopmail/domains/mydomain/mycatchall/


Because I have a catchall account, the emails get delivered there instead of 
the correct mailbox. I can see that the Delivered-To header is set to the 
correct user.   I can't seem to find a pattern in the occurrence of the 
problem  The only thing is that I get the feeling it is related to the use of 
aliases  ( .qmaol-myalias)  but I am not sure.

Has anyone experienced the same problem? Has anyone found a solution?

Thanks
François Wautier