diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-23 23:51:39 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-23 23:57:48 +0200 |
commit | a37a83f6143e672a71ee4436fa24aaa2f9c81877 (patch) | |
tree | c5791a295aebf12bf7865f1c100dc3ee72bbc79b /src/pies.h | |
parent | bb72dbbbbac7806a6321a404ec4c852b63e819b7 (diff) | |
download | pies-a37a83f6143e672a71ee4436fa24aaa2f9c81877.tar.gz pies-a37a83f6143e672a71ee4436fa24aaa2f9c81877.tar.bz2 |
Limit number of connections per socket (IP).
* src/inetd-bi.c (fd_write): Remove. Use fd_report instead.
* src/pies.c (component_keywords): New keywords: max-instances-message,
max-ip-connections, max-ip-connections-message, access-denied-message.
* src/pies.h (struct component): New members: max_ip_connections,
access_denied_message, max_instances_message, max_ip_connections_message.
(fd_report): New extern.
* src/progman.c (conn_class): New struct.
(struct prog.p): New member cclass.
(conn_tab): New static.
(conn_class_lookup, conn_class_report): New functions.
(progman_run_comp): Set cclass.
(fd_report): New function.
(_prog_accept): In case of failure (access denied, etc.)
optionally send response strings over the fd.
Limit number of connections per socket (IP).
(progman_cleanup): Update cclass counter.
Diffstat (limited to 'src/pies.h')
-rw-r--r-- | src/pies.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -177,6 +177,7 @@ struct component /* For inetd components */ size_t max_rate; /* Maximum number of invocations per minute */ + size_t max_ip_connections; /* Max. number of connections per IP address */ int socket_type; /* Socket type */ struct inetd_builtin *builtin; /* Builtin function */ char *service; @@ -189,6 +190,12 @@ struct component become available. */ pies_acl_t acl; char *tcpmux; /* Master service for TCPMUX */ + + /* Optional error messages to be sent back on the socket: */ + char *access_denied_message; + char *max_instances_message; + char *max_ip_connections_message; + /* Redirectors: */ int facility; /* Syslog facility. */ struct redirector redir[2]; /* Repeaters for stdout and stderr */ @@ -239,6 +246,7 @@ void progman_run_comp (struct component *comp, int fd, void progman_iterate_comp (int (*fun) (struct component *, void *), void *data); +void fd_report (int fd, const char *msg); int check_acl (pies_acl_t acl, struct sockaddr *s, socklen_t salen); |