Hi All,

I had a problem with the Mysql UIDInSignature options, as it tries to
fetch the uid based on the user name first and if user name not found,
does not go beyond this point.

I therefore changed the order of the tests in a better order (IMHO)

I hope it can be usefull.

Xavier De Cock


Index: src/mysql_drv.c
===================================================================
RCS file: /usr/local/cvsroot/dspam/src/mysql_drv.c,v
retrieving revision 1.75
diff -u -r1.75 mysql_drv.c
--- src/mysql_drv.c     7 Dec 2007 00:11:52 -0000       1.75
+++ src/mysql_drv.c     27 Feb 2008 15:03:33 -0000
@@ -1057,7 +1057,7 @@
   char query[128];
   MYSQL_RES *result;
   MYSQL_ROW row;
-  int uid;
+  int uid=NULL;
   MYSQL *dbh;
 
   if (s->dbt == NULL)
@@ -1073,13 +1073,6 @@
   else
     p = _mysql_drv_getpwnam (CTX, CTX->group);
 
-  if (p == NULL)
-  {
-    LOGDEBUG ("_ds_get_signature: unable to _mysql_drv_getpwnam(%s)",
-              CTX->username);
-    return EINVAL;
-  }
-
   if (_ds_match_attribute(CTX->config->attributes,
"MySQLUIDInSignature", "on"))
   {
     char *u, *sig, *username;
@@ -1112,14 +1105,23 @@
     s = (struct _mysql_drv_storage *) CTX->storage;
 
     dbh = _mysql_drv_sig_write_handle(CTX, s);
-  } else {
+  }
+
+  if (p == NULL)
+  {
+    LOGDEBUG ("_ds_get_signature: unable to _mysql_drv_getpwnam(%s)",
+              CTX->username);
+    return EINVAL;
+  }
+
+  if (uid == NULL){
     uid = p->pw_uid;
   }
 
   snprintf (query, sizeof (query),
           "select data, length from dspam_signature_data "
           "where uid = %d and signature = \"%s\"", uid, signature);
-
+  
   if (mysql_real_query (dbh, query, strlen (query)))
   {
     _mysql_drv_query_error (mysql_error (dbh), query);

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée

Reply via email to