/usr/sbin/pw2userdb is in courier-authlib-userdb 0.68.0-4build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #! /usr/bin/perl
#
# Convert /etc/passwd and /etc/shadow to userdb format.
#
#
# Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
# distribution information.
use Getopt::Long;
#
# Some undocumented options here (for vchkpw2userdb)
#
die "Invalid options.\n" unless
GetOptions("passwd=s" => \$passwd, "shadow=s" => \$shadow,
"noshadow" => \$noshadow, "nouid" => \$nouid,
"domain=s" => \$domain, "vpopuid" => \$vpopuid );
($dummy, $dummy, $fixed_uid, $fixed_gid)=getpwnam("vpopmail")
if $vpopuid;
$passwd="/etc/passwd" unless $passwd =~ /./;
$shadow="/etc/shadow" unless $shadow =~ /./;
$domain="" unless $domain =~ /./;
$domain="\@$domain" if $domain =~ /./;
open(PASSWD, $passwd) || die "$!\n";
while (<PASSWD>)
{
chop if /\n$/;
next if /^#/;
($acct,$passwd,$uid,$gid,$name,$home,$shell)=split( /:/ );
($uid,$gid)=($fixed_uid,$fixed_gid) if $vpopuid;
$PASSWORD{$acct}=$passwd if $passwd ne "x";
$UID{$acct}=$uid;
$GID{$acct}=$gid;
$HOME{$acct}=$home;
$SHELL{$acct}=$shell;
$name =~ s/\|/./g; # Just in case
$GECOS{$acct}=$name;
}
close (PASSWD);
if ( -f $shadow && ! $noshadow)
{
open (SHADOW, $shadow) || die "$!\n";
while (<SHADOW>)
{
next if /^#/;
($acct,$passwd,$dummy)=split(/:/);
$PASSWORD{$acct}=$passwd;
}
close (SHADOW);
}
while ( defined ($key=each %UID))
{
print "$key$domain\tuid=$UID{$key}|gid=$GID{$key}|home=$HOME{$key}" .
( $SHELL{$key} =~ /./ ? "|shell=$SHELL{$key}":"") .
( $PASSWORD{$key} =~ /./ ? "|systempw=$PASSWORD{$key}":"") .
( $GECOS{$key} =~ /./ ? "|gecos=$GECOS{$key}":"") .
"\n";
print "$UID{$key}=\t$key\n" unless $nouid;
}
|