libesmtp-1.0.2 bug and patch for FreeBSD
John Merryweather Cooper <[email protected]> Tue, 20 Jan 2004 10:48:27 -0800
| Newsgroups | gmane.comp.lib.libesmtp |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------040208020406080101020909
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Version 1.0.2 works after a little hacking on FreeBSD:
Patch: patch-smpt-tls.c
FreeBSD does not have a memrchr() [not POSIX] and so a home-grown one is
cobbled into the code with the patch. FreeBSD does have a strrchr() for
C-strings.
Patch: patch-errors.c
FreeBSD's EAI codes are arranged somewhat differently. This patch takes
care of this.
--------------040208020406080101020909
Content-Type: text/plain;
name="patch-smtp-tls.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="patch-smtp-tls.c"
--- 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
--------------040208020406080101020909
Content-Type: text/plain;
name="patch-errors.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="patch-errors.c"
Index: errors.c
diff -u errors.c.orig errors.c
--- errors.c.orig Mon Mar 4 18:06:58 2002
+++ errors.c Thu Oct 30 00:52:41 2003
@@ -77,8 +77,12 @@
MAP(EAI_AGAIN)
MAP(EAI_FAIL)
MAP(EAI_MEMORY)
+#ifdef EAI_ADDRFAMILY
MAP(EAI_ADDRFAMILY)
+#endif
+#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME
MAP(EAI_NODATA)
+#endif
MAP(EAI_FAMILY)
MAP(EAI_BADFLAGS)
MAP(EAI_NONAME)
@@ -98,8 +102,12 @@
MAP(EAI_AGAIN)
MAP(EAI_FAIL)
MAP(EAI_MEMORY)
+#ifdef EAI_ADDRFAMILY
MAP(EAI_ADDRFAMILY)
+#endif
+#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME
MAP(EAI_NODATA)
+#endif
MAP(EAI_FAMILY)
MAP(EAI_BADFLAGS)
MAP(EAI_NONAME)
--------------040208020406080101020909--