Sahih Muslim Book 4, Hadith Number 1155.

Chapter : Forbiddance to eat garlic, onions and anything of offensive smell while coming to the mosque.

Sulaiman b. Buraida narrated it on the authority of his father that a man cried out in the mosque saying: Who had called out for the red camel? Upon this the Apostle of Allah (may peace be upon him) said: May it not be restored to you! The mosques are built for what they are meant.