From owner-cvs-ports@FreeBSD.ORG Sun Jan 18 23:03:07 2004 Return-Path: Delivered-To: cvs-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B501416A4D1 for ; Sun, 18 Jan 2004 23:03:07 -0800 (PST) Received: from smtp101.mail.sc5.yahoo.com (smtp101.mail.sc5.yahoo.com [216.136.174.139]) by mx1.FreeBSD.org (Postfix) with SMTP id A567543D1F for ; Sun, 18 Jan 2004 23:03:00 -0800 (PST) (envelope-from john_m_cooper@yahoo.com) Received: from unknown (HELO yahoo.com) (john?m?cooper@67.21.169.8 with plain) by smtp101.mail.sc5.yahoo.com with SMTP; 19 Jan 2004 07:02:59 -0000 Message-ID: <400CD2A3.3090409@yahoo.com> Date: Mon, 19 Jan 2004 23:02:59 -0800 From: John Merryweather Cooper User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Max Khon References: <200401181147.i0IBl79Q029549@repoman.freebsd.org> <20040118204455.GA35450@FreeBSD.org> In-Reply-To: <20040118204455.GA35450@FreeBSD.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: Clement LAFORET cc: cvs-ports@FreeBSD.org cc: cvs-all@FreeBSD.org cc: ports-committers@FreeBSD.org Subject: Re: cvs commit: ports/mail/libesmtp Makefile X-BeenThere: cvs-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jan 2004 07:03:07 -0000 I was away in Seattle, so viewing the code was a might difficult. Now that I'm back home, I have to agree that the internal memrchr() fix better preserves the semantics of RFC 2818 (which parses from tail to head). I wonder since we have both a strchr() and a strrchr() in libc why this is not echoed with memchr() and a memrchr() since these functions are so similar. Also, the implementation of memrchr() seems to make some very i386-specific assumptions about pointers. Couldn't this be better implemented wrapping strrchr() to handle NUL and size_t? Other than that, it works. :) jmc Max Khon wrote: > Hello! > > On Sun, Jan 18, 2004 at 03:47:07AM -0800, Clement LAFORET wrote: > > >>clement 2004/01/18 03:47:07 PST >> >> FreeBSD ports repository >> >> Modified files: >> mail/libesmtp Makefile >> Log: >> s/memrchr/memchr/. >> It fixes an 'undefined reference to `memrchr''. >> >> Approved by: maintainer >> Approved by: erwin (mentor) (implicitly) > > > This fix is totally incorrect. memrchr is not a typo and was there > intentionally (please take a look at the comments in the patched file one > line before the places where memrchr is used). > > The correct fix is to add an implementation of memrchr.c to smtp-tls.c > (attached). > > /fjoe > > > ------------------------------------------------------------------------ > > --- smtp-tls.c.orig Mon Jan 19 02:36:32 2004 > +++ smtp-tls.c Mon Jan 19 02:41:25 2004 > @@ -450,6 +450,20 @@ > return 1; > } > > +#if defined(__FreeBSD__) > +void * > +memrchr(const void *v, int c, size_t size) > +{ > + const unsigned char *p = (const unsigned char *) v + size; > + > + while (size-- > 0) { > + if (*--p == c) > + return (void *) p; > + } > + return NULL; > +} > +#endif > + > /* Perform a domain name comparison where the reference may contain > wildcards. This implements the comparison from RFC 2818. > Each component of the domain name is matched separately, working from > > > ------------------------------------------------------------------------ > > _______________________________________________ > cvs-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/cvs-all > To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"