Sayyiduna Abu Hurayrah (may Allah be pleased with him) said that the Prophet (peace and blessings be upon him) said: "There are three people to whom Allah will not speak, nor will He purify them, and for them is a painful punishment: 1. A man who withholds surplus water from travellers. 2. A man who pledges allegiance to an imam for the sake of the world: if he gets the world he fulfils his pledge, otherwise he does not fulfil it. 3. One who bargains over goods after Asr and swears by Allah, saying: 'I was given such-and-such for it,' and the other believes him." The hadith of Waki' does not contain: 'the man who pledges allegiance to an imam.'
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 20701