From: Micah Andersen Date: Wed, 16 May 2018 16:28:13 +0000 (-0400) Subject: Fix launch of external process on Windows X-Git-Tag: mod_authnz_external-3.3.3~10^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=51de62c186d77fa421af026a8cd95a1e1f86c9e5;p=apache-authnz-external Fix launch of external process on Windows - SystemRoot environment variable is needed for various random things - standard Windows file open dialog - ping command's DNS resolution - php mysqli remote database access - etc. --- diff --git a/mod_authnz_external/mod_authnz_external.c b/mod_authnz_external/mod_authnz_external.c index f03079f..a602d7a 100644 --- a/mod_authnz_external/mod_authnz_external.c +++ b/mod_authnz_external/mod_authnz_external.c @@ -409,7 +409,7 @@ static int exec_external(const char *extpath, const char *extmethod, apr_procattr_t *procattr; apr_proc_t proc; apr_status_t rc= APR_SUCCESS; - char *child_env[12]; + char *child_env[13]; char *child_arg[MAX_ARG+2]; const char *t; int i, status= -4; @@ -471,6 +471,10 @@ static int exec_external(const char *extpath, const char *extmethod, if ((cookie= apr_table_get(r->headers_in, "Cookie")) != NULL) child_env[i++]= apr_pstrcat(p, ENV_COOKIE"=", cookie, NULL); #endif + +#ifdef _WINDOWS + child_env[i++]= apr_pstrcat(r->pool, "SystemRoot=", getenv("SystemRoot"), NULL); +#endif /* NOTE: If you add environment variables, * remember to increase the size of the child_env[] array */