It is narrated from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that the Prophet (peace and blessings be upon him) said: "Whoever attributes himself to someone other than his father, or takes as patrons (wala') someone other than the masters who freed him, upon him is the curse of Allah Almighty, the angels and all the people."
Imam Ibn Majah (may Allah have mercy on him) narrated it through Bakr bin Khalaf, from Ibn Abi al-Dayf, from Abdullah bin Uthman bin Khuthaym.
And Imam Abu Hatim al-Busti (may Allah have mercy on him) narrated it through Ahmad bin al-Hasan, from Abu Khaythamah, from Affan bin Muslim.
This hadith has a supporting narration (shahid) in Sahih al-Bukhari, in the narration of Yazid bin Sharik al-Taymi (may Allah have mercy on him) from Sayyiduna Ali (may Allah be pleased with him).