From root@corp.grupos.com.br  Wed Dec 22 14:31:16 2004
Return-Path: <root@corp.grupos.com.br>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 104D816A4CE; Wed, 22 Dec 2004 14:31:16 +0000 (GMT)
Received: from gwmail1.grupos.com.br (gwmail1.grupos.com.br [66.90.64.125])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 75FA443D46; Wed, 22 Dec 2004 14:31:15 +0000 (GMT)
	(envelope-from root@corp.grupos.com.br)
Received: from corp.grupos.com.br (unknown [150.162.166.55])
	by gwmail1.grupos.com.br (Postfix) with ESMTP id A93303C5D1;
	Wed, 22 Dec 2004 12:31:14 -0200 (BRST)
Received: by corp.grupos.com.br (Postfix, from userid 0)
	id E861620A6F; Wed, 22 Dec 2004 12:31:13 -0200 (BRST)
Message-Id: <20041222143113.E861620A6F@corp.grupos.com.br>
Date: Wed, 22 Dec 2004 12:31:13 -0200 (BRST)
From: Marcus Grando <marcus@corp.grupos.com.br>
Reply-To: Marcus Grando <marcus@corp.grupos.com.br>
To: FreeBSD-gnats-submit@freebsd.org
Cc: edwin@FreeBSD.org
Subject: [MAINTAINER] Update port: mail/policyd add libgnugetopt dependency
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         75386
>Category:       ports
>Synopsis:       [MAINTAINER] Update port: mail/policyd add libgnugetopt dependency
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 22 14:40:26 GMT 2004
>Closed-Date:    Wed Dec 22 21:11:48 GMT 2004
>Last-Modified:  Wed Dec 22 21:11:48 GMT 2004
>Originator:     Marcus Grando
>Release:        FreeBSD 4.11-STABLE i386
>Organization:
Grupos Internet S/A
>Environment:
System: FreeBSD corp.grupos.com.br 4.11-STABLE FreeBSD 4.11-STABLE #34: Sun Dec 19 18:25:44 BRST 2004 root@corp.grupos.com.br:/usr/obj/usr/src/sys/CORP i386


	
>Description:
Update port: mail/policyd

* Add devel/libgnugetopt dependency if OSVERSION < 500041
* If this change not need update PORTREVISION, please removeit.

	
>How-To-Repeat:
	
>Fix:

	

--- policyd.patch begins here ---
diff -ruN policyd.old/Makefile policyd/Makefile
--- policyd.old/Makefile	Wed Dec 22 01:43:31 2004
+++ policyd/Makefile	Wed Dec 22 12:20:11 2004
@@ -7,6 +7,7 @@
 
 PORTNAME=		policyd
 PORTVERSION=		1.0.1
+PORTREVISION=		1
 CATEGORIES=		mail
 MASTER_SITES=		http://www.libspf2.org/patch/
 
@@ -20,6 +21,12 @@
 CONFIGURE_ENV+=		LDFLAGS="-L${LOCALBASE}/lib"
 GNU_CONFIGURE=		yes
 
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500041
+LIB_DEPENDS+=		gnugetopt.1:${PORTSDIR}/devel/libgnugetopt
+.endif
+
 .if !defined(NOPORTDOCS)
 PORTDOCS=	*
 .endif
@@ -30,4 +37,4 @@
 	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
--- policyd.patch ends here ---


>Release-Note:
>Audit-Trail:

From: Marcus Grando <marcus@corp.grupos.com.br>
To: freebsd-gnats-submit@FreeBSD.org, edwin@FreeBSD.org
Cc:  
Subject: Re: ports/75386: [MAINTAINER] Update port: mail/policyd add libgnugetopt
 dependency
Date: Wed, 22 Dec 2004 14:24:54 -0200

 Please apply this new patch
 
 + Add devel/libgnugetopt dependency if OSVERSION < 500041
 + Include (-s|--softfailreject) options for reject SOFTFAIL (~all)
 
 --begin--
 diff -ruN policyd.old/Makefile policyd/Makefile
 --- policyd.old/Makefile	Wed Dec 22 01:43:31 2004
 +++ policyd/Makefile	Wed Dec 22 13:58:25 2004
 @@ -7,6 +7,7 @@
 
   PORTNAME=		policyd
   PORTVERSION=		1.0.1
 +PORTREVISION=		1
   CATEGORIES=		mail
   MASTER_SITES=		http://www.libspf2.org/patch/
 
 @@ -20,6 +21,12 @@
   CONFIGURE_ENV+=		LDFLAGS="-L${LOCALBASE}/lib"
   GNU_CONFIGURE=		yes
 
 +.include <bsd.port.pre.mk>
 +
 +.if ${OSVERSION} < 500041
 +LIB_DEPENDS+=		gnugetopt.1:${PORTSDIR}/devel/libgnugetopt
 +.endif
 +
   .if !defined(NOPORTDOCS)
   PORTDOCS=	*
   .endif
 @@ -30,4 +37,4 @@
   	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
   .endif
 
 -.include <bsd.port.mk>
 +.include <bsd.port.post.mk>
 diff -ruN policyd.old/files/patch-policyd.c policyd/files/patch-policyd.c
 --- policyd.old/files/patch-policyd.c	Wed Dec 31 21:00:00 1969
 +++ policyd/files/patch-policyd.c	Wed Dec 22 14:13:07 2004
 @@ -0,0 +1,93 @@
 +--- policyd.c.orig	Thu Jul  8 18:42:25 2004
 ++++ policyd.c	Wed Dec 22 14:11:59 2004
 +@@ -76,6 +76,7 @@
 + 	char	*localpolicy;
 + 	char	*explanation;
 + 	int		 trustedforwarder;
 ++	int		 softfailreject;
 + 	int		 debug;
 + } config_t;
 +
 +@@ -106,6 +107,7 @@
 + static const struct option	longopts[] = {
 + 		{ "localpolicy",		required_argument,	NULL, 'l', },
 + 		{ "trustedforwarder",	no_argument,		NULL, 't', },
 ++		{ "softfailreject",	no_argument,		NULL, 's', },
 + 		{ "explanation",		required_argument,	NULL, 'x', },
 + 		{ "debug",				optional_argument,	NULL, 'd', },
 + 		{ "help",				no_argument,		NULL, 'h', },
 +@@ -119,7 +121,7 @@
 + #else
 + #define DOC_LONGOPT(l, v, t, p1) do { } while(0)
 + #endif
 +-static const char	*shortopts = "a:h";
 ++static const char	*shortopts = "ltsxd:h";
 +
 + #define DOC_OPT(s, l, v, t, p0, p1) do { \
 + 		fprintf(stderr, "    -%c%c%s%*s" t "\n", \
 +@@ -137,6 +139,8 @@
 + 			"Set the SPF local policy.", 21, 10);
 + 	DOC_OPT('t', "trustedforwarder", NULL,
 + 			"Use the trusted-forwarder.com whitelist.", 29, 13);
 ++	DOC_OPT('s', "softfailreject", NULL,
 ++			"Reject SOFTFAIL.", 29, 15);
 + 	DOC_OPT('x', "explanation", "<explanation>",
 + 			"Set the SPF explanation.", 16, 5);
 + 	DOC_OPT('d', "debug", "[<level>]",
 +@@ -249,7 +253,7 @@
 + }
 +
 + static void
 +-process_request(request_t *req)
 ++process_request(request_t *req, config_t *conf)
 + {
 + 	SPF_output_t	output;
 +
 +@@ -287,6 +291,16 @@
 + 								: ""));
 + 			break;
 + 		case SPF_RESULT_SOFTFAIL:
 ++			if (conf->softfailreject == 1) {
 ++				snprintf(req->result, RESULTSIZE,
 ++							POSTFIX_REJECT " %s",
 ++							(output.smtp_comment
 ++								? output.smtp_comment
 ++								: (output.header_comment
 ++									? output.header_comment
 ++									: "")));
 ++				break;
 ++			}
 + 		case SPF_RESULT_NEUTRAL:
 + 		case SPF_RESULT_UNKNOWN:
 + 		case SPF_RESULT_NONE:
 +@@ -315,6 +329,11 @@
 + 		argv0 = argv[0];
 +
 +
 ++	config.localpolicy = NULL;
 ++	config.explanation = NULL;
 ++	config.trustedforwarder = 0;
 ++	config.softfailreject = 0;
 ++	config.debug = 0;
 + 	while ((c =
 + #ifdef HAVE_GETOPT_LONG
 + 		getopt_long(argc, argv, shortopts, longopts, &idx)
 +@@ -329,6 +348,9 @@
 + 			case 't':
 + 				config.trustedforwarder = 1;
 + 				break;
 ++			case 's':
 ++				config.softfailreject = 1;
 ++				break;
 + 			case 'x':
 + 				config.explanation = optarg;
 + 				break;
 +@@ -366,7 +388,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);
 --end--
 
 -- 
 Marcus Grando
 Grupos Internet S/A
 marcus(at)corp.grupos.com.br

From: Marcus Grando <marcus@corp.grupos.com.br>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/75386: [MAINTAINER] Update port: mail/policyd add libgnugetopt
 dependency
Date: Wed, 22 Dec 2004 15:44:59 -0200

 Please, wait for a new patch...
 
 Regards
 
 -- 
 Marcus Grando
 Grupos Internet S/A
 marcus(at)corp.grupos.com.br

From: Marcus Grando <marcus@corp.grupos.com.br>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/75386: [MAINTAINER] Update port: mail/policyd add libgnugetopt
 dependency
Date: Wed, 22 Dec 2004 16:06:13 -0200

 Now, this patch are correct...
 
 + Add devel/libgnugetopt dependency if OSVERSION < 500041
 + Include (-s|--softfailreject) options for SOFTFAIL reject (~all)
 + Fix *optstring in getopt(), old options don't work.
 
 Please apply.
 
 --begin patch--
 diff -ruN policyd.old/Makefile policyd/Makefile
 --- policyd.old/Makefile	Wed Dec 22 01:43:31 2004
 +++ policyd/Makefile	Wed Dec 22 15:52:24 2004
 @@ -7,6 +7,7 @@
 
   PORTNAME=		policyd
   PORTVERSION=		1.0.1
 +PORTREVISION=		1
   CATEGORIES=		mail
   MASTER_SITES=		http://www.libspf2.org/patch/
 
 @@ -20,6 +21,12 @@
   CONFIGURE_ENV+=		LDFLAGS="-L${LOCALBASE}/lib"
   GNU_CONFIGURE=		yes
 
 +.include <bsd.port.pre.mk>
 +
 +.if ${OSVERSION} < 500041
 +LIB_DEPENDS+=		gnugetopt.1:${PORTSDIR}/devel/libgnugetopt
 +.endif
 +
   .if !defined(NOPORTDOCS)
   PORTDOCS=	*
   .endif
 @@ -30,4 +37,4 @@
   	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
   .endif
 
 -.include <bsd.port.mk>
 +.include <bsd.port.post.mk>
 diff -ruN policyd.old/files/patch-policyd.c policyd/files/patch-policyd.c
 --- policyd.old/files/patch-policyd.c	Wed Dec 31 21:00:00 1969
 +++ policyd/files/patch-policyd.c	Wed Dec 22 15:56:02 2004
 @@ -0,0 +1,106 @@
 +--- policyd.c.orig	Thu Jul  8 18:42:25 2004
 ++++ policyd.c	Wed Dec 22 15:55:22 2004
 +@@ -76,6 +76,7 @@
 + 	char	*localpolicy;
 + 	char	*explanation;
 + 	int		 trustedforwarder;
 ++	int		 softfailreject;
 + 	int		 debug;
 + } config_t;
 +
 +@@ -106,6 +107,7 @@
 + static const struct option	longopts[] = {
 + 		{ "localpolicy",		required_argument,	NULL, 'l', },
 + 		{ "trustedforwarder",	no_argument,		NULL, 't', },
 ++		{ "softfailreject",	no_argument,		NULL, 's', },
 + 		{ "explanation",		required_argument,	NULL, 'x', },
 + 		{ "debug",				optional_argument,	NULL, 'd', },
 + 		{ "help",				no_argument,		NULL, 'h', },
 +@@ -119,7 +121,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 @@
 + 			"Set the SPF local policy.", 21, 10);
 + 	DOC_OPT('t', "trustedforwarder", NULL,
 + 			"Use the trusted-forwarder.com whitelist.", 29, 13);
 ++	DOC_OPT('s', "softfailreject", NULL,
 ++			"Reject SOFTFAIL.", 29, 15);
 + 	DOC_OPT('x', "explanation", "<explanation>",
 + 			"Set the SPF explanation.", 16, 5);
 +-	DOC_OPT('d', "debug", "[<level>]",
 +-			"Set the debug level.", 20, 15);
 ++	DOC_OPT('d', "debug", "<level>",
 ++			"Set the debug level.", 22, 17);
 + 	DOC_OPT('h', "help", NULL,
 + 			"Display this help.", 29, 25);
 + }
 +@@ -249,7 +253,7 @@
 + }
 +
 + static void
 +-process_request(request_t *req)
 ++process_request(request_t *req, config_t *conf)
 + {
 + 	SPF_output_t	output;
 +
 +@@ -287,6 +291,16 @@
 + 								: ""));
 + 			break;
 + 		case SPF_RESULT_SOFTFAIL:
 ++			if (conf->softfailreject == 1) {
 ++				snprintf(req->result, RESULTSIZE,
 ++							POSTFIX_REJECT " %s",
 ++							(output.smtp_comment
 ++								? output.smtp_comment
 ++								: (output.header_comment
 ++									? output.header_comment
 ++									: "")));
 ++				break;
 ++			}
 + 		case SPF_RESULT_NEUTRAL:
 + 		case SPF_RESULT_UNKNOWN:
 + 		case SPF_RESULT_NONE:
 +@@ -315,6 +329,11 @@
 + 		argv0 = argv[0];
 +
 +
 ++	config.localpolicy = NULL;
 ++	config.explanation = NULL;
 ++	config.trustedforwarder = 0;
 ++	config.softfailreject = 0;
 ++	config.debug = 0;
 + 	while ((c =
 + #ifdef HAVE_GETOPT_LONG
 + 		getopt_long(argc, argv, shortopts, longopts, &idx)
 +@@ -329,12 +348,15 @@
 + 			case 't':
 + 				config.trustedforwarder = 1;
 + 				break;
 ++			case 's':
 ++				config.softfailreject = 1;
 ++				break;
 + 			case 'x':
 + 				config.explanation = optarg;
 + 				break;
 + 			case 'd':
 + 				if (optarg)
 +-					config.debug = atol(optarg);
 ++					config.debug = atoi(optarg);
 + 				else
 + 					config.debug = 1;
 + 				break;
 +@@ -366,7 +388,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);
 --end path--
 
 -- 
 Marcus Grando
 Grupos Internet S/A
 marcus(at)corp.grupos.com.br
State-Changed-From-To: open->closed 
State-Changed-By: edwin 
State-Changed-When: Wed Dec 22 21:07:56 GMT 2004 
State-Changed-Why:  
Committed, thanks! 
I have used USE_GETOPT_LONG instead of the LIB_DEPENDS, but that 
does do the same. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=75386 
>Unformatted:
