Index: acl.c
--- acl.c.orig	2007-11-11 12:57:19 +0100
+++ acl.c	2008-04-12 18:50:04 +0200
@@ -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	2007-11-11 12:57:19 +0100
+++ acl.h	2008-04-12 18:50:04 +0200
@@ -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, } acl_type_t;
 typedef enum { AS_NONE, AS_RCPT, AS_DATA, AS_ANY, } acl_stage_t;
Index: list.c
--- list.c.orig	2007-11-06 12:39:33 +0100
+++ list.c	2008-04-12 18:50:04 +0200
@@ -45,7 +45,7 @@
 #include <errno.h>
 #include <sysexits.h>
 #include <sys/types.h>
-#include <regex.h>
+#include "pcreposix.h"
 
 #ifdef HAVE_OLD_QUEUE_H 
 #include "queue.h"
Index: macro.c
--- macro.c.orig	2007-11-06 12:39:33 +0100
+++ macro.c	2008-04-12 18:50:04 +0200
@@ -45,7 +45,7 @@
 #include <syslog.h>
 #include <errno.h>
 #include <sysexits.h>
-#include <regex.h>
+#include "pcreposix.h"
 
 #ifdef HAVE_OLD_QUEUE_H 
 #include "queue.h"
Index: milter-greylist.c
--- milter-greylist.c.orig	2007-12-29 20:06:49 +0100
+++ milter-greylist.c	2008-04-12 18:53:46 +0200
@@ -77,7 +77,7 @@
 static int check_drac(char *dotted_ip);
 #endif
 
-#include <libmilter/mfapi.h>
+#include "milter/mfapi.h"
 
 #include "dump.h"
 #include "spf.h"
@@ -666,6 +666,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_msgcount > conf.c_maxpeek) {
 		if (conf.c_debug)
 			mg_log(LOG_DEBUG, 
@@ -1489,6 +1493,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);
 	
@@ -2897,6 +2904,8 @@
 	 * Macro {if_addr} does not exist in Postfix 
 	 */
 	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	2007-11-11 12:57:19 +0100
+++ milter-greylist.h	2008-04-12 18:50:04 +0200
@@ -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	2007-10-06 01:12:47 +0200
+++ stat.c	2008-04-12 18:50:04 +0200
@@ -52,7 +52,7 @@
 #include <sys/queue.h>
 #endif
 
-#include <libmilter/mfapi.h>
+#include "milter/mfapi.h"
 
 #include "milter-greylist.h"
 #include "conf.h"
