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
This commit is contained in:
parent
ac6edff45f
commit
2ec2c64187
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301243
@ -1,6 +1,8 @@
|
|||||||
# @(#)Makefile 8.1 (Berkeley) 6/4/93
|
# @(#)Makefile 8.1 (Berkeley) 6/4/93
|
||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
|
.include <src.opts.mk>
|
||||||
|
|
||||||
PROG= fingerd
|
PROG= fingerd
|
||||||
LIBADD= util
|
LIBADD= util
|
||||||
MAN= fingerd.8
|
MAN= fingerd.8
|
||||||
@ -8,4 +10,10 @@ MAN= fingerd.8
|
|||||||
WARNS?= 2
|
WARNS?= 2
|
||||||
WFORMAT=0
|
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>
|
.include <bsd.prog.mk>
|
||||||
|
@ -57,6 +57,9 @@ static const char rcsid[] =
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "pathnames.h"
|
#include "pathnames.h"
|
||||||
|
#ifdef USE_BLACKLIST
|
||||||
|
#include <blacklist.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void logerr(const char *, ...) __printflike(1, 2) __dead2;
|
void logerr(const char *, ...) __printflike(1, 2) __dead2;
|
||||||
|
|
||||||
@ -153,12 +156,18 @@ main(int argc, char *argv[])
|
|||||||
*ap = strtok(lp, " \t\r\n");
|
*ap = strtok(lp, " \t\r\n");
|
||||||
if (!*ap) {
|
if (!*ap) {
|
||||||
if (secure && ap == &av[4]) {
|
if (secure && ap == &av[4]) {
|
||||||
|
#ifdef USE_BLACKLIST
|
||||||
|
blacklist(1, STDIN_FILENO, "nousername");
|
||||||
|
#endif
|
||||||
puts("must provide username\r\n");
|
puts("must provide username\r\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (secure && strchr(*ap, '@')) {
|
if (secure && strchr(*ap, '@')) {
|
||||||
|
#ifdef USE_BLACKLIST
|
||||||
|
blacklist(1, STDIN_FILENO, "noforwarding");
|
||||||
|
#endif
|
||||||
puts("forwarding service denied\r\n");
|
puts("forwarding service denied\r\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -197,6 +206,9 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
dup2(STDOUT_FILENO, STDERR_FILENO);
|
dup2(STDOUT_FILENO, STDERR_FILENO);
|
||||||
|
|
||||||
|
#ifdef USE_BLACKLIST
|
||||||
|
blacklist(0, STDIN_FILENO, "success");
|
||||||
|
#endif
|
||||||
execv(prog, comp);
|
execv(prog, comp);
|
||||||
write(STDERR_FILENO, prog, strlen(prog));
|
write(STDERR_FILENO, prog, strlen(prog));
|
||||||
#define MSG ": cannot execute\n"
|
#define MSG ": cannot execute\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user