Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Sep 2001 13:45:56 -0500 (CDT)
From:      "Scot W. Hetzel" <hetzels@westbend.net>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/30849: news/ntpcache fails compiling authinfo_pam.c, add radius & ldap auth mechanisms.
Message-ID:  <200109261845.f8QIjuY27839@wbiW09.westbend.net>

next in thread | raw e-mail | index | archive | help

>Number:         30849
>Category:       ports
>Synopsis:       news/ntpcache fails compiling authinfo_pam.c, add radius & ldap auth mechanisms.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 26 11:50:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Scot W. Hetzel
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
West Bend Internet
>Environment:
System: FreeBSD wbiW09.westbend.net 4.4-STABLE FreeBSD 4.4-STABLE #0: Fri Sep 21 17:25:03 CDT 2001 root@wbiW09.westbend.net:/usr/obj/usr/src/sys/WBIW09-SMP i386

>Description:

When compiling NNTPCache, I get the following error when compiling
authinfo_pam.c:

cc -DHAVE_CONFIG_H -I. -I. -I.. -I../cf         -I../common     -I../libproff
   -I../libconfused        -I../mmap       -I../libmmalloc    -I../libdbz
   -I/usr/local/include -I/usr/local/include  -O -pipe  -Wall -pipe -ci
   authinfo_pam.c
In file included from /usr/include/security/pam_misc.h:24,
                 from authinfo_pam.c:18:
/usr/include/security/_pam_macros.h:13: syntax error before `('
gmake: *** [authinfo_pam.o] Error 1

>How-To-Repeat:

Try to build news/nntpcache on FreeBSD 4.x.

>Fix:

The fix is to place a #ifndef __FreeBSD__ .. #endif arround
<security/pam_misc.h> in authinfo_pam.c.

The attached patch corrects this problem, and adds additional authentication
functionality to the nntpcache port (RADIUS, LDAP[v1,v2]).

    Changed files:         Makefile

    New files:             files/patch-src-authinfo_ldap.c
                           files/patch-src-authinfo_pam.c

    Removed files:         files/patch-src-authinfo_pam.ext

files/patch-src-authinfo_pam.ext removed due to a post-configure target is
added to the Makefile that recreates the authinfo_[pam,radius,ldap].ext files.

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/news/nntpcache/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- Makefile	2001/09/14 09:47:23	1.19
+++ Makefile	2001/09/26 15:45:33
@@ -16,6 +16,17 @@
 
 #BUILD_DEPENDS=	pgp:${PORTSDIR}/security/pgp
 
+.if defined(WITH_LDAP) && !defined(WITH_LDAP2)
+LIB_DEPENDS+= ldap.1:${PORTSDIR}/net/openldap
+LIB_DEPENDS+= lber.1:${PORTSDIR}/net/openldap
+.endif
+
+.if defined(WITH_LDAP2)
+LIB_DEPENDS+=   ldap.2:${PORTSDIR}/net/openldap2
+LIB_DEPENDS+=   lber.2:${PORTSDIR}/net/openldap2
+.endif
+
+
 # This may be set interactively at install-time.  NNTPCache will
 # cache news articles and related data in ${SPOOLDIR}/nntpcache.
 SPOOLDIR?=	/var/spool
@@ -24,12 +35,38 @@
 USE_GMAKE=	yes
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--localstatedir=${SPOOLDIR}
+
+AUTHINFO_EXT= authinfo_pam.ext
+.if !defined(WITHOUT_RADIUS)
+CONFIGURE_ARGS+= --with-authinfo-radius
+AUTHINFO_EXT+= authinfo_radius.ext
+.endif
+.if defined(WITH_LDAP) || defined(WITH_LDAP2)
+CONFIGURE_ARGS+= --with-authinfo-ldap
+CPPFLAGS+= -I${PREFIX}/include -I/usr/local/include
+LDFLAGS+= -L${PREFIX}/lib -L/usr/local/lib
+AUTHINFO_EXT+= authinfo_ldap.ext
+CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+.endif
+
 NNTPSPOOLDIR?=	${SPOOLDIR}/${PORTNAME}
 PLIST_SUB+=	SPOOLDIR=${NNTPSPOOLDIR}
 CPIO=		cpio --quiet -pdum -R
 MAN8=		nntpcached.8 newshound.8
 DOCS=		AUTHORS ChangeLog FAQ FAQ.html HACKING HTML \
 		INSTALL LICENSING NEWS README README.INN VERSION
+
+.if !defined(BATCH)
+post-fetch:
+	@${ECHO} "To enable LDAP support use either:"
+	@${ECHO} "	WITH_LDAP - LDAP v1 support"
+	@${ECHO} "	WITH_LDAP2 - LDAP v2 support"
+	@${ECHO}
+	@${ECHO} "To disable radius support use WITHOUT_RADIUS"
+.endif
+
+post-configure:
+	@cd ${WRKSRC}/src && ${GMAKE} ${AUTHINFO_EXT}
 
 post-install:
 	@ ${MKDIR} ${PREFIX}/etc/rc.d
Index: files/patch-src-authinfo_ldap.c
===================================================================
RCS file: patch-src-authinfo_ldap.c
diff -N patch-src-authinfo_ldap.c
--- /dev/null	Wed Sep 26 13:01:31 2001
+++ patch-src-authinfo_ldap.c	Wed Sep 26 10:56:39 2001
@@ -0,0 +1,19 @@
+--- src/authinfo_ldap.c.orig	Sat Dec 18 12:08:30 1999
++++ src/authinfo_ldap.c	Wed Sep 26 10:55:27 2001
+@@ -78,7 +78,16 @@
+ 	
+ 	lderr = ldap_bind_s(ld, dnbuf, pass, LDAP_AUTH_SIMPLE);
+ 	if (lderr != LDAP_SUCCESS && lderr != LDAP_INVALID_CREDENTIALS && lderr != LDAP_INAPPROPRIATE_AUTH)
++#if LDAP_API_VERSION >= 2004
++	{
++		int ld_errno = 0;
++		ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
++		logen(("LDAP ERROR: ldap user bind failed (%d): %s", lderr, ldap_err2string(ld_errno)));
++	}
++#else
++
+ 		logen(("LDAP ERROR: ldap user bind failed (%d): %s", lderr, ldap_err2string(GET_LDERROR(ld))));
++#endif
+ 	ldap_unbind(ld);
+ 	memset(pass, strlen(pass), 0);
+ 	if (lderr == LDAP_SUCCESS) {
Index: files/patch-src-authinfo_pam.c
===================================================================
RCS file: patch-src-authinfo_pam.c
diff -N patch-src-authinfo_pam.c
--- /dev/null	Wed Sep 26 13:01:31 2001
+++ patch-src-authinfo_pam.c	Wed Sep 26 12:55:50 2001
@@ -0,0 +1,12 @@
+--- src/authinfo_pam.c.orig	Sun Jun 11 14:32:55 2000
++++ src/authinfo_pam.c	Wed Sep 26 11:27:09 2001
+@@ -15,7 +15,9 @@
+ #include "authinfo_pam.h"
+ 
+ #include <security/pam_appl.h>
++#ifndef __FreeBSD__
+ #include <security/pam_misc.h>
++#endif
+ 
+ /*
+  * pam authenticator.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109261845.f8QIjuY27839>