diff -ur greylisting-spp-0.2-orig/src/db-file.c greylisting-spp-0.2/src/db-file.c
--- greylisting-spp-0.2-orig/src/db-file.c	Tue Sep 21 08:45:56 2004
+++ greylisting-spp-0.2/src/db-file.c	Mon Jul 18 02:15:45 2005
@@ -130,7 +130,7 @@
     my_lock.l_whence = SEEK_SET;
     my_lock.l_start = 0;
     my_lock.l_len = 0;
-    if (fcntl(db_file, F_SETLK, &my_lock) < 0) {
+    if (fcntl(db_file, F_SETLKW, &my_lock) < 0) {
 	char *error = strerror(errno);
 	write(STDERR_FILENO, progname, strlen(progname));
 	write(STDERR_FILENO, ": ", 2);
diff -ur greylisting-spp-0.2-orig/src/greylisting-spp.c greylisting-spp-0.2/src/greylisting-spp.c
--- greylisting-spp-0.2-orig/src/greylisting-spp.c	Tue Sep 21 08:45:56 2004
+++ greylisting-spp-0.2/src/greylisting-spp.c	Fri Jul 15 06:17:47 2005
@@ -31,9 +31,14 @@
 #define ENV_RCPT_TO	"SMTPRCPTTO"
 #define	ENV_REMOTEIP	"TCPREMOTEIP"
 
+#define	ENV_IGNORE_SENDER	"GL_IGNORE_SENDER"
+#define	ENV_IGNORE_RECIPIENT	"GL_IGNORE_RECIPIENT"
+#define	ENV_IGNORE_REMOTEIP	"GL_IGNORE_REMOTEIP"
+#define	ENV_MASK_IP	"GL_MASK_IP"
+
 #define DEFAULT_MIN_REJECT	300
 #define DEFAULT_MAX_WAIT	86400
-#define DEFAULT_ACCEPT_GOOD	259200
+#define DEFAULT_ACCEPT_GOOD	(86400*14)
 
 #define CMD_REJECT	"E451 GL - temporary problem. Please try again later.\n"
 
@@ -73,7 +78,27 @@
 }
 
 /** Write a reject command to stdout */
-static void reject() {
+static void add_accept_header(char* remoteip, char* sender, char* recipient) {
+    write(STDOUT_FILENO, "HX-Greylist-Accepted: ", 22);
+    write(STDOUT_FILENO, progname, strlen(progname));
+    write(STDOUT_FILENO, " <", 2);
+    write(STDOUT_FILENO, remoteip, strlen(remoteip));
+    write(STDOUT_FILENO, ", ", 1);
+    write(STDOUT_FILENO, sender, strlen(sender));
+    write(STDOUT_FILENO, ", ", 1);
+    write(STDOUT_FILENO, recipient, strlen(recipient));
+    write(STDOUT_FILENO, ">\n", 2);
+}
+/** Write a reject command to stdout */
+static void reject(char* remoteip, char* sender, char* recipient) {
+    write(STDERR_FILENO, progname, strlen(progname));
+    write(STDERR_FILENO, ": rejecting <", 13);
+    write(STDERR_FILENO, remoteip, strlen(remoteip));
+    write(STDERR_FILENO, ", ", 1);
+    write(STDERR_FILENO, sender, strlen(sender));
+    write(STDERR_FILENO, ", ", 1);
+    write(STDERR_FILENO, recipient, strlen(recipient));
+    write(STDERR_FILENO, ">\n", 2);
     write(STDOUT_FILENO, CMD_REJECT, strlen(CMD_REJECT));
 }
 
@@ -81,10 +106,16 @@
 int main(int argc, char **argv) {
 char *db, *remoteip, *sender, *ezmlm_sender = NULL, *recipient, *ezmlm_ret;
 int found, i;
+int ignore_sender = 0;
+int ignore_recipient = 0;
+int ignore_remoteip = 0;
+int mask_ip = 0;
 
     if (getenv(ENV_WHITELISTED) || getenv(ENV_RELAYCLIENT)) { exit(0); }
 
     progname = argv[0];
+    progname = strrchr(progname, '/');
+    if(progname) progname += 1;
 
     db = get_required_env(ENV_LISTDB);
     remoteip = get_required_env(ENV_REMOTEIP);
@@ -94,6 +125,15 @@
     min_reject = get_numeric_option(ENV_MIN_REJECT, DEFAULT_MIN_REJECT);
     max_wait = get_numeric_option(ENV_MAX_WAIT, DEFAULT_MAX_WAIT);
     accept_good = get_numeric_option(ENV_ACCEPT_GOOD, DEFAULT_ACCEPT_GOOD);
+    ignore_sender = get_numeric_option(ENV_IGNORE_SENDER, 0);
+    ignore_recipient = get_numeric_option(ENV_IGNORE_RECIPIENT, 0);
+    ignore_remoteip = get_numeric_option(ENV_IGNORE_REMOTEIP, 0);
+    mask_ip = get_numeric_option(ENV_MASK_IP, 0);
+
+    if(mask_ip) {
+	    char* foo = strrchr(remoteip, '.');
+	    if(foo) *foo = 0;
+    }
 
     if ((ezmlm_ret = strstr(sender, "-return-"))) {
 	/* special handling for ezmlm's VERPs:
@@ -114,18 +154,21 @@
 	    }
 	}
     }
+    if(ignore_sender) sender = "";
+    if(ignore_recipient) recipient = "";
+    if(ignore_remoteip) remoteip = "";
 
     opendb(db);
     found = find_entry(remoteip, ezmlm_sender == NULL ? sender : ezmlm_sender,
 		       recipient);
     if (found < 0) {
 	/* No match found -> reject and add entry */
-	reject();
+	reject(remoteip, sender, recipient);
 	add_entry(remoteip, ezmlm_sender == NULL ? sender : ezmlm_sender,
 		  recipient);
     } else if (found == 0) {
 	/* Match found, but min_reject is not expired -> reject again */
-	reject();
+	reject(remoteip, sender, recipient);
     } else {
 	/* Match found and min_reject expired and max_wait or accept_good not
 	 * expired */
@@ -134,6 +177,7 @@
 	    delete_entry();
 	} else {
 	    /* not a bounce -> update entry [and accept] */
+	    add_accept_header(remoteip, sender, recipient);
 	    update_entry();
 	}
     }
