]> git.mikk.net Git - smtpsink/commitdiff
Replace FreeBSD-specific strnstr() with memmem()
authorChris Mikkelson <chris@mikk.net>
Thu, 25 Oct 2012 19:17:45 +0000 (14:17 -0500)
committerChris Mikkelson <chris@mikk.net>
Thu, 25 Oct 2012 19:17:45 +0000 (14:17 -0500)
smtp.c

diff --git a/smtp.c b/smtp.c
index d64042b960a4f617cff0ea0c1d3feddac19f1315..e6e394e2ce71db12aa771c957cb08fe1dc70caac 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -15,6 +15,8 @@
  * PERFORMANCE OF THIS SOFTWARE. 
  */ 
 
+#define _GNU_SOURCE
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -22,6 +24,7 @@
 #include <unistd.h>
 #include <assert.h>
 #include <ctype.h>
+#include <time.h>
 
 #include <sys/queue.h>
 #include <netinet/in.h>
@@ -270,7 +273,7 @@ do_smtp(struct conn  *c, char **buf, int *len)
                if (c->dstate == 5) return smtpd_enddata(c);
                return 1;
        } else {
-               char *t = strnstr(*buf, "\r\n", *len);
+               char *t = memmem(*buf, *len, "\r\n", 2);
                char *cmd = *buf;
                int clen;