The Jataka, Volume I, tr. by Robert Chalmers, , at sacred-texts.com
"Like highways."--This story was told by the Master while at Jetavana, about just such another lay-brother as the last. This man, when on enquiry he assured himself of his wife's misconduct, came to words with her, with the result that he was so upset that for seven or eight days he failed in his attendance. One day he came to the monastery, made his bow to the Blessed One and took his seat. Being asked why he had been absent for seven or eight days, he replied, "Sir, my wife has misconducted herself, and I have been so upset about her that I did not come."
"Lay-brother," said the Master, "long ago the wise and good told you not to be angered at the naughtiness found in women, but to preserve your equanimity this, however, you have forgotten, because re-birth has hidden it from you." And so saying, he told--at that lay-brother's request--this story of the past.
Once on a time when Brahmadatta was reigning in Benares, the Bodhisatta was a teacher of world-wide reputation, as in the foregoing story. And a pupil of his, finding his wife unfaithful, was so affected by the discovery that he stayed away for some days, but being asked one day by his teacher what was the reason of his absence, he made a clean breast of it, Then said his teacher, "My son, there is no private property in women: they are common to all.  And therefore wise men knowing
their frailty, are nod excited to anger against them." And so saying, he repeated this stanza for his pupil's edification:--
Such was the instruction which the Bodhisatta imparted to his pupil, who thenceforward grew indifferent to what women did. And as for his wife, she was so changed by hearing that the teacher knew what she was, that she gave up her naughtiness thenceforth.
So too that lay-brother's wife, when she heard that the Master knew what she was, gave up her naughtiness thenceforth.
His lesson ended, the Master preached the Truths, at the close whereof the lay-brother won the Fruit of the First Path. Also the Master shewed the connexion and identified the Birth by saying, "This husband and wife were also the husband and wife of those days, and I myself the brahmin teacher."