Tshimanga Minkoka wrote:
Hi Perl users,

I need a Perl module or Perl script that enables to check the username and
the password in a Windows NT domain.
I mean a sort of function that return TRUE if the provided information match
the one in the Domain Controller, otherwise it returns FALSE.

if (CheckUser('username', 'password', 'domain')) {
    print "Access granted!\n";
}
else {
    warn "Access denied!\";
}

Any help will be appreciated.


Hmmm, Win32::AdminMisc might be what you are looking for. All funktions
return TRUE on success IIRC.

The follwoing example is from Dave Roth's book "Win32 Perl Programming -
The Standard Extensions, Second Edition". He is also the author of the
Win32::AdminMisc perl module.

####################################
use Win32::AdminMisc;
my( $Domain, $User, $Password ) = @ARGV;
if( Win32::AdminMisc::LogonAsUser( $Domain, $User, Password ) )
{
  my $Name = Win32::AdminMisc::GetLogonName();
  if( "\L$User" ne "\L$Name" )
  {
    print "The logon failed.\n";
  }
  else
  {
    print "Successfully logged on as $Name\n";
    Win32::AdminMisc::LogoffAsUser();
  }
}
else
{
  print Win32::FormatMessage( Win32::AdminMisc::GetError() );
}

####################################

Hope this helps

Alex

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to