From 70c2ee2497dd94a4895da15bdfb5164c4a1e6b1c Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 17 Sep 2010 23:29:22 +0200 Subject: Fix ensure GECOS variables are not null in getuserinfo(). --- localuserinfo | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'localuserinfo') diff --git a/localuserinfo b/localuserinfo index 7c74589..a13b2b3 100755 --- a/localuserinfo +++ b/localuserinfo @@ -146,13 +146,12 @@ sub getuserinfo($) { my $gr = getgrgid($pw->gid) || die "Failed locating primary group of user \"$username\"."; my ($fullname, $office, $workphone, $homephone, $other) = split /\s*,\s*/, $pw->gecos; + $office .= ''; + $workphone .= ''; + $homephone .= ''; + $other .= ''; my @officehints = grep {s/^([\.[:alnum:]_-]+)$/%$1/} split /\s+/, $office; - my @addresshints; - if (defined($other)) { - @addresshints = grep {/^([\.[:alnum:]_-]+|\+)@([\.[:alnum:]_-]+)?$/} split /\s+/, $other; - } else { - $other = ""; - } + my @addresshints = grep {/^([\.[:alnum:]_-]+|\+)@([\.[:alnum:]_-]+)?$/} split /\s+/, $other; my $groupname = $gr->name; my $members = $gr->members; my $groups = join ' ', defined($groups{$username}) ? @{$groups{$username}} : ''; -- cgit v1.2.3