Subject: smtpserver busylooping

From: Eugene Crosser <[email-masked]>
Date: Mon, 27 May 2002 16:08:21 +0400 (MSD)

CVS copy out of May 23 eventually starts busylooping here.  I tracked it
down to this point (smtpserver/smtpserver.c:1493):

Z_write(SS, ptr, len)
     SmtpState * SS;
     const void *ptr;
     int len;
{
    int i, rc = 0;
    char *buf = (char *)ptr;

    while (len > 0) {
      i = SS->sslwrspace - SS->sslwrin; /* space */
      if (i == 0) {
        /* The buffer is full! Flush it */
        typeflush(SS);
        if (gotalarm) break;
        i = SS->sslwrspace;
      }
      /* Copy only as much as can fit into current space */
      if (i > len) i = len;
      memcpy(SS->sslwrbuf + SS->sslwrin, buf, i);
      SS->sslwrin += i;
      buf += i;
      len -= i;
      rc += i;
    }

    /* how much written out ? */
    return rc;
}

somehow SS->sslwrspace is zero on entry to this function, and len is
non-zero.  At the bottom, len is decremented by zero so the "while (len>0)"
loop runs forever.  Any comment?

--
Eugene Crosser, head of Internet Applications section, +7 501 787 1000
ROL, Teleross, Golden Telecom, http://user.rol.ru/~crosser/

-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to [email-masked]

---

From: Matti Aarnio <[email-masked]>
Date: Tue, 28 May 2002 14:22:33 +0300

> down to this point (smtpserver/smtpserver.c:1493):

  Do you use the deprecated  ssmtp  port ?   In that mode there
  apparently is too late init of the  sslwrspace variable, and
  sslwrbuf  buffer, which may indeed manifest as what you state.
  Although...  of  sslwrspace is zero, then   sslwrbuf  is likely
  NULL also, which in my thinking should lead to SEGV...
  (unless memcpy() does something clever..)

/Matti Aarnio

-- 
/Matti Aarnio	<[email-masked]>
FUNET:  Finnish Academic and Research Network
	Network Information/Software Archival Service
-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to [email-masked]

---

From: Eugene Crosser <[email-masked]>
Date: Tue, 28 May 2002 16:17:23 +0400 (MSD)

On Tue, 28 May 2002 14:22:33 +0300 Matti Aarnio <[email-masked]> wrote:

>   Do you use the deprecated  ssmtp  port ?

Nope!

>   In that mode there

I will try the changed version but the problem does not happen too often
so no definite response soon...

-

---

From: Matti Aarnio <[email-masked]>
Date: Tue, 28 May 2002 18:04:18 +0300

> >   Do you use the deprecated  ssmtp  port ?

  Hmm..  Then the fix should not matter, and the real culprit is
  either over-scribling of variable (code bug), or compiler produced
  buggy binary..

---

From: Eugene Crosser <[email-masked]>
Date: Tue, 28 May 2002 20:42:04 +0400 (MSD)

On Tue, 28 May 2002 18:04:18 +0300 Matti Aarnio <[email-masked]> wrote:

> > > > CVS copy out of May 23 eventually starts busylooping here.  I
> tracked
> > > it

It did not happen since...  It *could* be because I might have built the
binary after ./configure run for different platform or somesuch...
Well, forget it for now, if I observe the problem again with a definitley good
binary I will do futher investigation.

-