أَخْبَرَنِي أَحْمَدُ بْنُ سَعِيدٍ، قَالَ حَدَّثَنَا يَعْقُوبُ، قَالَ حَدَّثَنَا أَبِي، عَنْ صَالِحِ بْنِ كَيْسَانَ، عَنِ الْحَارِثِ بْنِ فُضَيْلٍ، أَنَّ ابْنَ شِهَابٍ، حَدَّثَهُ عَنْ عُبَادَةَ بْنِ الصَّامِتِ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ أَلاَ تُبَايِعُونِي عَلَى مَا بَايَعَ عَلَيْهِ النِّسَاءُ أَنْ لاَ تُشْرِكُوا بِاللَّهِ شَيْئًا وَلاَ تَسْرِقُوا وَلاَ تَزْنُوا وَلاَ تَقْتُلُوا أَوْلاَدَكُمْ وَلاَ تَأْتُوا بِبُهْتَانٍ تَفْتَرُونَهُ بَيْنَ أَيْدِيكُمْ وَأَرْجُلِكُمْ وَلاَ تَعْصُونِي فِي مَعْرُوفٍ ‏"‏ ‏.‏ قُلْنَا بَلَى يَا رَسُولَ اللَّهِ فَبَايَعْنَاهُ عَلَى ذَلِكَ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ فَمَنْ أَصَابَ بَعْدَ ذَلِكَ شَيْئًا فَنَالَتْهُ عُقُوبَةٌ فَهُوَ كَفَّارَةٌ وَمَنْ لَمْ تَنَلْهُ عُقُوبَةٌ فَأَمْرُهُ إِلَى اللَّهِ إِنْ شَاءَ غَفَرَ لَهُ وَإِنْ شَاءَ عَاقَبَهُ ‏"‏ ‏.‏

It was narrated from 'Ubadah bin As-Samit that the Messenger of Allah said: "Why don't you pledge to me upon that which the women have pledged: That you will not associate anything with Allah, that you will not steal, that you will not have unlawful sexual relations, that you will not utter slander, fabricating from between your hands and feet, and that you will not disobey me in goodness (Ma'ruf)?" We said: "yes, O Messenger of Allah." So we gave him our pledge, on that basis. The Messenger of Allah said: "Whoever commits any of these actions after that, and is punished, that will be an expiation. Whoever is not punished, then his affair is up to Allah; if He wills, He will forgive him, and if He wills, He will punish him." Translation Not Available

Book reference: Sunan An Nisai Book 39 Hadith 4162
Web reference: Sunan An Nisai Volume 5 Book 39 Hadith 4167