وَقَدْ أَخْبَرَنَا أَبُو عَبْدِ اللهِ الْحَافِظُ، أَخْبَرَنِي أَبُو أَحْمَدَ بْنُ أَبِي الْحَسَنِ، أنبأ عَبْدُ الرَّحْمَنِ يَعْنِي ابْنَ أَبِي حَاتِمٍ الرَّازِيَّ، ثنا أَبِي، ثنا حَرْمَلَةُ، قَالَ: سَمِعْتُ الشَّافِعِيَّ، يَقُولُ فِي حَدِيثِ النَّبِيِّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ حَيْثُ قَالَ لَهَا: " اشْتَرِطِي لَهُمُ الْوَلَاءَ ": مَعْنَاهُ اشْتَرِطِي عَلَيْهِمُ الْوَلَاءَ، قَالَ اللهُ عَزَّ وَجَلَّ: {أُولَئِكَ لَهُمُ اللَّعْنَةُ} [الرعد: ٢٥]، يَعْنِي: عَلَيْهِمُ اللَّعْنَةُ قَالَ الشَّيْخُ رَحِمَهُ اللهُ: " وَالْجَوَابُ الْأَوَّلُ أَصَحُّ، وَفِي صِحَّةِ هَذِهِ اللَّفْظَةِ نَظَرٌ، وَاللهُ أَعْلَمُ..
Harmalah (may Allah have mercy on him) says: I heard Imam al-Shafi'i (may Allah have mercy on him) say, regarding the saying of the Prophet (peace and blessings be upon him): "Stipulate the wala' for them," that its meaning is: Stipulate the wala' against them. Allah, the Mighty and Majestic, said: "For them is the curse" [Surah al-Ra'd: 25], meaning: upon them is the curse.
The first answer is more correct, and the authenticity of this wording is open to question. And Allah knows best.