Sahih Muslim Book 20, Hadith Number 4590.

Chapter : It is good on the part of a leader to take the oath of allegiance from his forces when intending to fight, and an account of the allegiance of God’s pleasure under the tree.

It has been narrated on the authority of Yazid b. Abu Ubaid (the freed slave of Salama b. al-Akwa’) who said: I asked Salama as to what effect he had sworn fealty to the Messenger of Allah (may peace be upon him) on the Day of Hudaibiya. He said: To the effect that we will die fighting.