Re: [vchkpw] mysql sourcing read/update server config file

2007-12-06 Thread Hartmut Wernisch
On 05 Dec 07, Tom Collins wrote:
 On Dec 5, 2007, at 2:51 AM, Hartmut Wernisch wrote:
 So now I am wondering why line 197-202 is setting the values to
 MYSQL_READ_SOCKET and MYSQL_READ_PORT instead of MYSQL_UPDATE_SOCKET
 and MYSQL_UPDATE_PORT?
 
 In my opinion these values should be set to MYSQL_UPDATE_SOCKET and
 MYSQL_UPDATE_PORT?
 
 
 You are correct, and that probably fixes an outstanding bug report on  
 SourceForge.  Most people use the same info for read and update, so  
 no one has fixed the problem before.


In the current vpopmail version with mysql support tries to reconnect to
the update server for database queries if an update server was
configured in the vpopmail.mysql.

I have extended vpopmail to do the same with updates to the update
database server. This was realy hard work ;)

vpopmail.mysql is extended by a third server configuration line and also
the parser in vmysql.c is.
It is not a beautiful but a simple patch which works well for me. I have
a fully automated setup where also updates happens to non office times.
Therefor failover for update server queries are good for my sleep ;)

Maybe you are interessed in it for an upcoming release? (Or do a better
solution)

Best,
Hartmut

 
 Rick, another fix for the next release.
 
 --
 Tom Collins  -  [EMAIL PROTECTED]
 Vpopmail - virtual domains for qmail: http://vpopmail.sf.net/
 QmailAdmin - web interface for Vpopmail: http://qmailadmin.sf.net/
 
 
 
 
 


!DSPAM:4758040732004317911302!



[vchkpw] mysql sourcing read/update server config file

2007-12-05 Thread Hartmut Wernisch
Hello,

I have a question regarding sourcing the vpopmail.mysql config file.

The first line reflect the reading  mysql db server.
If there is no second line the same values are taken for the update
mysql db server.
I am talking about vpopmail-5.4.25.


Here is parsing the first line of vpopmail.mysql in the vmysql.c which
is used for the reading database server:



 142 sprintf(config, %s/etc/%s, VPOPMAILDIR, vpopmail.mysql);
 143 
 144 fp = fopen(config, r);
 145 if (fp == NULL) {
 146 fprintf(stderr, vmysql: can't read settings from %s\n, config);
 147 return(VA_NO_AUTH_CONNECTION);
 148 }
 149
 150 /* skip comments and blank lines */
 151 do {
 152 eof = (fgets (conn_info, sizeof(conn_info), fp) == NULL);
 153 } while (!eof  ((*conn_info == '#') || (*conn_info == '\n')));
 154 
 155 if (eof) {
 156 /* no valid data read, return error */
 157 fprintf(stderr, vmysql: no valid settings in %s\n, config);
 158 return(VA_NO_AUTH_CONNECTION);
 159 }
 160 
 161 conf_read = strdup(conn_info);
 162 MYSQL_READ_SERVER = strtok(conf_read, delimiters);
 163 if (MYSQL_READ_SERVER == NULL) return VA_PARSE_ERROR01;
 164 MYSQL_READ_SOCKET = strtok(NULL, delimiters);
 165 if (MYSQL_READ_SOCKET == NULL) return VA_PARSE_ERROR;
 166 
 167 if (MYSQL_READ_SOCKET[0] != '/') {
 168MYSQL_READ_PORT = atoi(MYSQL_READ_SOCKET);
 169MYSQL_READ_SOCKET = NULL;
 170}
 171 
 172 MYSQL_READ_USER = strtok(NULL, delimiters);
 173 if (MYSQL_READ_USER == NULL) return VA_PARSE_ERROR03;
 174 MYSQL_READ_PASSWD = strtok(NULL, delimiters);
 175 if (MYSQL_READ_PASSWD == NULL) return VA_PARSE_ERROR04;
 176 MYSQL_READ_DATABASE = strtok(NULL, delimiters);
 177 if (MYSQL_READ_DATABASE == NULL) return VA_PARSE_ERROR05;



Now reading the second line for the update server information. If there
is no second line use the previous obtained values from the reading
database server, else parse the second line:

 179 /* skip comments and blank lines */
 180 do {
 181 eof = (fgets (conn_info, sizeof(conn_info), fp) == NULL);
 182 } while (!eof  ((*conn_info == '#') || (*conn_info == '\n')));
 183
 184 if (eof) {
 185 /* re-use read-only settings for update */
 186 MYSQL_UPDATE_SERVER = MYSQL_READ_SERVER;
 187 MYSQL_UPDATE_PORT = MYSQL_READ_PORT;
 188 MYSQL_UPDATE_USER = MYSQL_READ_USER;
 189 MYSQL_UPDATE_PASSWD = MYSQL_READ_PASSWD;
 190 MYSQL_UPDATE_DATABASE = MYSQL_READ_DATABASE;
 191 MYSQL_UPDATE_SOCKET = MYSQL_READ_SOCKET;
 192 } else {
 193 conf_update = strdup(conn_info);
 194 MYSQL_UPDATE_SERVER = strtok(conf_update, delimiters);
 195 if (MYSQL_UPDATE_SERVER == NULL) return VA_PARSE_ERROR06;
 196  
 197 MYSQL_READ_SOCKET = strtok(NULL, delimiters);
 198 if (MYSQL_READ_SOCKET == NULL) return VA_PARSE_ERROR;
 199  
 200 if (MYSQL_READ_SOCKET[0] != '/') {
 201 MYSQL_READ_PORT = atoi(MYSQL_READ_SOCKET);
 202 MYSQL_READ_SOCKET = NULL;
 203 }
 204  
 205 MYSQL_UPDATE_USER = strtok(NULL, delimiters);
 206 if (MYSQL_UPDATE_USER == NULL) return VA_PARSE_ERROR08;
 207 MYSQL_UPDATE_PASSWD = strtok(NULL, delimiters);
 208 if (MYSQL_UPDATE_PASSWD == NULL) return VA_PARSE_ERROR09;
 209 MYSQL_UPDATE_DATABASE = strtok(NULL, delimiters);
 210 if (MYSQL_UPDATE_DATABASE == NULL) return VA_PARSE_ERROR10;
 211 }


So now I am wondering why line 197-202 is setting the values to 
MYSQL_READ_SOCKET and MYSQL_READ_PORT instead of MYSQL_UPDATE_SOCKET
and MYSQL_UPDATE_PORT?

In my opinion these values should be set to MYSQL_UPDATE_SOCKET and 
MYSQL_UPDATE_PORT?


Regards,
Hartmut



!DSPAM:475682a432008129516775!



Re: [vchkpw] mysql sourcing read/update server config file

2007-12-05 Thread Tom Collins

On Dec 5, 2007, at 2:51 AM, Hartmut Wernisch wrote:

So now I am wondering why line 197-202 is setting the values to
MYSQL_READ_SOCKET and MYSQL_READ_PORT instead of MYSQL_UPDATE_SOCKET
and MYSQL_UPDATE_PORT?

In my opinion these values should be set to MYSQL_UPDATE_SOCKET and
MYSQL_UPDATE_PORT?



You are correct, and that probably fixes an outstanding bug report on  
SourceForge.  Most people use the same info for read and update, so  
no one has fixed the problem before.


Rick, another fix for the next release.

--
Tom Collins  -  [EMAIL PROTECTED]
Vpopmail - virtual domains for qmail: http://vpopmail.sf.net/
QmailAdmin - web interface for Vpopmail: http://qmailadmin.sf.net/



!DSPAM:4756f8ce32009276917098!



Re: [vchkpw] mysql sourcing read/update server config file

2007-12-05 Thread Rick Widmer



Tom Collins wrote:

On Dec 5, 2007, at 2:51 AM, Hartmut Wernisch wrote:

So now I am wondering why line 197-202 is setting the values to
MYSQL_READ_SOCKET and MYSQL_READ_PORT instead of MYSQL_UPDATE_SOCKET
and MYSQL_UPDATE_PORT?

In my opinion these values should be set to MYSQL_UPDATE_SOCKET and
MYSQL_UPDATE_PORT?



You are correct, and that probably fixes an outstanding bug report on 
SourceForge.  Most people use the same info for read and update, so no 
one has fixed the problem before.


Added to cvs.

Tom:  Do you have the tracker number?  I did not see anything that 
jumped out at me from the open reports, or even the first 50 any entries.


Rick

!DSPAM:4757551332001174195099!



Re: [vchkpw] mysql sourcing read/update server config file

2007-12-05 Thread Tom Collins

On Dec 5, 2007, at 5:49 PM, Rick Widmer wrote:
Tom:  Do you have the tracker number?  I did not see anything that  
jumped out at me from the open reports, or even the first 50 any  
entries.



Maybe it was something that I saw on the list.  I went in and looked  
at the trackers and didn't see anything.


-Tom



!DSPAM:4757804532001552416675!