aboutsummaryrefslogtreecommitdiff
path: root/src/inetd-bi.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-11-26 21:49:15 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-11-26 21:49:15 +0200
commit9de9182e3517c677e2309b0dd58ab4e3af1b3176 (patch)
treea8d2f33ee720591be9212b9cc6a33a5b018f60bd /src/inetd-bi.c
parentc0802ebe4ebd7e7bb173c6efa2c6e59dd5440cc3 (diff)
downloadpies-9de9182e3517c677e2309b0dd58ab4e3af1b3176.tar.gz
pies-9de9182e3517c677e2309b0dd58ab4e3af1b3176.tar.bz2
Implement internal inetd services in the pies config.
* src/pies.h (CF_INTERNAL): New flag. (ISCF_TCPMUX): New macro. (struct component): Reorder fields. New field: tcpmux. (progman_lookup_service): Remove proto. (progman_lookup_tcpmux): New proto. (struct inetd_builtin.foo): Change signature. All uses updated. * src/progman.c (progman_lookup_service): Remove. (progman_lookup_tcpmux): New function. (progman_create_sockets): Skip tcpmux subservices. (progman_start): Skip disabled inetd components. * src/inetd-bi.c (tcpmux): Use progman_lookup_tcpmux. * src/inetd.c (tcpmux_service, mktag): New functions. (inetd_conf_file): Minor changes. * src/pies.c (_cb_bitmask, _cb_precious) (_cb_disabled, _cb_wait): Remove. (str_to_cf, _cb_flags): New functions. (component_keywords): Remove keywords: disable, precious, wait. Add keywords: flags, service, tcpmux-master. (component_verify): Improve. * src/url.c (pies_url_destroy): Fix coredump on NULL argument.
Diffstat (limited to 'src/inetd-bi.c')
-rw-r--r--src/inetd-bi.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/inetd-bi.c b/src/inetd-bi.c
index 60e6fb5..30423de 100644
--- a/src/inetd-bi.c
+++ b/src/inetd-bi.c
@@ -21,7 +21,7 @@
/* Echo protocol, RFC 862 */
static void
-echo_stream (int fd)
+echo_stream (int fd, struct component const *comp)
{
int rc;
char buffer[INTBUFSIZE];
@@ -32,7 +32,7 @@ echo_stream (int fd)
}
static void
-echo_dg (int fd)
+echo_dg (int fd, struct component const *comp)
{
int rc;
char buffer[INTBUFSIZE];
@@ -47,7 +47,7 @@ echo_dg (int fd)
/* Discard protocol, RFC 863 */
static void
-discard_stream (int fd)
+discard_stream (int fd, struct component const *comp)
{
int rc;
char buffer[INTBUFSIZE];
@@ -62,7 +62,7 @@ discard_stream (int fd)
}
static void
-discard_dg (int fd)
+discard_dg (int fd, struct component const *comp)
{
char buffer[INTBUFSIZE];
read (fd, buffer, sizeof buffer);
@@ -90,14 +90,14 @@ time_since_1900 (void)
}
static void
-time_stream (int fd)
+time_stream (int fd, struct component const *comp)
{
unsigned long result = time_since_1900 ();
write (fd, (char *) &result, sizeof result);
}
static void
-time_dg (int fd)
+time_dg (int fd, struct component const *comp)
{
unsigned long result;
struct sockaddr sa;
@@ -111,7 +111,7 @@ time_dg (int fd)
/* Daytime Protocol, RFC 867 */
static void
-daytime_stream (int fd)
+daytime_stream (int fd, struct component const *comp)
{
char buffer[27];
time_t now;
@@ -122,7 +122,7 @@ daytime_stream (int fd)
}
static void
-daytime_dg (int fd)
+daytime_dg (int fd, struct component const *comp)
{
char buffer[27];
time_t now;
@@ -160,7 +160,7 @@ chargen_next_line (char *text)
}
static void
-chargen_stream (int fd)
+chargen_stream (int fd, struct component const *comp)
{
char text[LINESIZ + 2];
@@ -176,7 +176,7 @@ chargen_stream (int fd)
}
static void
-chargen_dg (int fd)
+chargen_dg (int fd, struct component const *comp)
{
struct sockaddr sa;
socklen_t size = sizeof sa;
@@ -247,7 +247,7 @@ qotd_read (char *text)
}
static void
-qotd_stream (int fd)
+qotd_stream (int fd, struct component const *comp)
{
char text[QOTD_MAX];
size_t len = qotd_read (text);
@@ -255,7 +255,7 @@ qotd_stream (int fd)
}
static void
-qotd_dg (int fd)
+qotd_dg (int fd, struct component const *comp)
{
char text[QOTD_MAX];
struct sockaddr sa;
@@ -306,7 +306,7 @@ tcpmux_help (struct component *comp, void *data)
{
int *pfd = data;
- if (comp->flags & (CF_TCPMUXPLUS | CF_TCPMUX))
+ if (!(comp->flags & CF_DISABLED) && ISCF_TCPMUX (comp->flags))
{
fd_write (*pfd, comp->service);
fd_write (*pfd, "\r\n");
@@ -315,11 +315,11 @@ tcpmux_help (struct component *comp, void *data)
}
static void
-tcpmux (int fd)
+tcpmux (int fd, struct component const *comp)
{
char service[MAX_SERV_LEN + 1];
size_t len;
- struct component *comp;
+ struct component *srv_comp;
/* Read service name */
if ((len = fd_getline (fd, service, MAX_SERV_LEN)) < 0)
@@ -337,17 +337,17 @@ tcpmux (int fd)
return;
}
- comp = progman_lookup_service (service);
- if (!comp)
+ srv_comp = progman_lookup_tcpmux (service, comp->tag);
+ if (!srv_comp)
{
fd_write (fd, "-Service not available\r\n");
return;
}
- if (comp->flags & CF_TCPMUXPLUS)
+ if (srv_comp->flags & CF_TCPMUXPLUS)
fd_write (fd, "+Go\r\n");
- progman_run_comp (comp, fd);
+ progman_run_comp (srv_comp, fd);
}

Return to:

Send suggestions and report system problems to the System administrator.