Recall that these were the messages I was getting:

12984: [12/31/2007 10:15:52] sedation level set to: 0
12984: [12/31/2007 10:15:52] _mysql_drv_getspamtotals: unable to _mysql_drv_getpwnam((null))
12984: [12/31/2007 10:15:52] unable to load totals.  using zero values.
12984: [12/31/2007 10:15:52] _ds_getall_spamrecords: unable to _mysql_drv_getpwnam((null))
12984: [12/31/2007 10:15:52] _ds_getall_spamrecords() failed

I definitely need to look into this code more after I understand the whole driver file, but on first glance, there seems to be some duplicated and broken logic in this mysql driver code:

mysql_drv.c:

if (!CTX->group || CTX->flags & DSF_MERGED)
   p = _mysql_drv_getpwnam (CTX, CTX->username);
 else
   p = _mysql_drv_getpwnam (CTX, CTX->group);

/*
 if (p == NULL)
 {
LOGDEBUG ("_mysql_drv_get_spamtotals: unable to _mysql_drv_getpwnam(%s)",
             CTX->username);
   if (!(CTX->flags & DSF_MERGED))
     return EINVAL;
 } else {

   uid = p->pw_uid;
 }

/* Now, this is a similar, but not the same, check as done above already. However, this one does not check for a null CTX->group */
 if (CTX->flags & DSF_MERGED) {
/* What if we have already gotten a value for p above? */
   p = _mysql_drv_getpwnam (CTX, CTX->group);
   if (p == NULL)
   {
     /* this is the line throwing the error */
LOGDEBUG ("_mysql_drv_getspamtotals: unable to _mysql_drv_getpwnam(%s)",
               CTX->group);
     return EINVAL;

This same broken code is also in _ds_getall_spamrecords()

-Jason

Jason Axley wrote:

<snip>

Reply via email to