[pve-devel] [PATCH] - preserve authorized_key key order - identify double keys by key and not by comment

Stefan Priebe s.priebe at profihost.ag
Thu Aug 30 10:55:25 CEST 2012


Am 30.08.2012 07:31, schrieb Dietmar Maurer:
> Ok, committed - please review and test:
>
> https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff;h=2055b0a9e41912cb02810b621608b24430c8a1fe
>
>> -----Original Message-----
>> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
>> bounces at pve.proxmox.com] On Behalf Of Dietmar Maurer
>> Sent: Donnerstag, 30. August 2012 07:05
>> To: Stefan Priebe; pve-devel at pve.proxmox.com
>> Subject: Re: [pve-devel] [PATCH] - preserve authorized_key key order -
>> identify double keys by key and not by comment
>>
>>> +    my @lines = split(/\n/, $data);
>>> +    foreach my $line (@lines) {
>>> +        if ($line =~ m/^ssh-rsa\s+(\S+)\s+\S+$/) {
>>> +            next if ($vhash->{$1});
>>> +            $vhash->{$1} = 1;
>>> +        }
>>> +        $newdata .= $line . "\n";
>>>       }
>>> -
>>> -    $newdata .= join("", values(%$vhash));

Works fine. Thanks!

Do we also like to check for keys without comments?
if ($line =~ m/^ssh-rsa\s+(\S+)/) {

Greets,
Stefan



More information about the pve-devel mailing list