head	1.6;
access;
symbols
	RELEASE_8_3_0:1.5
	RELEASE_9_0_0:1.5
	RELEASE_7_4_0:1.5
	RELEASE_8_2_0:1.5
	RELEASE_6_EOL:1.5
	RELEASE_8_1_0:1.5
	RELEASE_7_3_0:1.5
	RELEASE_8_0_0:1.5
	RELEASE_7_2_0:1.5
	RELEASE_7_1_0:1.5
	RELEASE_6_4_0:1.5
	RELEASE_5_EOL:1.5
	RELEASE_7_0_0:1.4
	RELEASE_6_3_0:1.4
	PRE_XORG_7:1.4
	RELEASE_4_EOL:1.4
	RELEASE_6_2_0:1.4
	RELEASE_6_1_0:1.4
	RELEASE_5_5_0:1.4
	RELEASE_6_0_0:1.4
	RELEASE_5_4_0:1.4
	RELEASE_4_11_0:1.4
	RELEASE_5_3_0:1.4
	RELEASE_4_10_0:1.4
	RELEASE_5_2_1:1.3
	RELEASE_5_2_0:1.3
	RELEASE_4_9_0:1.3
	RELEASE_5_1_0:1.3
	RELEASE_4_8_0:1.3
	RELEASE_5_0_0:1.3
	RELEASE_4_7_0:1.3
	RELEASE_4_6_2:1.3
	RELEASE_4_6_1:1.3
	RELEASE_4_6_0:1.3
	RELEASE_5_0_DP1:1.3
	RELEASE_4_5_0:1.2
	RELEASE_4_4_0:1.2
	RELEASE_4_3_0:1.1;
locks; strict;
comment	@# @;


1.6
date	2012.11.17.05.57.31;	author svnexp;	state Exp;
branches;
next	1.5;

1.5
date	2008.05.24.10.09.18;	author dinoex;	state Exp;
branches;
next	1.4;

1.4
date	2003.12.12.19.17.17;	author dinoex;	state Exp;
branches;
next	1.3;

1.3
date	2002.03.23.11.12.19;	author nbm;	state Exp;
branches;
next	1.2;

1.2
date	2001.08.01.09.05.58;	author nbm;	state Exp;
branches;
next	1.1;

1.1
date	2001.02.03.19.07.42;	author nbm;	state Exp;
branches;
next	;


desc
@@


1.6
log
@Switch exporter over
@
text
@#!/bin/sh
# $FreeBSD: head/ftp/vsftpd/pkg-install 300896 2012-07-14 13:54:48Z beat $
#

if [ "$2" != "PRE-INSTALL" ]; then
    exit 0
fi

if ! pw groupshow operator >/dev/null; then
	if pw groupadd operator 5; then
		echo "Added group operator for vsftpd"
	else
		echo "Failed to add group operator as gid 5" >&2
		exit 1
	fi
fi

if ! pw usershow ftp >/dev/null; then
	if pw useradd ftp -g operator -u 14 -h - -d /var/ftp -s /nonexistent -c "Anonymous Ftp"; then
		echo "Added user ftp for vsftpd"
	else
		echo "Failed to add user ftp as gid 14" >&2
		exit 1
	fi
fi

# uid=14(ftp) gid=5(operator) groups=5(operator)
view="$(id ftp)"
view="${view%% *}"
if test "${view}" = "uid=14(ftp)"; then
	exit 0
fi

echo "User ftp should have uid 14"; >&2
exit 1
# eof
@


1.5
log
@- fixed Spelling
Submitted by:	Richard Toohey
@
text
@d2 1
a2 1
# $FreeBSD: ports/ftp/vsftpd/pkg-install,v 1.4 2003/12/12 19:17:17 dinoex Exp $
@


1.4
log
@- get rid of all perl stuff
- USE_REINPLACE
@
text
@d2 1
a2 1
# $FreeBSD$
d19 1
a19 1
	if pw useradd ftp -g operator -u 14 -h - -d /var/ftp -s /nonexistent -c "Annonymus Ftp"; then
@


1.3
log
@Make port more verbose about creating users and what users to remove if
no longer necessary.

PR:		28179
Submitted by:	Rob Simmons <rsimmons@@beanweevil.wlcg.com>
@
text
@d1 2
a2 1
#!/usr/bin/perl
d5 32
a36 76
@@groups = ("operator");
%users = ('ftp', "operator");
# daemon, local, pop, queue, remote, deliver, respectively.
# alias is a special case above...
%gids = ('operator', 5);
%uids = ('ftp', 14);

if ($ENV{PACKAGE_BUILDING} || $ARGV[1] eq "PRE-INSTALL") {
	$doguid=1;  # Make sure we get the assigned guids.
}

foreach $group (@@groups) {
	if (! getgrnam ($group)) {
		do checkrpw;  # May exit

		$x = "-g $gids{$group}";
		$result = system ("/usr/sbin/pw groupadd $group $x");
		if ($result) {
			die "Failed to add group $group as gid $gids{$group}\n";
		}
		print "Added group $group for vsftpd\n";
	}
}

foreach $user (keys %users) {
	if (! getpwnam ($user)) {
		do checkrpw;  # May exit

		$x = "-u $uids{$user}";
		$result = system ("/usr/sbin/pw useradd $user -g $users{$user} -d \"/var/ftp\" -s /nonexistent $x");
		if ($result) {
			die "Failed to add user $user as uid $uids{$user}\n";
		}
		print "Added user $user for vsftpd\n";
	}
}

# Check that all gids/uids are as they should be...
# If we are being installed as a package...
if ($doguid) {
	foreach $group (@@groups) {
		if (getgrnam($group) != $gids{$group}) {
			die "Group $group should have gid $gids{$group}\n";
		}
	}

	foreach $user (keys %users) {
		if (getpwnam($user) != $uids{$user}) {
			die "User $user should have uid $uids{$user}\n";
		}
	}
}

exit 0;

sub checkrpw {
	if (! -x "/usr/sbin/pw") {
		print <<'EOM';
This system looks like a pre-2.2 version of FreeBSD.  We see that it
is missing the "pw" utility.  We need this utility.  Please get and
install it, and try again.  You can get the source from:

  ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz

EOM
		die "No /usr/sbin/pw";
	}

	if ($> != 0) {
		print "It is necessary to add missing vsftpd users/groups at";
		print "this stage.  Please either add them manually or retry";
		print "as root.";
		# Let pw(1) signal the failure so the user can see which
		# group/user is actually missing.
	}
}
@


1.2
log
@Update to 0.0.15

Submitted by:	Anders Andersson <anders@@codefactory.se>
@
text
@d24 1
d37 1
@


1.1
log
@Add vsftpd 0.0.10, a FTP daemon that aims to be "very secure".
@
text
@d71 1
a71 1
		print "It is necessary to add missing vpopmail users/groups at";
@

