diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config/lexparse.c | 4 | ||||
-rw-r--r-- | src/config/tipidee-config-internal.h | 2 | ||||
-rw-r--r-- | src/config/tipidee-config-preprocess.c | 4 | ||||
-rw-r--r-- | src/config/tipidee-config.c | 7 | ||||
-rw-r--r-- | src/tipideed/tipideed.c | 6 |
5 files changed, 11 insertions, 12 deletions
diff --git a/src/config/lexparse.c b/src/config/lexparse.c index a7ed5b2..da9d7f5 100644 --- a/src/config/lexparse.c +++ b/src/config/lexparse.c @@ -99,7 +99,7 @@ static inline void parse_global (char const *s, size_t const *word, size_t n, md { .name = "verbosity", .key = "G:verbosity", .type = 0 }, { .name = "write_timeout", .key = "G:write_timeout", .type = 0 } } ; - struct globalkey_s *gl ; + struct globalkey_s const *gl ; if (n < 2) strerr_dief8x(1, "too ", "few", " arguments to directive ", "global", " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ; gl = bsearch(s + word[0], globalkeys, sizeof(globalkeys)/sizeof(struct globalkey_s), sizeof(struct globalkey_s), &globalkey_cmp) ; @@ -194,7 +194,7 @@ static inline void parse_redirect (char const *s, size_t const *word, size_t n, static void parse_bitattr (char const *s, size_t const *word, size_t n, char const *domain, size_t domainlen, mdt const *md, unsigned int bit, int set) { - static char const *attr[3][2] = { { "noncgi", "cgi" }, { "nonnph", "nph", }, { "noauth", "basic-auth" } } ; + static char const *const attr[3][2] = { { "noncgi", "cgi" }, { "nonnph", "nph", }, { "noauth", "basic-auth" } } ; uint8_t mask = (uint8_t)0x01 << bit ; if (n != 1) strerr_dief8x(1, "too ", n > 1 ? "many" : "few", " arguments to directive ", attr[bit][set], " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ; diff --git a/src/config/tipidee-config-internal.h b/src/config/tipidee-config-internal.h index e274f94..154c6ff 100644 --- a/src/config/tipidee-config-internal.h +++ b/src/config/tipidee-config-internal.h @@ -35,8 +35,6 @@ extern struct global_s g ; extern void confnode_start (confnode *, char const *, size_t, uint32_t) ; extern void confnode_add (confnode *, char const *, size_t) ; -#define confnode_adds(node, s) confnode_add(node, (s), strlen(s)) -#define confnode_add0(node) confnode_add((node), "", 1) /* conftree */ diff --git a/src/config/tipidee-config-preprocess.c b/src/config/tipidee-config-preprocess.c index 6ac4812..03b54f1 100644 --- a/src/config/tipidee-config-preprocess.c +++ b/src/config/tipidee-config-preprocess.c @@ -206,9 +206,11 @@ static void includefromhere (char const *file) switch (cmd) { case 2 : + if (namesa.s[d] & 2) + strerr_dief5x(3, "in ", namesa.s + d + 1, " line ", linefmt, ": extra !included: directive") ; if (!strcmp(sa.s + sastart, "unique")) namesa.s[d] |= 3 ; else if (!strcmp(sa.s + sastart, "multiple")) namesa.s[d] |= 2 ; - else strerr_dief6x(3, "in ", namesa.s + d + 1, " line ", linefmt, "invalid !included: argument: ", sa.s + sastart) ; + else strerr_dief6x(3, "in ", namesa.s + d + 1, " line ", linefmt, ": invalid !included: argument: ", sa.s + sastart) ; break ; case 1 : case 0 : diff --git a/src/config/tipidee-config.c b/src/config/tipidee-config.c index be13e39..36b1c03 100644 --- a/src/config/tipidee-config.c +++ b/src/config/tipidee-config.c @@ -52,11 +52,6 @@ static inline void conf_output (char const *ofile, unsigned int omode) memcpy(otmp + olen, ":XXXXXX", 8) ; fdw = mkstemp(otmp) ; if (fdw == -1) strerr_diefu3sys(111, "open ", otmp, " for writing") ; - if (coe(fdw) == -1) - { - unlink_void(otmp) ; - strerr_diefu2sys(111, "coe ", otmp) ; - } if (!cdbmake_start(&cm, fdw)) { unlink_void(otmp) ; @@ -77,7 +72,7 @@ static inline void conf_output (char const *ofile, unsigned int omode) unlink_void(otmp) ; strerr_diefu2sys(111, "fsync ", otmp) ; } - if (fchmod(fdw, omode & 0755) == -1) + if (fchmod(fdw, omode & 0777) == -1) { unlink_void(otmp) ; strerr_diefu2sys(111, "fchmod ", otmp) ; diff --git a/src/tipideed/tipideed.c b/src/tipideed/tipideed.c index 118f33a..f71be9f 100644 --- a/src/tipideed/tipideed.c +++ b/src/tipideed/tipideed.c @@ -30,6 +30,7 @@ #define dieusage() strerr_dieusage(100, USAGE) #define dienomem() strerr_diefu1sys(111, "stralloc_catb") +#define MAX_LOCALREDIRS 32 #define ARGV_MAX 128 struct global_s g = GLOBAL_ZERO ; @@ -367,6 +368,7 @@ int main (int argc, char const *const *argv, char const *const *envp) tipidee_rql rql = TIPIDEE_RQL_ZERO ; tipidee_headers hdr ; int e ; + unsigned int localredirs = 0 ; char const *x ; size_t content_length ; tipidee_transfercoding tcoding = TIPIDEE_TRANSFERCODING_UNKNOWN ; @@ -509,7 +511,9 @@ int main (int argc, char const *const *argv, char const *const *envp) /* And serve the resource. The loop is in case of CGI local-redirection. */ - while (serve(&rql, docroot, hostlen + 1 + g.localportlen, uribuf, &hdr, bodysa.s, bodysa.len)) ; + while (serve(&rql, docroot, hostlen + 1 + g.localportlen, uribuf, &hdr, bodysa.s, bodysa.len)) + if (localredirs++ >= MAX_LOCALREDIRS) + die502x(&rql, 1, "too many local redirections - possible loop involving path ", rql.uri.path) ; } } log_and_exit(0) ; |