The Whois database was designed to store domain ownership information as a public record, so whois searches are very much legal. Under the ICANN agreements, domain lookups are allowed for 'any lawful purposes except to enable marketing or spam, or to enable high volume, automated processes to query a registrar or registry's systems, except to manage domain names.'