You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Nicolae Mihalache <ma...@abcpages.com> on 2002/03/25 16:38:07 UTC
adding environment variables from module
Hi!
First of all, this is my first attempt to modify an Apache module.
I'm tring to modify mod_mysql_auth to set some environment variables
that will be used by the CGI scripts and also by the mod_autoindex
(wich I will also modify) to change the output based on the priviledge
of the authenticated user.
my modification goes into mysql_check_auth and is basically:
table *e = r->subprocess_env;
ap_table_setn(e,"SA_PRIV",ap_pstrdup(r->pool, data[0]));
where data[0] is previously obtained from database.
The problem is that "SA_PRIV" environment variable does not show up in
the cgi script. I tried printing all the variables after setting them
and it seems that at that stage the only variables that exists in that
table are mine and UNIQUE_ID. UNIQUE_ID is shown in the cgi script.
Please tell me what I'm doing wrong, isn't r->subprocess_env the correct
table to add environment variables?
Are these things documented somwere?
Thank you,
Nicolae
Re: adding environment variables from module
Posted by Nicolae Mihalache <ma...@abcpages.com>.
Joshua Slive wrote:
> On Mon, 25 Mar 2002, Nicolae Mihalache wrote:
>
>>Any ideea why this one does not show the variables? Is mod_cgi
>>restrictive about the variables it exports to cgi scripts?
>
>
> If you are running suexec, then the environment is cleaned using a
> compile-time "safe list".
>
Indeed, I was running suexec. Now everthing is ok, thank you very much and
sorry I didn't put these stupid questions on users mailing list.
Nicolae
Re: adding environment variables from module
Posted by Joshua Slive <jo...@slive.ca>.
On Mon, 25 Mar 2002, Nicolae Mihalache wrote:
>
> Any ideea why this one does not show the variables? Is mod_cgi
> restrictive about the variables it exports to cgi scripts?
If you are running suexec, then the environment is cleaned using a
compile-time "safe list".
Joshua.
Re: adding environment variables from module
Posted by Nicolae Mihalache <ma...@abcpages.com>.
Ian Holsman wrote:
> Nicolae Mihalache wrote:
>
>> Hi!
>>
>> First of all, this is my first attempt to modify an Apache module.
>> I'm tring to modify mod_mysql_auth to set some environment variables
>> that will be used by the CGI scripts and also by the mod_autoindex
>> (wich I will also modify) to change the output based on the
>> priviledge of the authenticated user.
>> my modification goes into mysql_check_auth and is basically:
>> table *e = r->subprocess_env;
>> ap_table_setn(e,"SA_PRIV",ap_pstrdup(r->pool, data[0]));
>> where data[0] is previously obtained from database.
>
>
> can you do me a favor and try running your page with a ssi-enable page
> with the command <!--#printenv --> in it and see if your note works
> it will then tell us if there is a bug in your module or cgi.
> TIA
> ian
>
I did that, and the variables show up in printenv directive. Very
strange, my
cgi is as simple as that:
#!/bin/sh
echo "Content-Type: text/plain"
echo
echo
env
Any ideea why this one does not show the variables? Is mod_cgi
restrictive about the variables it exports to cgi scripts?
Thank you,
Nicolae