[tpop3d-discuss] tpop3d, version 1.5.1

Jakob Hirsch jh at plonk.de
Fri, 29 Aug 2003 04:07:42 +0200


Jakob Hirsch wrote:

>> Certainly looking at auth_mysql.c there's no
>> longer an explicit check for a domain being present.
>> Obviously if you specify a query involving $(domain) it
>> won't be run if no domain is given.
> it should, if $(user) is used in the query.

ok, we do not check particularly for this now, but the patch below should do
it (at least it works on my machine).
As I did see, local_part is empty if a user logs in without a domain and
domain is then simply set to the domain of the interface.


--- tpop3d-1.5.1/auth_mysql.c   Tue Jul 15 01:31:20 2003
+++ tpop3d-1.5.1-jh/auth_mysql.c        Fri Aug 29 03:47:06 2003
@@ -484,7 +484,10 @@
     }

     /* Do the substitution. */
-    query = substitute_variables(template, &err, 5, "user", u,
"local_part", l, "domain", d, "clienthost", c, "serverhost", s);
+    if (local_part)
+        query = substitute_variables(template, &err, 5, "user", u,
"local_part", l, "domain", d, "clienthost", c, "serverhost", s);
+    else
+       query = substitute_variables(template, &err, 5, "user", u,
"local_part", "", "domain", "", "clienthost", c, "serverhost", s);
     if (!query && err.code != sv_nullvalue)
         log_print(LOG_ERR, _("substitute_query_params: %s near `%.16s'"),
err.msg, template + err.offset);