Apache2-AuthenNTLM
view release on metacpan or search on metacpan
AuthenNTLM.pm view on Meta::CPAN
return lc("$self->{username}") ;
}
else
{
return lc("$self->{userdomain}\\$self->{username}") ;
}
}
sub substr_unicode
{
my ($data, $off, $len) = @_ ;
my $i = 0 ;
my $end = $off + $len ;
my $result = '' ;
for ($i = $off ; $i < $end ; $i += 2)
{# for now we simply ignore high order byte
$result .= substr ($data, $i, 1) ;
}
AuthenNTLM.pm view on Meta::CPAN
{
my ($self, $r, $data) = @_ ;
my ($protocol, $type, $zero, $flags1, $flags2, $zero2, $dom_len, $x1, $dom_off, $x2, $host_len, $x3, $host_off, $x4) = unpack ('Z8Ca3CCa2vvvvvvvv', $data) ;
my $host = $host_off?substr ($data, $host_off, $host_len):'' ;
my $domain = $dom_off?substr ($data, $dom_off, $dom_len):'' ;
$self -> {domain} = $dom_len?$domain:$self -> {defaultdomain} ;
$self -> {host} = $host_len?$host:'' ;
$self -> {accept_unicode} = $flags1 & 0x01;
if ($debug)
{
my @flag1str;
foreach my $i ( sort keys %msgflags1 )
{
push @flag1str, $msgflags1{ $i } if $flags1 & $i;
}
my $flag1str = join( ",", @flag1str );
AuthenNTLM.pm view on Meta::CPAN
return $type ;
}
sub set_msg2
{
my ($self, $r, $nonce) = @_ ;
my $charencoding = $self->{ accept_unicode } ? $invflags1{ NEGOTIATE_UNICODE } : $invflags1{ NEGOTIATE_OEM };
my $flags2 = $invflags2{ NEGOTIATE_ALWAYS_SIGN } | $invflags2{ NEGOTIATE_NTLM };
my $data = pack ('Z8Ca7vvCCa2a8a8', 'NTLMSSP', 2, '', 40, 0, $charencoding, $flags2, '', $nonce, '') ;
my $header = 'NTLM '. MIME::Base64::encode($data, '') ;
if ($debug)
{
if ($debug > 1)
AuthenNTLM.pm view on Meta::CPAN
$lm_len, $l1, $lm_off,
$nt_len, $l3, $nt_off,
$dom_len, $x1, $dom_off,
$user_len, $x3, $user_off,
$host_len, $x5, $host_off,
$msg_len
) = unpack ('Z8Ca3vvVvvVvvVvvVvvVv', $data) ;
my $lm = $lm_off ? substr ($data, $lm_off, $lm_len):'' ;
my $nt = $nt_off ? substr ($data, $nt_off, $nt_len):'' ;
my $user = $user_off ? ($self->{accept_unicode} ? substr_unicode ($data, $user_off, $user_len) : substr( $data, $user_off, $user_len ) ) :'' ;
my $host = $host_off ? ($self->{accept_unicode} ? substr_unicode ($data, $host_off, $host_len) : substr( $data, $host_off, $host_len ) ) :'' ;
my $domain = $dom_off ? ($self->{accept_unicode} ? substr_unicode ($data, $dom_off, $dom_len) : substr( $data, $dom_off, $dom_len ) ) :'' ;
$self -> {userdomain} = $dom_len?$domain:$self -> {defaultdomain} ;
$self -> {username} = $user ;
$self -> {usernthash} = $nt_len ? $nt : $lm;
if ($debug)
{
print STDERR "[$$] AuthenNTLM: protocol=$protocol, type=$type, user=$user, "
. "host=$host, domain=$domain, msg_len=$msg_len\n" ;
}
with the Domain Controller has occured.
- Return DECLINE to pass request to next authentication handler
in case ntlmauthoritative is not set and we have credentials
for another authorization method given from the browser.
- Log the connection header in debug mode to see if it's a keep
alive request.
0.15 9. Apr 2002
- Added patch from Brian Paulsen which causes correct handling of
non unicode charset (needed for some versions of win9x) and
more verbose debugging output (decoded flags)
0.14 26. Feb 2002
- fixed a problem that page content of Perl sometimes goes to the
stderr instead of stdout
0.13 9. Jan 2002
- return mapped username, when second request on same connection,
smb/smbval/smbencrypt.c view on Meta::CPAN
void E_md4hash(uchar *passwd, uchar *p16)
{
int len;
int16 wpwd[129];
/* Password cannot be longer than 128 characters */
len = strlen((char *)passwd);
if(len > 128)
len = 128;
/* Password must be converted to NT unicode */
_my_mbstowcs(wpwd, passwd, len);
wpwd[len] = 0; /* Ensure string is null terminated */
/* Calculate length in bytes */
len = _my_wcslen(wpwd) * sizeof(int16);
mdfour(p16, (unsigned char *)wpwd, len);
}
/* Does the NT MD4 hash then des encryption. */
smb/smbval/smblib-priv.h view on Meta::CPAN
#define SMB_transr_dbo_offset 47
#define SMB_transr_ddi_offset 49
#define SMB_transr_suc_offset 51
#define SMB_transr_rs2_offset 52
#define SMB_transr_len 53
/* Bit masks for SMB Capabilities ... */
#define SMB_cap_raw_mode 0x0001
#define SMB_cap_mpx_mode 0x0002
#define SMB_cap_unicode 0x0004
#define SMB_cap_large_files 0x0008
#define SMB_cap_nt_smbs 0x0010
#define SMB_rpc_remote_apis 0x0020
#define SMB_cap_nt_status 0x0040
#define SMB_cap_level_II_oplocks 0x0080
#define SMB_cap_lock_and_read 0x0100
#define SMB_cap_nt_find 0x0200
/* SMB LANMAN api call defines */
( run in 0.312 second using v1.01-cache-2.11-cpan-88abd93f124 )