summaryrefslogtreecommitdiffstats
path: root/support/suexec.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:26 +0000
commit7b31d4f4901cdb89a79f2f7de4a6b8bb637b523b (patch)
treefdeb0b5ff80273f95ce61607fc3613dff0b9a235 /support/suexec.c
parentAdding upstream version 2.4.38. (diff)
downloadapache2-7b31d4f4901cdb89a79f2f7de4a6b8bb637b523b.tar.xz
apache2-7b31d4f4901cdb89a79f2f7de4a6b8bb637b523b.zip
Adding upstream version 2.4.59.upstream/2.4.59upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--support/suexec.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/support/suexec.c b/support/suexec.c
index 0b52495..c2eb0b6 100644
--- a/support/suexec.c
+++ b/support/suexec.c
@@ -127,15 +127,15 @@ static const char *const safe_env_lst[] =
"REDIRECT_STATUS=",
"REDIRECT_URL=",
"REQUEST_METHOD=",
- "REQUEST_URI=",
"REQUEST_SCHEME=",
+ "REQUEST_URI=",
"SCRIPT_FILENAME=",
"SCRIPT_NAME=",
"SCRIPT_URI=",
"SCRIPT_URL=",
+ "SERVER_ADDR=",
"SERVER_ADMIN=",
"SERVER_NAME=",
- "SERVER_ADDR=",
"SERVER_PORT=",
"SERVER_PROTOCOL=",
"SERVER_SIGNATURE=",
@@ -223,7 +223,6 @@ static void log_no_err(const char *fmt,...)
static void clean_env(void)
{
- char pathbuf[512];
char **cleanenv;
char **ep;
int cidx = 0;
@@ -245,8 +244,7 @@ static void clean_env(void)
exit(123);
}
- sprintf(pathbuf, "PATH=%s", AP_SAFE_PATH);
- cleanenv[cidx] = strdup(pathbuf);
+ cleanenv[cidx] = strdup("PATH=" AP_SAFE_PATH);
if (cleanenv[cidx] == NULL) {
log_err("failed to malloc memory for environment\n");
exit(124);
@@ -504,7 +502,8 @@ int main(int argc, char *argv[])
* and setgid() to the target group. If unsuccessful, error out.
*/
if (((setgid(gid)) != 0) || (initgroups(actual_uname, gid) != 0)) {
- log_err("failed to setgid (%lu: %s)\n", (unsigned long)gid, cmd);
+ log_err("failed to setgid/initgroups (%lu: %s): %s\n",
+ (unsigned long)gid, cmd, strerror(errno));
exit(109);
}
@@ -512,13 +511,14 @@ int main(int argc, char *argv[])
* setuid() to the target user. Error out on fail.
*/
if ((setuid(uid)) != 0) {
- log_err("failed to setuid (%lu: %s)\n", (unsigned long)uid, cmd);
+ log_err("failed to setuid (%lu: %s): %s\n",
+ (unsigned long)uid, cmd, strerror(errno));
exit(110);
}
/*
* Get the current working directory, as well as the proper
- * document root (dependant upon whether or not it is a
+ * document root (dependent upon whether or not it is a
* ~userdir request). Error out if we cannot get either one,
* or if the current working directory is not in the docroot.
* Use chdir()s and getcwd()s to avoid problems with symlinked