#
# Checks the settings of the /etc/default files
#

$warn  = 0;

&pcheck("Login and Su Defaults");

if (-f $logindef) {
	if (open (LOGIN, $logindef)) {
		while (<LOGIN>) {
			next if (/^#/);

			if (/^MANDPASS.*NO/i) {
				&report("WARNING:  MANDPASS should be set to YES, as users should be required\n",
				"\tto have a password. ($logindef)\n");
				$warn = 1;
			} elsif (/PASSREQ.*NO/i) {
				&report("WARNING:  PASSREQ should be set to YES, as users should be required\n",
				"\tto have a password. ($logindef)\n");
				$warn = 1;
			} elsif (/^SYSLOG.*FAIL/i) {
				&report("WARNING:  SYSLOG should be set to ALL to make sure that system\n",
				"\tlogs are as complete as possible. ($logindef)\n");
				$warn = 1;
			}
		}
	}
}

if (-f $sudef) {
	if (open (LOGIN, $sudef)) {
		while (<LOGIN>) {
			next if (/^#/);
			if (/^SYSLOG.*FAIL/i) {
				&report("WARNING:  SYSLOG should be set to ALL to make sure that system\n",
				"\tlogs are as complete as possible. ($sudef)\n");
				$warn = 1;
			}
		}
	}
}


if ($warn) {
	&warn;
} else {
	&passed;
}

exit 0;
