mirror of
https://github.com/troglobit/finit.git
synced 2026-10-21 11:29:42 +00:00
Add protection against UDP inetd looping attacks
This patch adds protection against a common inetd attack vector wherein the reply port to UDP inetd services is forged to an internal inetd service port. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
5723b2e75b
commit
7dfdc2395b
8 files changed
+70
-6
No files matched your search
+7
-1
@@ -28,6 +28,9 @@
|
||||
|
||||
#include "../plugin.h"
|
||||
|
||||
#define NAME "daytime"
|
||||
|
||||
|
||||
static char *daytime(char *buf, size_t len)
|
||||
{
|
||||
time_t t;
|
||||
@@ -48,6 +51,9 @@ static int recv_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, sockle
|
||||
if (-1 == len)
|
||||
return -1; /* On error, close connection. */
|
||||
|
||||
if (inetd_check_loop(sa, *sa_len, NAME))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -72,7 +78,7 @@ static int cb(int type)
|
||||
}
|
||||
|
||||
static plugin_t plugin = {
|
||||
.name = "daytime", /* Must match the inetd /etc/services entry */
|
||||
.name = NAME, /* Must match the inetd /etc/services entry */
|
||||
.inetd = {
|
||||
.cmd = cb
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user