in reply to Win32::Lanman::NetUserEnum ... FLAGS
I find that manipulating the bitfield constants exported by many modules including Win32::Lanman to be APITA. It would be much easier if you could iterate through the bit fields. There is mention in the docs of the same constants being exported as a hash %NET_STATUS_DESCRIPTION, but it also says that it is a work in progress and I couldn't get it to work.
A while ago, I came up with this method of iterating the constants I want from a module, provided they can be selected with a regex pattern.
#! perl -slw use strict; use Win32::Lanman; Win32::Lanman::NetUserEnum( 'HIAWATHA', 0, \my @users ) or die $^E; for my $user ( @users) { print $user->{name}; printf "%35s : %d\n", $_, !!( $user->{flags} & do{ no strict 'refs'; &$_ } ) for grep{ /^UF_/ } keys %Win32::Lanman::; } __END__ Fred1 UF_SETTABLE_BITS : 1 UF_SMARTCARD_REQUIRED : 0 UF_DONT_REQUIRE_PREAUTH : 0 UF_NORMAL_ACCOUNT : 1 UF_LOCKOUT : 0 UF_HOMEDIR_REQUIRED : 0 UF_SERVER_TRUST_ACCOUNT : 0 UF_PASSWD_CANT_CHANGE : 1 UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED : 0 UF_NOT_DELEGATED : 0 UF_USE_DES_KEY_ONLY : 0 UF_WORKSTATION_TRUST_ACCOUNT : 0 UF_PASSWD_NOTREQD : 0 UF_MACHINE_ACCOUNT_MASK : 0 UF_TRUSTED_FOR_DELEGATION : 0 UF_ACCOUNT_TYPE_MASK : 1 UF_INTERDOMAIN_TRUST_ACCOUNT : 0 UF_MNS_LOGON_ACCOUNT : 0 UF_TEMP_DUPLICATE_ACCOUNT : 0 UF_ACCOUNTDISABLE : 1 UF_SCRIPT : 1 UF_DONT_EXPIRE_PASSWD : 1
The value you posted below, 66049, translates to
UF_SETTABLE_BITS : 1 UF_SMARTCARD_REQUIRED : 0 UF_DONT_REQUIRE_PREAUTH : 0 UF_NORMAL_ACCOUNT : 1 UF_LOCKOUT : 0 UF_HOMEDIR_REQUIRED : 0 UF_SERVER_TRUST_ACCOUNT : 0 UF_PASSWD_CANT_CHANGE : 0 UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED : 0 UF_NOT_DELEGATED : 0 UF_USE_DES_KEY_ONLY : 0 UF_WORKSTATION_TRUST_ACCOUNT : 0 UF_PASSWD_NOTREQD : 0 UF_MACHINE_ACCOUNT_MASK : 0 UF_TRUSTED_FOR_DELEGATION : 0 UF_ACCOUNT_TYPE_MASK : 1 UF_INTERDOMAIN_TRUST_ACCOUNT : 0 UF_MNS_LOGON_ACCOUNT : 0 UF_TEMP_DUPLICATE_ACCOUNT : 0 UF_ACCOUNTDISABLE : 0 UF_SCRIPT : 1 UF_DONT_EXPIRE_PASSWD : 1
As you can see, the UF_ACCOUNT_DISABLED flag is not set in that mask. Maybe you will find that useful.
|
|---|