REMOTE_USER ???? Help please

REMOTE_USER ???? Help please

Post by FAST » Sat, 27 Sep 1997 04:00:00



Hi all,

I am trying to get the REMOTE_USER environment variable so i can
query a database for that value, but it is null.

If I do a printenv on one page, it comes up as "ben" but when i write
a simple piece of C code to getenv("REMOTE_USER"); it returns a null
value...

Why is this so?

 
 
 

REMOTE_USER ???? Help please

Post by Marc Slemk » Sat, 27 Sep 1997 04:00:00



Quote:>Hi all,
>I am trying to get the REMOTE_USER environment variable so i can
>query a database for that value, but it is null.
>If I do a printenv on one page, it comes up as "ben" but when i write
>a simple piece of C code to getenv("REMOTE_USER"); it returns a null
>value...
>Why is this so?

Because you aren't requiring authentiation for the script?

How are you requiring authentication?  If you aren't, then the
server won't have a username to put in REMOTE_USER.

Where is the script located?  If it is located in a directory
outside of those you require authentication for, it isn't
going to work.

 
 
 

REMOTE_USER ???? Help please

Post by Rick Milla » Sat, 27 Sep 1997 04:00:00




> >Hi all,

> >I am trying to get the REMOTE_USER environment variable so i can
> >query a database for that value, but it is null.

> >If I do a printenv on one page, it comes up as "ben" but when i write
> >a simple piece of C code to getenv("REMOTE_USER"); it returns a null
> >value...

> >Why is this so?

> Because you aren't requiring authentiation for the script?

I don't believe that you need to require authentication for the script itself.  Once a
user authenticates (as I understand it) the browser caches this information and will
send it to the server, thus setting the REMOTE_USER environment variable.  Is your C
code  a CGI script, and are you executing it after the user has authenticated?

rick

 
 
 

REMOTE_USER ???? Help please

Post by Marc Slemk » Sun, 28 Sep 1997 04:00:00





>> >Hi all,

>> >I am trying to get the REMOTE_USER environment variable so i can
>> >query a database for that value, but it is null.

>> >If I do a printenv on one page, it comes up as "ben" but when i write
>> >a simple piece of C code to getenv("REMOTE_USER"); it returns a null
>> >value...

>> >Why is this so?

>> Because you aren't requiring authentiation for the script?
>I don't believe that you need to require authentication for the script itself.  Once a
>user authenticates (as I understand it) the browser caches this information and will
>send it to the server, thus setting the REMOTE_USER environment variable.  Is your C
>code  a CGI script, and are you executing it after the user has authenticated?

If the script doesn't require authentication, it likely won't get
it.  It may, depending on the client, but there is no reason it
should.  If you don't require authentication for the script at
least some clients will access it without authentication so you
won't get REMOTE_USER.  You need to require authentication for the
script if you want access to be authenticated, period.
 
 
 

REMOTE_USER ???? Help please

Post by Rick Milla » Wed, 01 Oct 1997 04:00:00



> >> >I am trying to get the REMOTE_USER environment variable so i can
> >> >query a database for that value, but it is null.

> >> >If I do a printenv on one page, it comes up as "ben" but when i write
> >> >a simple piece of C code to getenv("REMOTE_USER"); it returns a null
> >> >value...

> >> >Why is this so?

> >> Because you aren't requiring authentiation for the script?

> >I don't believe that you need to require authentication for the script itself.  Once a
> >user authenticates (as I understand it) the browser caches this information and will
> >send it to the server, thus setting the REMOTE_USER environment variable.  Is your C
> >code  a CGI script, and are you executing it after the user has authenticated?

> If the script doesn't require authentication, it likely won't get
> it.  It may, depending on the client, but there is no reason it
> should.  If you don't require authentication for the script at
> least some clients will access it without authentication so you
> won't get REMOTE_USER.  You need to require authentication for the
> script if you want access to be authenticated, period.

Yes, Marc has a good point.  I guess the crux of the situation here is that in order to to
have REMOTE_USER set, you need to have the user authenticate before the script is run.  As
Marc points out, the surest way to do this is to require authentication for the cgi script
itself.  Now the question is, in your situation, has the user authenticated prior to
executing the cgi script and done nothing else to cause the browser to lose the cached
values (eg., quit the browser and restart it)?

Rick

 
 
 

REMOTE_USER ???? Help please

Post by Ben » Thu, 02 Oct 1997 04:00:00


Hi all,

Thanks to all for the replies.  I put a .htaccess file in the cgi-bin
directory and it works fine.

Thanks again.
--

Cyst and Decease

 
 
 

REMOTE_USER ???? Help please

Post by Jay Plesse » Thu, 16 Oct 1997 04:00:00


Quote:> Please ignore, as this is a test