حَدَّثَنَا شَيْبَانُ بْنُ فَرُّوخَ، حَدَّثَنَا مُحَمَّدُ بْنُ رَاشِدٍ، ح وَحَدَّثَنَا الْحَسَنُ بْنُ عَلِيٍّ، حَدَّثَنَا يَزِيدُ بْنُ هَارُونَ، أَخْبَرَنَا مُحَمَّدُ بْنُ رَاشِدٍ، - وَهُوَ أَشْبَعُ - عَنْ سُلَيْمَانَ بْنِ مُوسَى، عَنْ عَمْرِو بْنِ شُعَيْبٍ، عَنْ أَبِيهِ، عَنْ جَدِّهِ، قَالَ إِنَّ النَّبِيَّ صلى الله عليه وسلم قَضَى أَنَّ كُلَّ مُسْتَلْحَقٍ اسْتُلْحِقَ بَعْدَ أَبِيهِ الَّذِي يُدْعَى لَهُ ادَّعَاهُ وَرَثَتُهُ فَقَضَى أَنَّكُلَّ مَنْ كَانَ مِنْ أَمَةٍ يَمْلِكُهَا يَوْمَ أَصَابَهَا فَقَدْ لَحِقَ بِمَنِ اسْتَلْحَقَهُ وَلَيْسَ لَهُ مِمَّا قُسِمَ قَبْلَهُ مِنَ الْمِيرَاثِ شَىْءٌ وَمَا أَدْرَكَ مِنْ مِيرَاثٍ لَمْ يُقْسَمْ فَلَهُ نَصِيبُهُ وَلاَ يُلْحَقُ إِذَا كَانَ أَبُوهُ الَّذِي يُدْعَى لَهُ أَنْكَرَهُ وَإِنْ كَانَ مِنْ أَمَةٍ لَمْ يَمْلِكْهَا أَوْ مِنْ حُرَّةٍ عَاهَرَ بِهَا فَإِنَّهُ لاَ يُلْحَقُ بِهِ وَلاَ يَرِثُ وَإِنْ كَانَ الَّذِي يُدْعَى لَهُ هُوَ ادَّعَاهُ فَهُوَ وَلَدُ زِنْيَةٍ مِنْ حُرَّةٍ كَانَ أَوْ أَمَةٍ ‏.‏
Translation
'Amr b. Shu'aib on his father's authority said that his grandfather reported

The Prophet (ﷺ) ruled that every person who was claimed after his father—whom he was previously called after—had claimed him and his heirs, the Prophet (ﷺ) ruled that anyone who was from a slave-woman whom his father owned on the day he had intercourse with her, he is joined to the one who claimed him, and he has no share of any inheritance that was divided before him, but whatever of the inheritance he reached that has not been divided, he has his share. He is not joined [to the father] if the father whom he was called after disowned him, nor if he was from a slave-woman whom he did not own, or from a free woman with whom he committed illicit intercourse; indeed, he is not joined to him and does not inherit, even if the one whom he is called after is the one who claimed him, for he is a child of fornication, whether from a free woman or a slave-woman.