Hi,

I've not yet gotten round to deploying rspamd on my mail server, because
I was experiencing a some crashes. I gave upstream the traces, and he
made fixes.

This diff fixes two crashes and also scaffolds the /var/run/rspamd
directory, which is needed, but I guess we had all made manually at some
point. On my VPS I got:

2016-09-16 15:19:52 #9118(main) <993676>; main; main: cannot write pid file 
/var/run/rspamd/rspamd.pid

OK?

P.S.

I notice that performance of learning spam with the sqlite backend is
pretty poor (can take over a minute to learn a message if you leave it
learning a corpus long enough -- during which the hard disk LED is
pegged on). Upstream speculates that fsync() may be expensive on
OpenBSD, which sqlite apparently uses liberally(?) Anyone know anything
about that?

I guess I'll try the redis backend...


Index: Makefile
===================================================================
RCS file: /home/edd/cvsync/ports/mail/rspamd/Makefile,v
retrieving revision 1.21
diff -u -p -r1.21 Makefile
--- Makefile    12 Sep 2016 09:48:37 -0000      1.21
+++ Makefile    16 Sep 2016 14:26:33 -0000
@@ -3,6 +3,7 @@
 COMMENT=       event-driven spam filtering system in C/Lua
 
 DISTNAME =     rspamd-1.3.5
+REVISION =     0
 EXTRACT_SUFX=  .tar.xz
 
 CATEGORIES=    mail
Index: patches/patch-src_libserver_html_c
===================================================================
RCS file: patches/patch-src_libserver_html_c
diff -N patches/patch-src_libserver_html_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_libserver_html_c  23 Sep 2016 16:52:58 -0000
@@ -0,0 +1,35 @@
+$OpenBSD$
+
+Fix crash due to memcpy on overlapping memory regions.
+
+https://github.com/vstakhov/rspamd/commit/9ac183e4ae31c1a5637dc371fbfff53a9adb2531
+
+--- src/libserver/html.c.orig  Thu Aug 25 13:14:57 2016
++++ src/libserver/html.c       Tue Sep 20 14:41:03 2016
+@@ -691,7 +691,7 @@ rspamd_html_decode_entitles_inplace (gchar *s, guint l
+                                               t += rep_len;
+                                       }
+                                       else {
+-                                              memcpy (t, e, h - e);
++                                              memmove (t, e, h - e);
+                                               t += h - e;
+                                       }
+                               }
+@@ -713,7 +713,7 @@ rspamd_html_decode_entitles_inplace (gchar *s, guint l
+                                       }
+                                       if (end_ptr != NULL && *end_ptr != 
'\0') {
+                                               /* Skip undecoded */
+-                                              memcpy (t, e, h - e);
++                                              memmove (t, e, h - e);
+                                               t += h - e;
+                                       }
+                                       else {
+@@ -736,7 +736,7 @@ rspamd_html_decode_entitles_inplace (gchar *s, guint l
+                                                               t += 
g_unichar_to_utf8 (val, t);
+                                                       }
+                                                       else {
+-                                                              memcpy (t, e, h 
- e);
++                                                              memmove (t, e, 
h - e);
+                                                               t += h - e;
+                                                       }
+                                               }
Index: patches/patch-src_libserver_url_c
===================================================================
RCS file: patches/patch-src_libserver_url_c
diff -N patches/patch-src_libserver_url_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_libserver_url_c   23 Sep 2016 16:52:58 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Fix crash in url_email_start().
+
+https://github.com/vstakhov/rspamd/commit/1b33ef8ab63be63ba712a456c846fe427c347d37
+
+--- src/libserver/url.c.orig   Thu Aug 25 13:14:57 2016
++++ src/libserver/url.c        Fri Sep 23 14:01:32 2016
+@@ -1925,9 +1925,13 @@ url_email_start (struct url_callback_data *cb,
+                       cb->last_at = NULL;
+                       return FALSE;
+               }
++              else if (pos == cb->begin) {
++                      /* Just @ at the start of input */
++                      return FALSE;
++              }
+       }
+ 
+-      if (pos > cb->begin - 1) {
++      if (pos >= cb->begin + 1) {
+               match->st = *(pos - 1);
+       }
+       else {
Index: pkg/PLIST
===================================================================
RCS file: /home/edd/cvsync/ports/mail/rspamd/pkg/PLIST,v
retrieving revision 1.7
diff -u -p -r1.7 PLIST
--- pkg/PLIST   12 Sep 2016 09:48:37 -0000      1.7
+++ pkg/PLIST   16 Sep 2016 14:26:18 -0000
@@ -156,6 +156,7 @@ share/rspamd/www/react-index.html
 @owner _rspamd
 @group _rspamd
 @sample ${LOCALSTATEDIR}/rspamd/
+@sample ${LOCALSTATEDIR}/run/rspamd/
 @owner
 @group
 @rcscript ${RCDIR}/rspamd

-- 
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk

Reply via email to