#!/usr/bin/perl

$config_file = "/etc/X11/xdm/Xaccess";
$bkup_file = $config_file . ".k12ltsp.rpmsave";
$tmp_file = $config_file . ".k12ltsp.tmp";

# don't bother to continue unless the target file exists
$exists = stat ($config_file);
if (! $exists) {
	print "\n". $config_file ." not found\n\n";
	exit;
}

# open target file
open (IN, "< $config_file");
open (OUT, "> $tmp_file");

while (<IN>) {
	if ($_ =~ /DisplayManager.requestPort:/i) {
		$_ = "! " . $_;
	}
	print OUT $_;
}

# close up the files
close (IN);
close (OUT);

# out with the old, in with the new
`mv $config_file $bkup_file`;
`mv $tmp_file $config_file`;

exit;
