Sayyiduna Ammar bin Yasir (may Allah be pleased with him) narrates: People asked the Prophet (peace and blessings be upon him): "Did you ever commit any forbidden act in the Age of Ignorance?" The Prophet (peace and blessings be upon him) said: "No. I was faced with such a situation on two occasions in this regard: on one occasion sleep overcame me, and on the other occasion my people became a barrier between me and that intention."
At-Tabarani recorded it in all three books, and its chain contains narrators whom I do not know. In al-Awsat he recorded it thus: It is reported from Sayyiduna Ammar (may Allah be pleased with him): People asked the Prophet (peace and blessings be upon him): "Did you commit anything forbidden with regard to women?"