aboutsummaryrefslogtreecommitdiff
path: root/src/pies.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-11-28 12:09:15 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-11-28 13:15:51 +0200
commit36a53f1875a097fa16bceaf674dc627d916651df (patch)
treeee33a5cf08231f11a3b31e0f16652229d5add561 /src/pies.h
parent69bc6e88c7babf356efbacbdc2230de407c27590 (diff)
downloadpies-36a53f1875a097fa16bceaf674dc627d916651df.tar.gz
pies-36a53f1875a097fa16bceaf674dc627d916651df.tar.bz2
Handle per-tcpmux ACL's. Optionally pass socket data via environment variables.
* src/inetd-bi.c (tcpmux): Consult the component's ACL before deciding whether to handle the connection. * src/pies.c (str_to_socket_type): Rewrite using strtotok. (socket_type_to_str): New function (str_to_cf): New flags: sockenv and resolve. Use strtotok. (main): Log_tag defaults to program instance name. * src/pies.h: Include socket-related headers. (CF_SOCKENV, CF_RESOLVE): New flags. (pies_sockaddr_storage): New union. (check_acl): New proto. (progman_run_comp): Change signature. (socket_type_to_str): New proto. * src/progman.c (struct prog): New members sa_storage, sa_len. (prog_sockenv): New function. (progman_run_comp): Call prog_sockenv. Initialize sa_storage and sa_len of the created struct prog. (prog_start): Call prog_sockenv. Do not close 2 if logging to stderr. (check_acl): Remove static. (_prog_accept): Use union pies_sockaddr_storage. Pass socket address in pinst->v.p.sa_storage and pinst->v.p.sa_len. (sockenv_hint, envsize): New variables. (add_env): New function. (env_setup): Remove. (environ_setup): New function. * src/socket.c: Remove unnecessary includes.
Diffstat (limited to 'src/pies.h')
-rw-r--r--src/pies.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/pies.h b/src/pies.h
index 4d2f774..d6347ce 100644
--- a/src/pies.h
+++ b/src/pies.h
@@ -23,6 +23,10 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <netinet/in.h>
+#include <sys/un.h>
+#include <arpa/inet.h>
+#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -139,10 +143,16 @@ enum pies_comp_mode
#define CF_DISABLED 0x01 /* The componenet is disabled */
#define CF_PRECIOUS 0x02 /* The component is precious (should not
be disabled) */
-#define CF_WAIT 0x04
-#define CF_TCPMUX 0x08
-#define CF_TCPMUXPLUS 0x10
-#define CF_INTERNAL 0x20
+#define CF_WAIT 0x04 /* Wait for the component instance to
+ terminate. */
+#define CF_TCPMUX 0x08 /* A plain TCPMUX service */
+#define CF_TCPMUXPLUS 0x10 /* A TCPMUX-plus service, i.e. pies
+ must emit a '+' response before starting
+ it */
+#define CF_INTERNAL 0x20 /* An internal inetd service */
+#define CF_SOCKENV 0x40 /* Component wants socket information in
+ the environment */
+#define CF_RESOLVE 0x80 /* Resolve IP addresses */
#define ISCF_TCPMUX(f) ((f) & (CF_TCPMUX | CF_TCPMUXPLUS))
@@ -187,6 +197,13 @@ struct component
struct action act_temp; /* Auxiliary object used during configuration */
};
+union pies_sockaddr_storage
+{
+ struct sockaddr s;
+ struct sockaddr_in s_in;
+ struct sockaddr_un s_un;
+};
+
extern char *log_tag;
extern int log_facility;
extern unsigned long shutdown_timeout;
@@ -217,11 +234,13 @@ struct component *progman_lookup_component (const char *tag);
struct component *progman_lookup_tcpmux (const char *service,
const char *master);
-void progman_run_comp (struct component *comp, int fd);
+void progman_run_comp (struct component *comp, int fd,
+ union pies_sockaddr_storage *sa, socklen_t salen);
void progman_iterate_comp (int (*fun) (struct component *, void *),
void *data);
+int check_acl (pies_acl_t acl, struct sockaddr *s, socklen_t salen);
void log_setup (int want_stderr);
void signal_setup (RETSIGTYPE (*sf)(int));
@@ -247,6 +266,7 @@ int assert_grecs_value_type (grecs_locus_t *locus,
const grecs_value_t *value, int type);
int str_to_socket_type (const char *str, int *pret);
+int socket_type_to_str (int socket_type, const char **pres);
struct component *component_create (const char *name);

Return to:

Send suggestions and report system problems to the System administrator.