Skip Menu |

This queue is for tickets about the Net-SSH-Perl CPAN distribution.

Report information
The Basics
Id: 122364
Status: new
Priority: 0/
Queue: Net-SSH-Perl

People
Owner: Nobody in particular
Requestors: hugo.mgt [...] openmailbox.org
Cc:
AdminCc:

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



Subject: bug in write_private method
Date: Wed, 05 Jul 2017 10:15:49 +0000
To: bug-Net-SSH-Perl [...] rt.cpan.org
From: hugo.mgt [...] openmailbox.org
Hello, the documentation[1] says "If $file is not provided, returns the content that would have been written to the key file." But running this simple perl script returns the following error message : Show quoted text
> hugo@brichemer:~$ cat test.pl > use Net::SSH::Perl::Key; > my $privkey = Net::SSH::Perl::Key->keygen("RSA",2048)->write_private(); > hugo@brichemer:~$ perl test.pl > Use of uninitialized value $key_file in open at > /usr/local/lib/x86_64-linux-gnu/perl/5.22.1/Net/SSH/Perl/Key/RSA.pm line > 93. > Use of uninitialized value $key_file in concatenation (.) or string at > /usr/local/lib/x86_64-linux-gnu/perl/5.22.1/Net/SSH/Perl/Key/RSA.pm line 93. > Can't write to : No such file or directory at test.pl line 2.
To fix this I added a line to handle the case where "$key_file" is empty, here is the diff between the original RSA.pm and the modified : Show quoted text
> hugo@brichemer:~$ diff RSA.pm* > 92a93,95 > > return $pem if(!$key_file);
I have checked some but not all perl modules file in 'perl/5.24.1/Net/SSH/Perl/Key/' for the function write_private and it seems they also need this modification. Finally, here are some versions infos : Show quoted text
> hugo@brichemer:~$ sudo cpanm --info Net::SSH::Perl::Key && uname -a && perl -v > SCHWIGON/Net-SSH-Perl-2.12.tar.gz > Linux brichemer 4.9.0-3-686-pae #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) i686 GNU/Linux > This is perl 5, version 24, subversion 1 (v5.24.1) built for i686-linux-gnu-thread-multi-64int
Thank you [1] http://search.cpan.org/~schwigon/Net-SSH-Perl-2.12/lib/Net/SSH/Perl/Key.pm#$key-%3Ewrite_private([_$ ile_[,_$pass,_$ciphername,_$rounds]_]) --- gpg public key : https://ysengr.in/pubkey