diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1997-07-15 07:26:27 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1997-07-15 07:26:27 +0000 |
commit | 2bc71e01cb9015af61260cd3c9fafb102b746e6f (patch) | |
tree | 4315e244ab41b7a91492ed8b60e11d1f09576e6a /usr.sbin/sendmail | |
parent | c69cadf39747b94e039387bc4f124bf38d0c7c5e (diff) |
sendmail 8.9.1
Diffstat (limited to 'usr.sbin/sendmail')
-rw-r--r-- | usr.sbin/sendmail/contrib/passwd-to-alias.pl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/usr.sbin/sendmail/contrib/passwd-to-alias.pl b/usr.sbin/sendmail/contrib/passwd-to-alias.pl new file mode 100644 index 00000000000..b2bbab541f8 --- /dev/null +++ b/usr.sbin/sendmail/contrib/passwd-to-alias.pl @@ -0,0 +1,28 @@ +#!/bin/perl + +# +# Convert GECOS information in password files to alias syntax. +# +# Contributed by Kari E. Hurtta <Kari.Hurtta@ozone.fmi.fi> +# + +print "# Generated from passwd by $0\n"; + +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"; + } + + $fullname =~ s/\.*[ _]+\.*/./g; + if ($fullname =~ /^[a-zA-Z]+(\.[a-zA-Z]+)+$/) { + print "$fullname: $name\n"; + } else { + print "# $fullname: $name\n"; + } +}; + +endpwent; |