On Thu, Mar 26, 2015 at 03:42:07PM +0100, Ingo Schwarze wrote:
> Hi Andrew (or any other developer),
> 
> OK to commit the following fix?
> 
> Note that chomping after splitting is important because split
> drops trailing empty fields.

A blank home_dir is valid?  I will defer to others on that but seems
surprising to me.

Although I haven't had time to apply the patch and try it, the
implementation looks sane given that above is as expected.

OK afresh1@ 


> Index: security
> ===================================================================
> RCS file: /cvs/src/libexec/security/security,v
> retrieving revision 1.32
> diff -u -p -r1.32 security
> --- security  4 Dec 2014 00:07:21 -0000       1.32
> +++ security  26 Mar 2015 14:23:53 -0000
> @@ -336,7 +336,16 @@ sub find_homes {
>       nag !(open my $fh, '<', $filename),
>           "open: $filename: $!"
>           and return [];
> -     my $homes = [ map [ @{[split /:/]}[0,2,5] ], <$fh> ];
> +     my $homes = [];
> +     while (<$fh>) {
> +             my $entry = [ @{[split /:/]}[0,2,5] ];
> +             chomp;
> +             nag !defined $entry->[2],
> +                 "Incomplete line \"$_\" in $filename."
> +                 and next;
> +             chomp $entry->[2];
> +             push @$homes, $entry;
> +     }
>       close $fh;
>       return $homes;
>  }

-- 
andrew - http://afresh1.com

Unix is very simple,
    but it takes a genius to understand the simplicity.
                      -- Dennis Ritchie

Reply via email to