#
# Check tftpd setup
#

&pcheck("Tftp");
$warn = 0;
$fail = 0;

if (open(INETD, $inetd)) {
	while (<INETD>) {
		next unless (/^tftp/);
		($service,$type,$prot,$wait,$uid,
			$path,@args) = split(/\s+/);
		$warn = 1;
	}
} else {
	&report("ERROR:  Cannot open $inetd\n");
	&error;
	exit;
}

if ($warn) {

	&report("WARNING: tftp is enabled.  Be sure that it is necessary.\n");

	if (! grep(/-h/,@args)) {
		&report("WARNING: tftp is enabled without specifying a home directory.\n",
		"\tThis means that remote users may be able to retrieve files\n",
		"\tfrom any directory.  Please add a home directory.\n");
	}

	if (! grep(/-n/,@args)) {
		&report("WARNING: tftp is enabled without specifying the -n option.\n",
		"\tThis option disables a negative ack on requests, which limits\n",
		"\tthe ammount of information that is given away by tftp.\n");
	}

	if (! grep(/-s/,@args)) {
		&report("WARNING: tftp is enabled without specifying the -s option.\n",
		"\tThis option limits the requests to the home directories specified.\n");
	}

	if (! grep(/-l/,@args)) {
		&report("WARNING: tftp is enabled wthout specifying the -l option.\n",
		"\tThis option enables logging of any requests, and should be turned\n",
		"\ton.\n");
	}

	&warn;
} elsif ($fail) {
	&failed;
} else {
	&passed;
}

exit 0;


#############################################################################
#
# ERROR/WARNING/INFO Messages
#


