diff options
author | Jonas Smedegaard <dr@jones.dk> | 2010-09-17 23:29:22 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2010-09-17 23:29:22 +0200 |
commit | 70c2ee2497dd94a4895da15bdfb5164c4a1e6b1c (patch) | |
tree | b2ce0a43808c702d78f5896294bdad5489961b6e /localuserinfo | |
parent | 2a905b2758e2ce4e1763d99e5ed6e445cb46234e (diff) |
Fix ensure GECOS variables are not null in getuserinfo().
Diffstat (limited to 'localuserinfo')
-rwxr-xr-x | localuserinfo | 11 |
1 files changed, 5 insertions, 6 deletions
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}} : ''; |