#
# Checks for the "-shmnumclients 0" optiuon in /usr/lib/X11/xdm/Xservers
#
# see the Xdm man page for info.
#

&pcheck('Shared Memory Transport in Xservers');
$file = '/usr/lib/X11/xdm/Xservers';
$passed = 0;

open(XSERV, $file) ||
  ( &report("ERROR: Cannot open $file: $!\n") && &error && exit 0 );

while (<XSERV>) {
  if (/-shmnumclients\s+0/) { $passed = 1; }
  }
close(XSERV);

if ($passed) {
  &report("INFO:  You have the '-shmnumclients 0' option in your\n",
          "       /usr/lib/X11/xdm/Xservers file.  Good.\n");
  &passed;
  }
else {
  &report("DANGER: The shared memory transport is still enabled in\n",
          "    the /usr/lib/X11/xdm/Xservers file.  This will allow\n",
          "    users to connect to your X display even if they are\n",
          "    not authorized to do so.\n",
          "  To fix: Edit the file /usr/lib/X11/xdm/Xservers and add\n",
          "    the \"-shmnumclients 0\" option to it.\n");
  &failed;
  }

exit 0;

