1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-30 06:50:24 +03:00

r21105: Quick fix for CLDAP reply without NetLogon attribute.

Guenther
(This used to be commit aa135c960e5d713daa4ee13a955dc502d12f4f87)
This commit is contained in:
Günther Deschner 2007-02-01 12:20:33 +00:00 committed by Gerald (Jerry) Carter
parent 6b5c848e91
commit dbf7a692ed

View File

@ -136,7 +136,9 @@ sub send_cldap_netlogon ($$$$) {
) || die "failed to encode pdu: $@";
if ($opt_debug) {
print"------------\n";
asn_dump($pdu_req);
print"------------\n";
}
return $sock->send($pdu_req) || die "no send: $@";
@ -290,10 +292,13 @@ sub recv_cldap_netlogon ($\$) {
#$ret = sysread($sock, $pdu_out, 8192);
if ($opt_debug) {
print"------------\n";
asn_dump($pdu_out);
print"------------\n";
}
my $asn_cldap_rep = Convert::ASN1->new;
my $asn_cldap_rep_fail = Convert::ASN1->new;
$asn_cldap_rep->prepare(q<
SEQUENCE {
@ -320,9 +325,24 @@ sub recv_cldap_netlogon ($\$) {
}
>);
my $asn1_rep = $asn_cldap_rep->decode($pdu_out) || die "failed to decode pdu: $@";
$asn_cldap_rep_fail->prepare(q<
SEQUENCE {
msgid2 INTEGER,
[APPLICATION 5] SEQUENCE {
error_code ENUMERATED,
matched_dn OCTET STRING,
error_message OCTET STRING
}
}
>);
$$return_string = $asn1_rep->{'val'};
my $asn1_rep = $asn_cldap_rep->decode($pdu_out) ||
$asn_cldap_rep_fail->decode($pdu_out) ||
die "failed to decode pdu: $@";
if ($asn1_rep->{'error_code'} == 0) {
$$return_string = $asn1_rep->{'val'};
}
return $ret;
}
@ -453,6 +473,11 @@ sub main() {
}
close($sock);
if (!$reply) {
printf("no 'NetLogon' attribute received\n");
exit 0;
}
%cldap_netlogon_reply = parse_cldap_reply($reply);
if (!%cldap_netlogon_reply) {
die("failed to parse CLDAP reply from $server");