aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Alves Grando <mnag@FreeBSD.org>2008-09-07 18:40:33 +0000
committerMarcus Alves Grando <mnag@FreeBSD.org>2008-09-07 18:40:33 +0000
commitc95a3db444d012850b37b908513a208277e1272a (patch)
tree68456f694486df178dbc6d70cac9450be3d96b3c
parent20dba0024d56c7cc1472bfbded1b2ad4c82439d4 (diff)
downloadports-c95a3db444d012850b37b908513a208277e1272a.tar.gz
ports-c95a3db444d012850b37b908513a208277e1272a.zip
- Adding Received-SPF header
PR: 124898 Submitted by: Ayumi M <ayu___commun.jp>
Notes
Notes: svn path=/head/; revision=220151
-rw-r--r--mail/postfix-policyd-spf/Makefile2
-rw-r--r--mail/postfix-policyd-spf/files/patch-policyd.c58
2 files changed, 41 insertions, 19 deletions
diff --git a/mail/postfix-policyd-spf/Makefile b/mail/postfix-policyd-spf/Makefile
index 80b6c15b99a9..3b8e62b0bfba 100644
--- a/mail/postfix-policyd-spf/Makefile
+++ b/mail/postfix-policyd-spf/Makefile
@@ -7,7 +7,7 @@
PORTNAME= policyd
PORTVERSION= 1.0.1
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= mail
MASTER_SITES= http://www.libspf2.org/patch/
PKGNAMEPREFIX= postfix-
diff --git a/mail/postfix-policyd-spf/files/patch-policyd.c b/mail/postfix-policyd-spf/files/patch-policyd.c
index 8b1068d69948..7bd5c0b03263 100644
--- a/mail/postfix-policyd-spf/files/patch-policyd.c
+++ b/mail/postfix-policyd-spf/files/patch-policyd.c
@@ -1,14 +1,21 @@
---- policyd.c.orig Thu Jul 8 18:42:25 2004
-+++ policyd.c Wed Dec 22 15:55:22 2004
-@@ -76,6 +76,7 @@
+--- policyd.c.orig 2004-07-09 06:42:25.000000000 +0900
++++ policyd.c 2008-06-23 12:55:02.000000000 +0900
+@@ -70,12 +70,14 @@
+
+ #define POSTFIX_DUNNO "DUNNO"
+ #define POSTFIX_REJECT "REJECT"
++#define POSTFIX_PREPEND "PREPEND"
+
+ typedef
+ struct _config_t {
char *localpolicy;
char *explanation;
int trustedforwarder;
+ int softfailreject;
int debug;
} config_t;
-
-@@ -106,6 +107,7 @@
+
+@@ -106,6 +108,7 @@
static const struct option longopts[] = {
{ "localpolicy", required_argument, NULL, 'l', },
{ "trustedforwarder", no_argument, NULL, 't', },
@@ -16,16 +23,16 @@
{ "explanation", required_argument, NULL, 'x', },
{ "debug", optional_argument, NULL, 'd', },
{ "help", no_argument, NULL, 'h', },
-@@ -119,7 +121,7 @@
+@@ -119,7 +122,7 @@
#else
#define DOC_LONGOPT(l, v, t, p1) do { } while(0)
#endif
-static const char *shortopts = "a:h";
+static const char *shortopts = "l:x:d:tsh";
-
+
#define DOC_OPT(s, l, v, t, p0, p1) do { \
fprintf(stderr, " -%c%c%s%*s" t "\n", \
-@@ -137,10 +139,12 @@
+@@ -137,10 +140,12 @@
"Set the SPF local policy.", 21, 10);
DOC_OPT('t', "trustedforwarder", NULL,
"Use the trusted-forwarder.com whitelist.", 29, 13);
@@ -40,16 +47,25 @@
DOC_OPT('h', "help", NULL,
"Display this help.", 29, 25);
}
-@@ -249,7 +253,7 @@
+@@ -249,7 +254,7 @@
}
-
+
static void
-process_request(request_t *req)
+process_request(request_t *req, config_t *conf)
{
SPF_output_t output;
-
-@@ -287,6 +291,16 @@
+
+@@ -268,7 +273,7 @@
+
+ switch (output.result) {
+ case SPF_RESULT_PASS:
+- strcpy(req->result, POSTFIX_DUNNO);
++ snprintf(req->result, RESULTSIZE, POSTFIX_PREPEND " %s", output.received_spf);
+ break;
+ case SPF_RESULT_FAIL:
+ snprintf(req->result, RESULTSIZE,
+@@ -287,11 +292,21 @@
: ""));
break;
case SPF_RESULT_SOFTFAIL:
@@ -66,10 +82,16 @@
case SPF_RESULT_NEUTRAL:
case SPF_RESULT_UNKNOWN:
case SPF_RESULT_NONE:
-@@ -315,6 +329,11 @@
+ default:
+- strcpy(req->result, POSTFIX_DUNNO);
++ snprintf(req->result, RESULTSIZE, POSTFIX_PREPEND " %s", output.received_spf);
+ break;
+ }
+
+@@ -315,6 +330,11 @@
argv0 = argv[0];
-
-
+
+
+ config.localpolicy = NULL;
+ config.explanation = NULL;
+ config.trustedforwarder = 0;
@@ -78,7 +100,7 @@
while ((c =
#ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv, shortopts, longopts, &idx)
-@@ -329,12 +348,15 @@
+@@ -329,12 +349,15 @@
case 't':
config.trustedforwarder = 1;
break;
@@ -95,12 +117,12 @@
else
config.debug = 1;
break;
-@@ -366,7 +388,7 @@
+@@ -366,7 +389,7 @@
CHECK(req.client_ip, "client_address")
else CHECK(req.sender_address, "sender")
else CHECK(req.helo_address, "helo_name")
- else process_request(&req);
+ else process_request(&req, &config);
-
+
req.result[RESULTSIZE - 1] = '\0';
printf("action=%s\n\n", req.result);