This file is indexed.

/usr/sbin/makeuserdb is in courier-authlib-userdb 0.66.4-3build1.

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
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#! /usr/bin/perl
#
# Create userdb database
#
# Usage: makeuserdb
#
#
# Copyright 1998 - 2006 Double Precision, Inc.  See COPYING for
# distribution information.

use Fcntl ':flock';

$prefix="/usr";
$exec_prefix="${prefix}";
$bindir="${exec_prefix}/bin";

$ENV{'PATH'}="${exec_prefix}/bin:/usr/bin:/usr/local/bin:/bin";

$dbfile="/etc/courier/userdb";

$makedat="/usr/lib/courier/courier-authlib/makedatprog";

$name=shift @ARGV;
if ($name eq "-f") {
	$dbfile=shift @ARGV;
	$dbfile=~s/\/$//;
}

$datfile=$dbfile.".dat";
# XXX the lock file here is etc/userdb.lock but the userdb command uses etc/.lock.userdb
$lockfile=$dbfile.".lock";
$shadowfile=$dbfile."shadow.dat";
$tmpdatfile=$dbfile.".tmp";
$tmpshadowfile=$dbfile."shadow.tmp";

$mode=(stat($dbfile))[2];
die "$dbfile: not found.\n" unless defined $mode;

die "$dbfile: MAY NOT HAVE GROUP OR WORLD PERMISSIONS!!\n"
	if ( $mode & 077);

eval {
	die "SYMLINK\n" if -l $dbfile;
};

die "ERROR: Wrong makeuserdb command.\n       ($dbfile is a symbolic link)\n"
	if $@ eq "SYMLINK\n";

eval {
	die "SYMLINK\n" if -l $datfile;
};

die "ERROR: Wrong makeuserdb command.\n       ($datfile is a symbolic link)\n"
	if $@ eq "SYMLINK\n";

eval {
	die "SYMLINK\n" if -l $shadowfile;
};

die "ERROR: Wrong makeuserdb command.\n       ($shadowfile is a symbolic link)\n"
	if $@ eq "SYMLINK\n";

umask (022);
open(LOCK, ">$lockfile") or die "Can't open $lockfile: $!";
flock(LOCK,LOCK_EX) || die "Can't lock $lockfile: $!";

open (DBPIPE, "| ${makedat} - $tmpdatfile $datfile") || die "$!\n";
umask (066);
open (SHADOWPIPE, "| ${makedat} - $tmpshadowfile $shadowfile")
	|| die "$!\n";

eval {

	if ( -d $dbfile )
	{
	my (@dirs);
	my (@files);

		push @dirs, $dbfile;
		while ( $#dirs >= 0 )
		{
			$dir=shift @dirs;
			opendir(DIR, $dir) || die "$!\n";
			while ( defined($filename=readdir(DIR)))
			{
				next if $filename =~ /^\./;
				if ( -d "$dir/$filename" )
				{
					push @dirs, "$dir/$filename";
				}
				else
				{
					push @files, "$dir/$filename";
				}
			}
			closedir(DIR);
		}

		while (defined ($filename=shift @files))
		{
			&do_file( $filename );
		}
	}
	else
	{
		&do_file( $dbfile );
	}

	print DBPIPE ".\n" || die "$!\n";
	print SHADOWPIPE ".\n" || die "$!\n";
} ;

$err=$@;
if ($err)
{
	print "$err";
	exit (1);
}

close(DBPIPE) || die "$!\n";
exit (1) if $?;
close(SHADOWPIPE) || die "$!\n";
exit (1) if $?;

exit (0);

sub do_file {
my ($filename)=@_;
my ($addr, $fields);
my (@nonshadow, @shadow);

my $location=substr($filename, length("/etc/courier/userdb"));

	$location =~ s/^\///;
	$location =~ s/\/$//;
	$location .= "/" if $location ne "";

	open (F, $filename) || die "$filename: $!\n";
	while (<F>)
	{
		if ( /^[\n#]/ || ! /^([^\t]*)\t(.*)/ )
		{
			print DBPIPE;
			print SHADOWPIPE;
			next;
		}
		($addr,$fields)=($1,$2);
		undef @nonshadow;
		undef @shadow;

		foreach ( split (/\|/, $fields ) )
		{
			if ( /^[^=]*pw=/ )
			{
				push @shadow, $_;
			}
			else
			{
				push @nonshadow, $_;
			}
		}

		push @nonshadow, "_=$location";
		( print DBPIPE "$addr\t" . join("|", @nonshadow) . "\n"
			|| die "$!\n" ) if $#nonshadow >= 0;
		( print SHADOWPIPE "$addr\t" . join("|", @shadow) . "\n"
			|| die "$!\n" ) if $#shadow >= 0;
	}
	print DBPIPE "\n";
	print SHADOWPIPE "\n";
}