jschnip has asked for the wisdom of the Perl Monks concerning the following question:

I am looking to retrieve the NT User ID from Windows LAN users accessing a cgi web page. Within my perl script I would like to cross reference that User ID with specific permissions (stored in an Oracle Table, via DBI) for different "views" of the site. Along with logging by NT userid. I would then those "permissions" in a temporary cookie on their machine for increased performance.
I am running mod_perl on a unix server. Any specific examples would be appreciated (retrieving the id). I have been looking at using Apache:AuthenNTLM, but have been unsuccessful. thnx

Replies are listed 'Best First'.
Re: LAN Website NT User ID Retrieval
by jschnip (Initiate) on May 21, 2003 at 23:18 UTC
    I ended up solving this on my own. I used the Net::NBName module, which uses NetBios. Here is a selection of what I used (some of which, is used from the Net::NBName man pages):

    Modules used:> CGI, and Net::NBName

    my $cgi = CGI->new; my $nb = Net::NBName->new; #Remote User's IP Address my $user_ip = $ENV{'REMOTE_ADDR'}; #Retrieve Net Bios Name Table for that IP $ns = $nb->node_status($user_ip); #Split em Up if ($ns) { for my $rr ($ns->names) { if ($rr->suffix == 0 && $rr->G eq "GROUP") { $domain = $rr->name; } if ($rr->suffix == 3 && $rr->G eq "UNIQUE") { $user = $rr->name; } if ($rr->suffix == 0 && $rr->G eq "UNIQUE") { $machine = $rr->name unless $rr->name =~ /^IS~/; } } $mac_address = $ns->mac_address; }
    Hope this is helpful to someone in the future!

    :J)schniP