summaryrefslogtreecommitdiff
path: root/server/include
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2023-06-13 23:46:02 -0500
committerDanny Holman <dholman@gymli.org>2023-06-13 23:46:02 -0500
commitac63c0965a7f23ba0cc74688c7e1fc0cde4b654d (patch)
tree0475dcbff64f2cd5a48c3754593b426295f9dd12 /server/include
parentca7f320b9a7ae56982d50240fc0ee5ce4b9aea89 (diff)
server: mark the worker socket as non-blocking
Mark the socket in the worker function as non-blocking and run poll(). This should be done in order to prevent a slow loris attack on the C&C server. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'server/include')
-rw-r--r--server/include/mini-rat.h12
-rw-r--r--server/include/server.h4
2 files changed, 16 insertions, 0 deletions
diff --git a/server/include/mini-rat.h b/server/include/mini-rat.h
index 8c9aad3..9230ab2 100644
--- a/server/include/mini-rat.h
+++ b/server/include/mini-rat.h
@@ -25,6 +25,14 @@
#include <arpa/inet.h>
#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
+
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
@@ -57,6 +65,10 @@
#include <time.h>
#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
diff --git a/server/include/server.h b/server/include/server.h
index 26f9c42..b8f4fd7 100644
--- a/server/include/server.h
+++ b/server/include/server.h
@@ -5,7 +5,11 @@
void* control_listener(void *port);
void* control_worker(void *sock_desc);
+
void* listener(void *port);
void* worker(void *sock_desc);
+ssize_t output_pump(int sock, char *buffer, size_t sz);
+ssize_t input_pump(int sock, char *buffer, size_t sz);
+
#endif