summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/contrib/passwd-to-alias.pl
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/sendmail/contrib/passwd-to-alias.pl')
-rwxr-xr-xcontrib/sendmail/contrib/passwd-to-alias.pl13
1 files changed, 7 insertions, 6 deletions
diff --git a/contrib/sendmail/contrib/passwd-to-alias.pl b/contrib/sendmail/contrib/passwd-to-alias.pl
index 05a51b9..24bb7a1 100755
--- a/contrib/sendmail/contrib/passwd-to-alias.pl
+++ b/contrib/sendmail/contrib/passwd-to-alias.pl
@@ -8,22 +8,23 @@
print "# Generated from passwd by $0\n";
+$wordpat = '([a-zA-Z]+?[a-zA-Z0-9-]*)?[a-zA-Z0-9]'; # 'DB2'
while (@a = getpwent) {
($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = @a;
($fullname = $gcos) =~ s/,.*$//;
- if (!-d $dir || !-x $shell) {
- print "$name: root\n";
+ if (!-d $dir || !-x $shell || $shell =~ m!/bin/(false|true)$!) {
+ print "$name: root\n"; # handle pseudo user
}
$fullname =~ s/\.*[ _]+\.*/./g;
- $fullname =~ tr [εδφΕΔΦι] [aaoAAOe]; # <hakan@af.lu.se> 1997-06-15
- if ($fullname =~ /^[a-zA-Z][a-zA-Z-]+(\.[a-zA-Z][a-zA-Z-]+)+$/) {
-# if ($fullname =~ /^[a-zA-Z]+(\.[a-zA-Z]+)+$/) { # Kari E. Hurtta
+ $fullname =~ tr [εδιφόΕΔΦά] [aaeouAAOU]; # <hakan@af.lu.se> 1997-06-15
+ next if (!$fullname || lc($fullname) eq $name); # avoid nonsense
+ if ($fullname =~ /^$wordpat(\.$wordpat)*$/o) { # Ulrich Windl
print "$fullname: $name\n";
} else {
- print "# $fullname: $name\n";
+ print "# $fullname: $name\n"; # avoid strange names
}
};
OpenPOWER on IntegriCloud