Hi, 

version: vpopmail 5.4.2
file: vpgsql.c
option: --enable-roaming-users=y

It doesn't update tcp.smtp.cdb after pop3 auth.
(clearopensmtp updates tcp.smtp.cdb)

vmysql.c and voracle.pc (and vsybase.c?) have the same problem, I think.

vopen_smtp_relay() shouldn't return 0 to update tcp.smtp.cdb.

vpopmail.c:2433
> int open_smtp_relay()
> {
> #ifdef USE_SQL
>   /* store the user's ip address into the sql relay table */
>   if (vopen_smtp_relay()) {
>     /* generate a new tcp.smtp.cdb file */
>    if (update_rules() != 0) {
>      fprintf (stderr, "Error. update_rules failed\n");
>      return (-1);
>    }
>   }
> #else

But vopen_smtp_relay() returns 0 after insert or update.

vpgsql.c:614
> int vopen_smtp_relay()
> {
...
>   if ( ipaddr == NULL ) {
>     return 0;
>   }
> 
>   if ( (err=vauth_open()) != 0 ) return 0;
...       
>   if(!pgres || PQresultStatus(pgres)!= PGRES_COMMAND_OK ) {
>     /* need to return non-zero value if value inserted */
>     if( pgres ) PQclear(pgres);
>     return 1;
>   }
> 
>   if( pgres ) PQclear(pgres);
>   return 0;
> }

So, my idea to fix this problem is the following.
It works.

--- vpgsql.c.orig       2004-02-26 19:44:58.000000000 +0900
+++ vpgsql.c.fix        2004-02-26 21:09:26.000000000 +0900
@@ -658,11 +658,11 @@
   if(!pgres || PQresultStatus(pgres)!= PGRES_COMMAND_OK ) {
     /* need to return non-zero value if value inserted */
     if( pgres ) PQclear(pgres);
-    return 1;
+    return 0;
   }
 
   if( pgres ) PQclear(pgres);
-  return 0;
+  return 1;
 }

Or I think that a comment about return value in vmysql.c is thoughtful.

What's good idea?


---
Ken Nonaka
nonaka at imasy or jp

Reply via email to