aboutsummaryrefslogtreecommitdiff
path: root/src/inetd.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-11-24 21:19:56 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-11-24 21:19:56 +0200
commit534098c3d35f36ab9d333fb0ee800c7ffaf0dcbd (patch)
tree5e8ed3f413000e73f8ff00286e1615f2408e9c37 /src/inetd.c
parenta7779d56bb758157e122a420a56f2d7b4475e554 (diff)
downloadpies-534098c3d35f36ab9d333fb0ee800c7ffaf0dcbd.tar.gz
pies-534098c3d35f36ab9d333fb0ee800c7ffaf0dcbd.tar.bz2
Implement inetd builtin services.
* src/inetd-bi.c: New file. * src/Makefile.am (pies_SOURCES): Add inetd-bi.c. * src/pies.h (struct component): New member `builtin'. (qotdfile): New extern. (inetd_builtin): New struct. (inetd_builtin_lookup): New proto. * src/progman.c (prog_start): Handle internal services. * src/inetd.c (inetd_conf_file): Handle internal services. * src/pies.c (qotdfile): New global. (pies_keywords): New keyword "qotd-file".
Diffstat (limited to 'src/inetd.c')
-rw-r--r--src/inetd.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/inetd.c b/src/inetd.c
index 270425d..f6c8276 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -68,7 +68,8 @@ inetd_conf_file (const char *file)
char *address;
char *service;
size_t len;
-
+ struct inetd_builtin *builtin;
+
if (line_no)
wordsplit_free (&ws);
@@ -182,7 +183,21 @@ inetd_conf_file (const char *file)
group = ws.ws_wordv[IFLD_USER] + len + 1;
}
user = ws.ws_wordv[IFLD_USER];
-
+
+ /* Is it a built-in? */
+ if (strcmp (ws.ws_wordv[IFLD_SERVER_PATH], "internal") == 0)
+ {
+ builtin = inetd_builtin_lookup (service, socket_type);
+ if (!builtin)
+ {
+ logmsg (LOG_ERR, "%s:%lu: %s",
+ file, line_no, _("unknown built-in"));
+ continue;
+ }
+ }
+ else
+ builtin = NULL;
+
/* Create the component */
if (address)
{
@@ -195,12 +210,18 @@ inetd_conf_file (const char *file)
}
else
comp = component_create (service);
-
+
comp->mode = pies_comp_inetd;
comp->socket_type = socket_type;
comp->socket_url = url;
comp->max_rate = max_rate;
- comp->flags = flags;
+ if (builtin)
+ {
+ comp->builtin = builtin;
+ comp->flags = builtin->flags;
+ }
+ else
+ comp->flags = flags;
comp->privs.user = xstrdup (user); /* FIXME: memory leak */
if (group)
{

Return to:

Send suggestions and report system problems to the System administrator.