Hi guys,
It looks like both these environment below get the
domain/userid when I run it a server running IIS that
our IT department maintains.
But I cannot get a domain/userid when serving from my 2
servers (one running IIS and the other running
Apache).
So I think I need to do some configuration in IIS/Apache to
get this work.
Any idea???
use CGI qw(:standard);
$USERNAME = CGI::user_name(); # returns domain/userid)
or
use CGI qw(:standard);
$USERNAME = $ENV{'REMOTE_USER'}; # returns domain/userid)
> --- On Tue, 2/9/10, Nick Pontelandolfo
> wrote:
>
> > From: Nick Pontelandolfo
> > Subject: RE: Help with LDAP in CGI
> > To: "James T."
> > Date: Tuesday, February 9, 2010, 5:19 AM
> > James,
> >
> > This works for me...
> >
> > use CGI qw(:standard);
> > $USERNAME = CGI::user_name(); # returns
> > domain/userid)
> >
> > Nick
> >
> > -Original Message-
> > From: perl-win32-web-boun...@listserv.activestate.com
> > [mailto:perl-win32-web-boun...@listserv.activestate.com]
> > On Behalf Of
> > James T.
> > Sent: Monday, February 08, 2010 8:54 PM
> > To: perl-win32-web@listserv.ActiveState.com
> > Subject: Help with LDAP in CGI
> >
> > Hi All,
> >
> > Is there a way to pick a "username" or "email address"
> with
> > LDAP and
> > CGI?
> > I have this code that works fine when running just as
> a
> > Perl program. It
> > gets me the logon ID of the user and I user it in the
> LDAP
> > routine to
> > find the user email address.
> >
> > But if I run it as a CGI program, I cannot get get
> the
> > username nor the
> > user email address. I've tried all kind of user
> > environment
> > variable($ENV{'REMOTE_ADDR'}, ... ) still cannot get
> the
> > email address.
> > Is there something I need to configure in Apache?
> >
> > Please help
> > James
> >
> > #!c:/Perl/bin/perl
> >
> > use CGI ':standard';
> >
> > use Net::LDAP;
> >
> > $ldap = Net::LDAP->new( 'ldap.mycompany.com' ) or
> die
> > "$@";
> > $mesg = $ldap->bind;
> >
> > print header;
> >
> > $user = &Win32::LoginName;
> >
> > print "---$user--\n";
> >
> > $mesg = $ldap->search( # perform a search
> >
> > base =>
> > "o=hp.com",
> >
> > filter =>
> > "(&(ntUserDomainId=$user) (o=My
> > Company))"
> > );
> >
> >
> > $mesg->code && die $mesg->error;
> >
> > my($entry);
> >
> > @all = $mesg->entries;
> > foreach $ent (@all)
> > {
> > foreach $att (sort $ent->attributes )
> > {
> > if ( $att =~ m!\bmail\b! )
> > {
> > print
> > "$att - " . $ent->get_value($att) .
> > "";
> > }
> > }
> > }
> >
> >
> >
> > ___
> > Perl-Win32-Web mailing list
> > Perl-Win32-Web@listserv.ActiveState.com
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >
> > Saint Mary's Health System Disclaimer:
> >
> > The E-mail or documents attached to it,may
> contain
> > confidential information belonging to the sender that
> is
> > legally privileged. This information is intended only
> for
> > the use of the individual or entity named above. The
> > authorized recipient of this information is prohibited
> from
> > disclosing this information to any other party and is
> > required to destroy the information after its stated
> need
> > has been fulfilled. If you are not the intended
> recipient of
> > this information, you are hereby notified that any
> > disclosure, copying, or distribution of these
> documents is
> > strictly prohibited. If you have received this
> information
> > in error, please notify the sender immediately to
> arrange
> > for return of these documents.
> >
>
>
>
>
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs