creating a new environment variable in Apache

creating a new environment variable in Apache

Post by Greg Whit » Sun, 16 Nov 1997 04:00:00



I would like to create a new environment varible for Apache 1.2.6 to
hold the sent password so I can pass this to a PERL script. Has anyone
tried this successfully before? I am assuming this would be done in
mod_auth.c. Any suggestions?

Regards,
Greg White

 
 
 

creating a new environment variable in Apache

Post by Michael Fu » Sun, 16 Nov 1997 04:00:00



> I would like to create a new environment varible for Apache 1.2.6 to

Apache 1.2.6?  As far as I know, 1.2.4 and 1.3b2 are the latest (with
1.3b3 due soon).

Quote:> hold the sent password so I can pass this to a PERL script. Has anyone
> tried this successfully before? I am assuming this would be done in
> mod_auth.c. Any suggestions?

If you're using mod_perl, you can get the password with
$r->get_basic_auth_pw.  I haven't hacked the Apache code much,
but adding something like this to add_common_vars() in util_script.c
might work:

    char *sent_pw;
    int res;
    ...
    res = get_basic_auth_pw(r, &sent_pw);
    if (res == OK) {
        table_set(e, "REMOTE_PASSWORD", sent_pw);
    }

Someone please correct me if this is wrong.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/

 
 
 

creating a new environment variable in Apache

Post by Stunt Po » Fri, 21 Nov 1997 04:00:00



Quote:

>I would like to create a new environment varible for Apache 1.2.6 to
>hold the sent password so I can pass this to a PERL script. Has anyone
>tried this successfully before? I am assuming this would be done in
>mod_auth.c. Any suggestions?

Here I go on about PHP again.... :)

anyways, you can do it with php/fi, if you dispense with the server's auth
methods and mimic it with php calls. I'm going from memory here `cause
I'm at home over a slow connect, but it's covered in the docs, and the
variables in question are PHP_AUTH_USER and PHP_AUTH_PASSWD.

regards, markjr

--
|||| mark jeftovic    (MJ177)   |||||  http://www.shmooze.net/~markjr     ||||
|||| p r i v a t e    w o r l d |||||  http://www.PrivateWorld.com        ||||
------------------------------------------------------------------------------
irc: L-bOMb drop by my office sometime: #bofh on NewNet. PGP Key on Web Page.

 
 
 

1. Creating & exporting environment variables in C


Putenv() will only modify the running process' environment; children do
not inherit this modified environment because putenv() avoids 'environ'.
I find this to be quite the pain, and therefore use a set of functions to
manipulate token lists (that just *happen* to look like an environment
list :-)  They are:

        inittok(tab,env)        initialize a token table
        puttok(tab,buf)         put a token in the table
        gettok(tab,buf)         get a token from the table
        rmtok(tab,buf)          remove a token from the table

Then, whenever you use an exec() use the execle() or execve() flavor, ie:

        execle("/bin/ls","ls",NULL,tab);

The added advantage is that you can create and manipulate more than one
token table, thereby allowing you to fudge with the environment in many
creative ways ...

If you want a copy of the functions, just send me mail at uunet!bria!mike
and I'll send 'em back shar'd.  Of course, this goes for anyone ...

-----------------------------------------------------------------------------
Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation
UUCP: ...!uunet!bria!mike
"If it was hard to code, it should be harder to use!"

2. Quick shell script question

3. How do I create my own environment variables when using CGI?

4. Why can't I link BMRT-libs ?

5. creating environment variables

6. Any risk in opening port 113 to mail server behind firewall?

7. Why does the cgi environment not inherit environment variables?

8. Help on directing the o/p of CDROM to inbuilt speaker

9. how to export shell environment variables to the primary environment?

10. Where to add new Environment variables for all users

11. How to add new environment variable to web server

12. Dynamically setting environment variables on apache startup?

13. Apache 1.3.1: inconsistency with environment variables?