File: 009weird-keys.t

package info (click to toggle)
libnet-ssh-authorizedkeysfile-perl 0.18-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 228 kB
  • sloc: perl: 596; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 1,205 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#
# Test cases for ssh2 keys
#
use Net::SSH::AuthorizedKey;
use Net::SSH::AuthorizedKey::SSH2;
use Test::More;
use Log::Log4perl qw(:easy);
use strict;
use warnings;

# Log::Log4perl->easy_init($DEBUG);

my $offset = tell DATA;
my @data = <DATA>;
plan tests => scalar @data;

seek DATA, $offset, 0;

while(<DATA>) {
    my($key, $comment) = split / ## /, $_;

    chomp $comment;

    my $ssh = Net::SSH::AuthorizedKey->parse($key);

    ok !defined $ssh, "$comment";
}

__DATA__
from="*.onk.com" from="*.onk.com" 1024 37 133009991 abc@foo.com ## spaces between options
AAAAB3NzaC1yc2EU= worp@corp.com ## ssh-2 key without enc algo
AAAAB3NzaC1yc2EU= ## ssh-2 key without enc algo
from="*.onk.com",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,1024 35 1409076329 worp@corp.com ## no space but comma before ssh1 key len
from ="*.onk.com" 1024 35 1743547142167 abc@foo.bar.baz.com ## space before options's "="
63548219 abc@bar.baz.com ## Missing ssh1 keylen
sh-rsa AAAAB3Nz ## Misspelled (sh-rsa) ssh2 algo
ssh-dsa AAAAB3Nz ## Misspelled (ssh-dsa) ssh2 algo
from="abc.com" no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="ls" 1024 35 12923 abc@def.com ## space in options