Sahih Bukhari Volume 009, Book 089, Hadith Number 320.
Narrated By 'Ubada bin As-Samit : Allah's Apostle said to us while we were in a gathering, "Give me the oath (Pledge of allegiance for: (1) Not to join anything in worship along with Allah, (2) Not to steal, (3) Not to commit illegal sexual intercourse, (4) Not to kill your children, (5) Not to accuse an innocent person (to spread such an accusation among people), (6) Not to be disobedient (when ordered) to do good deeds. The Prophet added: Whoever amongst you fulfill his pledge, his reward will be with Allah, and whoever commits any of those sins and receives the legal punishment in this world for that sin, then that punishment will be an expiation for that sin, and whoever commits any of those sins and Allah does not expose him, then it is up to Allah if He wishes He will punish him or if He wishes, He will forgive him." So we gave the Pledge for that. (See Hadith No. 17, Vol. 1)