Please do not send replies directly to me, Cc the list.

At 13:40 28.08.2002, Brett Hales wrote:
>On Wed, 2002-08-28 at 17:47, Per Einar Ellefsen wrote:
> > At 09:55 28.08.2002, Brett Hales wrote:
> > >I have a mod_perl cgi script that I would like to get the username from
> > >the Apache server. The apache server successfully authenticates the
> > >client using Apache::AuthenSmb.
> > >
> > >How do I get this environment variable (the username) from apache into a
> > >variable in the perl script.
> >
> > It's $ENV{REMOTE_USER} or $r->user
>I have tried to use both of these,
>
>$login_name = $ENV{REMOTE_USER};
>
>and
>
>$login_name = $r->user;
>
>With the ENV I do not get anything when I print $login_name. With
>$r->user I get the following in the error_log.
>
>Cannot call method "user" without a package or object reference at
>......
>
>Do you have any advice, thanks again.

First of all: $r->user doesn't work because you haven't gotten the Apache 
request object. To get it in an Apache::Registry script, insert:
         my $r = Apache->request;
before your call to $r->user.

Why you aren't getting anything in $ENV{REMOTE_USER} I do not know. It 
might be that the environment isn't set up that way in Apache::Registry. Or 
maybe Apache::AuthenSmb doesn't set $r->user at all. Are you even nsure the 
authentication is working?


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]


Reply via email to