From owner-svn-src-all@freebsd.org Fri Jun 3 07:00:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B3E2B68848; Fri, 3 Jun 2016 07:00:30 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D23D41813; Fri, 3 Jun 2016 07:00:29 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5370SOW080094; Fri, 3 Jun 2016 07:00:28 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5370Scm080092; Fri, 3 Jun 2016 07:00:28 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201606030700.u5370Scm080092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Fri, 3 Jun 2016 07:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301243 - head/libexec/fingerd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2016 07:00:30 -0000 Author: lidl Date: Fri Jun 3 07:00:28 2016 New Revision: 301243 URL: https://svnweb.freebsd.org/changeset/base/301243 Log: Add blacklist support to fingerd Reviewed by: rpaulo Approved by: rpaulo Relnotes: YES Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5916 Modified: head/libexec/fingerd/Makefile head/libexec/fingerd/fingerd.c Modified: head/libexec/fingerd/Makefile ============================================================================== --- head/libexec/fingerd/Makefile Fri Jun 3 06:58:20 2016 (r301242) +++ head/libexec/fingerd/Makefile Fri Jun 3 07:00:28 2016 (r301243) @@ -1,6 +1,8 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD$ +.include + PROG= fingerd LIBADD= util MAN= fingerd.8 @@ -8,4 +10,10 @@ MAN= fingerd.8 WARNS?= 2 WFORMAT=0 +.if ${MK_BLACKLIST_SUPPORT} != "no" +CFLAGS+= -DUSE_BLACKLIST -I${SRCTOP}/contrib/blacklist/include +LIBADD+= blacklist +LDFLAGS+=-L${LIBBLACKLISTDIR} +.endif + .include Modified: head/libexec/fingerd/fingerd.c ============================================================================== --- head/libexec/fingerd/fingerd.c Fri Jun 3 06:58:20 2016 (r301242) +++ head/libexec/fingerd/fingerd.c Fri Jun 3 07:00:28 2016 (r301243) @@ -57,6 +57,9 @@ static const char rcsid[] = #include #include #include "pathnames.h" +#ifdef USE_BLACKLIST +#include +#endif void logerr(const char *, ...) __printflike(1, 2) __dead2; @@ -153,12 +156,18 @@ main(int argc, char *argv[]) *ap = strtok(lp, " \t\r\n"); if (!*ap) { if (secure && ap == &av[4]) { +#ifdef USE_BLACKLIST + blacklist(1, STDIN_FILENO, "nousername"); +#endif puts("must provide username\r\n"); exit(1); } break; } if (secure && strchr(*ap, '@')) { +#ifdef USE_BLACKLIST + blacklist(1, STDIN_FILENO, "noforwarding"); +#endif puts("forwarding service denied\r\n"); exit(1); } @@ -197,6 +206,9 @@ main(int argc, char *argv[]) } dup2(STDOUT_FILENO, STDERR_FILENO); +#ifdef USE_BLACKLIST + blacklist(0, STDIN_FILENO, "success"); +#endif execv(prog, comp); write(STDERR_FILENO, prog, strlen(prog)); #define MSG ": cannot execute\n"