Commit Graph

18 Commits

Author SHA1 Message Date
Omar Polo 52418c8d82 fix various compilation errors
Include gmid.h as first header in every file, as it then includes
config.h (that defines _GNU_SOURCE for instance).

Fix also a warning about unsigned vs signed const char pointers in
openssl.
2021-02-12 12:47:20 +00:00
Omar Polo b63e30ff44 define TLS_CLIENT_NOT_BEFORE/NOT_AFTER in CGI scripts 2021-02-07 21:47:01 +00:00
Omar Polo 9f006a2127 [cgi] split the query in words if needed and add them to the argv 2021-02-07 18:55:04 +00:00
Omar Polo a64959c99a use log_err instead of fprintf 2021-02-07 16:09:49 +00:00
Omar Polo 52053e1a61 ensure CGI stdout it's blocking 2021-02-06 09:56:34 +00:00
Omar Polo ca21e10043 reload configuration on SIGHUP 2021-02-04 13:23:15 +00:00
Omar Polo 4e2e2ab1d3 refactor executor_main
now it's symmetrical to listener_main().
2021-02-03 16:37:53 +00:00
Omar Polo 3e5418099f [cgi] always set some variables 2021-02-01 13:48:23 +00:00
Omar Polo 67528c1f82 don't add the query to argv
FRC3875 says that if the query does not contain any unecnoded "="
characters, we SHOULD treat the query string as a "search-string",
split in on "+" and add every word to the CGI argv.

In launch_cgi it's too late because iri->query is the *decoded* query!

I have in mind some refactoring around how we decode things, so this
is postponed.
2021-02-01 12:28:30 +00:00
Omar Polo 2fafa2d23e bring the CGI implementation in par with GLV-1.12556 2021-02-01 11:11:43 +00:00
Omar Polo 7808978667 fix computed offset
Oh my, this is such a stupid mistake.  It went undiscovered only
because I always used CGI scripts on the first vhost (and hence the
offset would be 0) and never on the others.
2021-02-01 08:38:48 +00:00
Omar Polo 1078229283 unveil x the vhosts directories 2021-01-25 15:02:55 +00:00
Omar Polo 28ec617809 sync the CGI environment with the manpage
while there also add SERVER_PROTOCOL
2021-01-24 10:06:48 +00:00
Omar Polo 0baf6bed2a pass the fd, not the path! 2021-01-24 09:53:54 +00:00
Omar Polo 05748e49fe chdir to the vhost root before exec'ing the CGI script 2021-01-24 09:15:05 +00:00
Omar Polo 710a71b2bb don't leak file descriptors 2021-01-19 18:16:09 +00:00
Omar Polo 568a09c220 fix requri construction
when we switched from one process to two, I introduced a small
optimisation: empty string are not send, so we receive NULL.
Constructing requri we need to make sure that relpath is not null.
2021-01-18 15:25:49 +00:00
Omar Polo 881a9dd9c2 split into two processes: listener and executor
this way, we can sandbox the listener with seccomp (todo) or capsicum
(already done) and still have CGI scripts.  When we want to exec, we
tell the executor what to do, the executor executes the scripts and
send the fd backt to the listener.
2021-01-16 19:41:34 +00:00