Index: acl.c
--- acl.c.orig	2013-09-01 06:59:42.000000000 +0200
+++ acl.c	2014-12-24 10:41:50.516977685 +0100
@@ -58,7 +58,7 @@
 #include <sys/stat.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <regex.h>
+#include "pcreposix.h"
 
 #include "spf.h"
 #include "acl.h"
Index: acl.h
--- acl.h.orig	2013-08-27 15:50:44.000000000 +0200
+++ acl.h	2014-12-24 10:41:50.516977685 +0100
@@ -46,7 +46,7 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <regex.h>
+#include "pcreposix.h"
 
 typedef enum { A_GREYLIST, A_WHITELIST, A_BLACKLIST, A_CONTINUE, } acl_type_t;
 typedef enum { AS_NONE, AS_RCPT, AS_DATA, AS_ANY, } acl_stage_t;
Index: brokenmfapi.c
--- brokenmfapi.c.orig	2013-09-01 07:00:16.000000000 +0200
+++ brokenmfapi.c	2014-12-24 10:44:09.906812790 +0100
@@ -30,7 +30,7 @@
  */
 
 #include <syslog.h>
-#include <libmilter/mfapi.h>
+#include <milter/mfapi.h>
 
 #include "milter-greylist.h"
 
Index: configure
--- configure.orig	2014-02-21 09:11:44.000000000 +0100
+++ configure	2014-12-24 10:42:49.796814750 +0100
@@ -7939,7 +7939,7 @@
 /* end confdefs.h.  */
 
 		#include <pthread.h>
-		#include <libmilter/mfapi.h>
+		#include <milter/mfapi.h>
 
 int
 main ()
@@ -7960,7 +7960,7 @@
 /* end confdefs.h.  */
 
 			#include <pthread.h>
-			#include <libmilter/mfapi.h>
+			#include <milter/mfapi.h>
 
 int
 main ()
Index: list.c
--- list.c.orig	2013-01-19 17:01:15.000000000 +0100
+++ list.c	2014-12-24 10:41:50.516977685 +0100
@@ -45,7 +45,7 @@
 #include <errno.h>
 #include <sysexits.h>
 #include <sys/types.h>
-#include <regex.h>
+#include "pcreposix.h"
 
 #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) 
 #include "queue.h"
Index: macro.c
--- macro.c.orig	2013-01-19 17:01:15.000000000 +0100
+++ macro.c	2014-12-24 10:41:50.516977685 +0100
@@ -45,7 +45,7 @@
 #include <syslog.h>
 #include <errno.h>
 #include <sysexits.h>
-#include <regex.h>
+#include "pcreposix.h"
 
 #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) 
 #include "queue.h"
Index: milter-greylist.c
--- milter-greylist.c.orig	2014-02-07 14:46:46.000000000 +0100
+++ milter-greylist.c	2014-12-24 10:41:50.526947695 +0100
@@ -78,7 +78,7 @@
 static int check_drac(char *dotted_ip);
 #endif
 
-#include <libmilter/mfapi.h>
+#include "milter/mfapi.h"
 
 #include "dump.h"
 #include "spf.h"
@@ -151,6 +151,7 @@
 #ifdef HAVE_DATA_CALLBACK
 static sfsistat real_data(SMFICTX *);
 #endif
+char *local_ipstr(struct mlfi_priv *priv);
 
 struct smfiDesc smfilter =
 {
@@ -865,6 +866,10 @@
 	len = strlen(name) + strlen(sep) + strlen(value) + strlen(crlf);
 	priv->priv_msgcount += len;
 
+	if (priv->priv_queueid == NULL || strcmp(priv->priv_queueid, "(unknown id)") == 0)
+		if ((priv->priv_queueid = smfi_getsymval(ctx, "{i}")) == NULL)
+			priv->priv_queueid = "(unknown id)";
+
 	if (priv->priv_maxpeek == 0)
 		return SMFIS_CONTINUE;
 
@@ -2068,6 +2073,9 @@
 	 * Here we go!
 	 */
 	conf_release();
+	umask(S_IWOTH);
+	smfi_opensocket(1);
+	umask(S_IWGRP|S_IWOTH);
 	exitval = smfi_main();
 	mg_log(LOG_ERR, "smfi_main() returned %d", exitval);
 	
@@ -3735,8 +3743,7 @@
 }
 
 char *
-local_ipstr(priv)
-	struct mlfi_priv *priv;
+local_ipstr(struct mlfi_priv *priv)
 {
 	static int log_missing_if_addr = 1;
 	char *ip;
@@ -3745,6 +3752,8 @@
 	 * Macro {if_addr} does not exist in Postfix and CommSuite
 	 */
 	ip = smfi_getsymval(priv->priv_ctx, "{if_addr}");
+	if (ip == NULL)
+ 	    ip = smfi_getsymval(priv->priv_ctx, "{client_addr}");
 #ifdef AF_INET6
 	/*
 	 * XXX: sendmail doesn't return {if_addr} when connection is
Index: milter-greylist.h
--- milter-greylist.h.orig	2014-02-07 14:46:46.000000000 +0100
+++ milter-greylist.h	2014-12-24 10:41:50.526947695 +0100
@@ -37,7 +37,7 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 
-#include <libmilter/mfapi.h>
+#include "milter/mfapi.h"
 #include "config.h"
 #include "dump.h"
 
Index: stat.c
--- stat.c.orig	2013-01-19 17:01:15.000000000 +0100
+++ stat.c	2014-12-24 10:41:50.526947695 +0100
@@ -52,7 +52,7 @@
 #include <sys/queue.h>
 #endif
 
-#include <libmilter/mfapi.h>
+#include "milter/mfapi.h"
 
 #include "milter-greylist.h"
 #include "conf.h"
