summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-02-01 12:20:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:37 -0500
commitdbf7a692edba88e0d609142f1ed11445bc7e841a (patch)
tree77f62c73a5dc7793c150daa7612a48687f60af31 /examples
parent6b5c848e9140b95a8902f96a1d363da9feac9588 (diff)
downloadsamba-dbf7a692edba88e0d609142f1ed11445bc7e841a.tar.gz
samba-dbf7a692edba88e0d609142f1ed11445bc7e841a.tar.bz2
samba-dbf7a692edba88e0d609142f1ed11445bc7e841a.zip
r21105: Quick fix for CLDAP reply without NetLogon attribute.
Guenther (This used to be commit aa135c960e5d713daa4ee13a955dc502d12f4f87)
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/misc/cldap.pl29
1 files changed, 27 insertions, 2 deletions
diff --git a/examples/misc/cldap.pl b/examples/misc/cldap.pl
index 2218537f08..c33fdedfbf 100755
--- a/examples/misc/cldap.pl
+++ b/examples/misc/cldap.pl
@@ -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");