summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorlidl <lidl@FreeBSD.org>2016-06-03 07:00:28 +0000
committerlidl <lidl@FreeBSD.org>2016-06-03 07:00:28 +0000
commitdaa291ea42bbe023a4d5092845120f0c83b266ee (patch)
tree35104476776baa40b9f3b1c9cabd098cf3186793 /libexec
parent52b1d47596621575c6aa62c549fb6582623364c5 (diff)
downloadFreeBSD-src-daa291ea42bbe023a4d5092845120f0c83b266ee.zip
FreeBSD-src-daa291ea42bbe023a4d5092845120f0c83b266ee.tar.gz
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
Diffstat (limited to 'libexec')
-rw-r--r--libexec/fingerd/Makefile8
-rw-r--r--libexec/fingerd/fingerd.c12
2 files changed, 20 insertions, 0 deletions
diff --git a/libexec/fingerd/Makefile b/libexec/fingerd/Makefile
index f710173..09f9141 100644
--- a/libexec/fingerd/Makefile
+++ b/libexec/fingerd/Makefile
@@ -1,6 +1,8 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93
# $FreeBSD$
+.include <src.opts.mk>
+
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 <bsd.prog.mk>
diff --git a/libexec/fingerd/fingerd.c b/libexec/fingerd/fingerd.c
index be344d4..485afe5 100644
--- a/libexec/fingerd/fingerd.c
+++ b/libexec/fingerd/fingerd.c
@@ -57,6 +57,9 @@ static const char rcsid[] =
#include <stdlib.h>
#include <string.h>
#include "pathnames.h"
+#ifdef USE_BLACKLIST
+#include <blacklist.h>
+#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"
OpenPOWER on IntegriCloud