diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-06-12 11:08:22 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-06-12 11:15:51 +0300 |
commit | f5c72b5e74ea7aaf1375f763f977e3249c6b7fc4 (patch) | |
tree | 22efbd43e8215666e7d7391193e4030d4354342e /src/comp.c | |
parent | 07e7ee3d732b60e0b7f5b242bbfb0cdec8e99e7f (diff) | |
download | pies-f5c72b5e74ea7aaf1375f763f977e3249c6b7fc4.tar.gz pies-f5c72b5e74ea7aaf1375f763f977e3249c6b7fc4.tar.bz2 |
Check accept components and inet built-in services.
* src/comp.c (component_verify,component_finish): Fix check for
the presense of the "command" statement.
* src/pies.c (component_keywords): Reorder some entries for
the consistency of config-help output.
* tests/.gitignore: Add new files.
* tests/Makefile.am: Add new tests and noinst programs.
* tests/accept.at: New test.
* tests/builtin.at: New test.
* tests/chargen.c: New file.
* tests/readtime.c: New file.
* tests/recvfd.c: Rewrite for testing both accept and pass-fd components.
* tests/passfd.at: Pass -s option to recvfd
* tests/testsuite.at: Add new tests.
* tests/lines.c: Minor changes.
* tests/nt.c: Minor changes.
* tests/to.c: Minor changes.
Diffstat (limited to 'src/comp.c')
-rw-r--r-- | src/comp.c | 44 |
1 files changed, 17 insertions, 27 deletions
@@ -595,10 +595,9 @@ component_verify (struct component *comp, grecs_locus_t *locus) "%s", _("\"internal\" used with \"command\"")); } } - else if (!comp->argv) - COMPERR (grecs_error, - "%s", _("missing command line")); - + else if (!comp->command) + COMPERR (grecs_error, "%s", _("no 'command' statement")); + if (ISCF_TCPMUX (comp->flags)) { comp->mode = pies_comp_inetd; @@ -736,9 +735,8 @@ component_verify (struct component *comp, grecs_locus_t *locus) void component_finish (struct component *comp, grecs_locus_t *locus) { - if (!comp->command) + if (component_verify (comp, locus)) { - grecs_error (locus, 0, "%s", _("no 'command' statement")); component_free (comp); return; } @@ -752,7 +750,7 @@ component_finish (struct component *comp, grecs_locus_t *locus) comp->argv[2] = grecs_strdup (comp->command); comp->argv[3] = NULL; } - else + else if (comp->command) { struct wordsplit ws; if (wordsplit (comp->command, &ws, WRDSF_DEFFLAGS)) @@ -773,29 +771,21 @@ component_finish (struct component *comp, grecs_locus_t *locus) if (comp->privs.groups) comp->privs.groups->cmp = list_str_cmp; - if (component_verify (comp, locus)) + if (grecs_list_size (comp->prereq) == 1) { - component_free (comp); - } - else - { - size_t n = grecs_list_size (comp->prereq); - if (n == 1) + const char *item = grecs_list_index (comp->prereq, 0); + if (strcmp (item, "all") == 0) { - const char *item = grecs_list_index (comp->prereq, 0); - if (strcmp (item, "all") == 0) - { - struct component *p; + struct component *p; - grecs_list_clear (comp->prereq); - for (p = comp->prev; p; p = p->prev) - grecs_list_push (comp->prereq, grecs_strdup (comp->tag)); - } - else if (strcmp (item, "none") == 0) - { - grecs_list_free (comp->prereq); - comp->prereq = NULL; - } + grecs_list_clear (comp->prereq); + for (p = comp->prev; p; p = p->prev) + grecs_list_push (comp->prereq, grecs_strdup (comp->tag)); + } + else if (strcmp (item, "none") == 0) + { + grecs_list_free (comp->prereq); + comp->prereq = NULL; } } } |