Improve valid() in netlm, nethalflm and mssql12.