in reply to Re: Using Win32::NetAdmin for passwords
in thread Using Win32::NetAdmin for passwords

Thanks for the tip, I didn't know about the AdminMisc module. Here's the code I have now using LanMan. The program retrieves the username and password from a transaction file, then checks three different account types for the password. Here's the verify sub:

sub Verify {
my ($server,$user) =@_;
my %info;
my %ainfo;
my %onfo;
$auser = "a" . "$empid";
$ouser = "o" . "$empid";
Win32::Lanman::NetUserGetInfo($server,$user,\%info);
Win32::Lanman::NetUserGetInfo($server,$auser,\%ainfo);
Win32::Lanman::NetUserGetInfo($server,$ouser,\%oinfo);
if ($info{'password'} eq $ainfo{'password'}) {
print "A account matches! $info{'password'} $ainfo{'password'}";
}
else {
print "A account doesn't match!";
}
if ($info{'password'} eq $oinfo{'password'}) {
print "O account matches!";
}
else {
print "O account doesn't match!";
}
}

  • Comment on Re: Re: Using Win32::NetAdmin for passwords

Replies are listed 'Best First'.
Re: Re: Re: Using Win32::NetAdmin for passwords
by enoch (Chaplain) on Jun 16, 2001 at 01:35 UTC
    Lanman does not seem to have a password key or value. Run this code:
    use Win32::LanMan qw(NetUserGetInfo); Win32::Lanman::NetUserGetInfo("","Administrator",\%info); foreach $key (keys %info) { print $key . " = " . $info{$key} . "\n"; }
    And you see that the output is:
    flags = 66049 logon_server = \\* last_logoff = 0 workstations = usr_comment = name = Administrator parms = auth_flags = 0 logon_hours =                       full_name = priv = 2 profile = password_age = 15750588 user_id = 500 units_per_week = 168 max_storage = -1 script_path = home_dir_drive = home_dir = country_code = 0 num_logons = 5 acct_expires = -1 primary_group_id = 513 last_logon = 984601420 password_expired = 0 code_page = 0 comment = Built-in account for administering the computer/domain bad_pw_count = 0
    There is no password field. So, you cannot compare them. I would use the AdminMisc module. It will probably work out better for you.

    Jeremy