Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Convert-ASN1 CPAN distribution.

Report information
The Basics
Id: 24556
Status: resolved
Priority: 0/
Queue: Convert-ASN1

People
Owner: Nobody in particular
Requestors: jvaliere [...] safehost.ch
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Decode error returned from _decode.pm
Date: Thu, 25 Jan 2007 10:22:41 +0100
To: bug-Convert-ASN1 [...] rt.cpan.org
From: Jean-Christophe Valiere <jvaliere [...] safehost.ch>
Hello, I run a script that parse email address located in a Windows Active Directory. The machine on which the script is running is a Debian Sarge and the module version is: libconvert-asn-0.18-1 Sometimes the script return the following error: decode error 118 142 at /usr/share/perl5/Convert/ASN1/_decode.pm line 235, <DATA> line 283. I'm not sure whether its a bug or an error in my code. PS: I've attached the script to be sure you habe enough information Thanks for your help. -- Jyce
#!/usr/bin/env perl use strict; use warnings; use Net::LDAP; my @mail_relay = qw( mx1 mx2 ); my $postfix_path = "/etc/postfix/relay_recipient_maps"; my $tmp_path = "/tmp"; my $isdiff=0; my @ActiveDirectory = ( { domain=>'domain.tld', server=>'dc.domain.tld', binddn=>'CN=Administrator,CN=Users,DC=domain,DC=tld', password => '********', basedn=>'DC=domain,DC=tld'}, ); foreach my $ad (@ActiveDirectory){ system("/usr/bin/scp ".$mail_relay[0].":".$postfix_path."/".$ad->{'domain'}." ".$tmp_path."/".$ad->{'domain'}.".ori"); open TMP_VALID_USERS, ">".$tmp_path."/".$ad->{'domain'}; my $ldap = Net::LDAP->new( $ad->{'server'} ) or die "Can't connect to: $ad->{'server'}: $@"; my $mesg = $ldap->bind($ad->{'binddn'}, password => $ad->{'password'}); if($mesg->code) {print $mesg->error."\n"; next;} $mesg = $ldap->search( # perform a search base => $ad->{'basedn'}, scope => 'sub', filter => '(proxyAddresses=*)' ); if($mesg->code) {print "Err. for $ad->{'server'}: ".$mesg->error."\n"; next;} my $cptAddress=0; my @tabentries=$mesg->sorted('proxyAddresses'); foreach my $single_entry (@tabentries) { # print $single_entry->dn.";"; my @tabvalue = $single_entry->get_value('proxyAddresses'); foreach my $value (@tabvalue){ next if($value =~ m/^smtp\:.*@.*\.local/i); if($value =~ /^smtp\:/i){ print TMP_VALID_USERS "$' OK\n"; $cptAddress++; } } } $mesg = $ldap->unbind; # take down session close TMP_VALID_USERS; ## /usr/bin/diff export_config/valid_users /tmp/valid_users ## my $diff_cmd = "/usr/bin/diff ".$tmp_path."/".$ad->{'domain'}." ".$tmp_path."/".$ad->{'domain'}.".ori"; my $diff_results =`$diff_cmd`; if ($diff_results or $?) { $isdiff++; print $0." have updated ".$tmp_path."/".$ad->{'domain'}." :\n".$diff_results."\n"; foreach my $i (@mail_relay) { my $cmd= "ssh ".$i." 'sudo /bin/mv ".$postfix_path."/".$ad->{'domain'}." ".$postfix_path."/".$ad->{'domain'}.".old'"; print $cmd."\n"; system ($cmd); $cmd = "scp ".$tmp_path."/".$ad->{'domain'}." ".$i.":".$tmp_path."/"; print $cmd."\n"; system ($cmd); $cmd= "ssh ".$i." 'sudo /bin/mv ".$tmp_path."/".$ad->{'domain'}." ".$postfix_path."'"; print $cmd."\n"; system ($cmd); $cmd= "ssh ".$i." 'sudo /bin/chown -R root.root ".$postfix_path."'"; print $cmd."\n"; system ($cmd); $cmd ="ssh ".$i." 'sudo /usr/sbin/postmap ".$postfix_path."/".$ad->{'domain'}."'"; print $cmd."\n"; system ($cmd); } } unlink $tmp_path."/".$ad->{'domain'}; unlink $tmp_path."/".$ad->{'domain'}.".ori"; } if ($isdiff>0){ foreach my $i (@mail_relay) { my $cmd= "ssh ".$i." 'sudo /usr/sbin/postfix reload'"; system ($cmd); print $cmd."\n"; } }else{ print "nothing have changed!\n"; }
Subject: Re: [rt.cpan.org #24556] Decode error returned from _decode.pm
Date: Thu, 25 Jan 2007 06:12:30 -0600
To: bug-Convert-ASN1 [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
On Jan 25, 2007, at 3:23 AM, Jean-Christophe Valiere via RT wrote: Show quoted text
> I run a script that parse email address located in a Windows > Active > Directory. > The machine on which the script is running is a Debian Sarge > and the > module version is: libconvert-asn-0.18-1 > Sometimes the script return the following error: decode error 118 > 142 at /usr/share/perl5/Convert/ASN1/_decode.pm line 235, <DATA> > line 283. > I'm not sure whether its a bug or an error in my code. > > PS: I've attached the script to be sure you habe enough > information > Thanks for your help.
0.20 is the latest release of Convert::ASN1, previous releases were know to have decode issues with some data packets. It has also been known for packets to get corrupted by the SSL layer, so make sure you are running the latest IO::Socket::SSL and Net::SSLeay modules. If you still have the same problem, add debug => 15 to the arguments you pass to Net::LDAP->new. This will cause a lot of debug information to appear on stderr, which will help me determine why you see the error. Graham.