Sunan Ibn Majah, Book 23, Hadith 2851 (In-Book) ⓘ
It was narrated from ‘Amr bin Shu’aib, from his father, from his grandfather, that the Messenger of Allah said: “Every child who is attributed to his father after his father to whom he is attributed has died, and his heirs attributed him to him after he died, he ruled that* whoever was born to a slave woman whom he owned at the time when he had intercourse with her, he should be named after the one to whom he was attributed, but he has no share of any inheritance that was distributed previously. Whatever inheritance he finds has not yet been distributed, he will have a share of it. But he cannot be named after his father if the man whom he claimed as his father did not acknowledge him. If he as born to a slave woman whom his father did not own, or to a free woman with whom he committed adultery, then he cannot be named after him and he does not inherit from him, even if the one whom he claims as his father acknowledges him. So he is an illegitimate child who belongs to his mother’s people, whoever they are, whether she is a free woman or a slave.”
حَدَّثَنَا مُحَمَّدُ بْنُ يَحْيَى، حَدَّثَنَا مُحَمَّدُ بْنُ بَكَّارِ بْنِ بِلاَلٍ الدِّمَشْقِيُّ، أَنْبَأَنَا مُحَمَّدُ بْنُ رَاشِدٍ، عَنْ سُلَيْمَانَ بْنِ مُوسَى، عَنْ عَمْرِو بْنِ شُعَيْبٍ، عَنْ أَبِيهِ، عَنْ جَدِّهِ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ " كُلُّ مُسْتَلْحَقٍ اسْتُلْحِقَ بَعْدَ أَبِيهِ الَّذِي يُدْعَى لَهُ ادَّعَاهُ وَرَثَتُهُ مِنْ بَعْدِهِ فَقَضَى أَنَّ مَنْ كَانَ مِنْ أَمَةٍ يَمْلِكُهَا يَوْمَ أَصَابَهَا فَقَدْ لَحِقَ بِمَنِ اسْتَلْحَقَهُ وَلَيْسَ لَهُ فِيمَا قُسِمَ قَبْلَهُ مِنَ الْمِيرَاثِ شَىْءٌ وَمَا أَدْرَكَ مِنْ مِيرَاثٍ لَمْ يُقْسَمْ فَلَهُ نَصِيبُهُ وَلاَ يَلْحَقُ إِذَا كَانَ أَبُوهُ الَّذِي يُدْعَى لَهُ أَنْكَرَهُ وَإِنْ كَانَ مِنْ أَمَةٍ لاَ يَمْلِكُهَا أَوْ مِنْ حُرَّةٍ عَاهَرَ بِهَا فَإِنَّهُ لاَ يَلْحَقُ وَلاَ يُورَثُ وَإِنْ كَانَ الَّذِي يُدْعَى لَهُ هُوَ ادَّعَاهُ فَهُوَ وَلَدُ زِنًا لأَهْلِ أُمِّهِ مَنْ كَانُوا حُرَّةً أَوْ أَمَةً " . قَالَ مُحَمَّدُ بْنُ رَاشِدٍ يَعْنِي بِذَلِكَ مَا قُسِمَ فِي الْجَاهِلِيَّةِ قَبْلَ الإِسْلاَمِ .
also referenced under: Hadith 2746 (Reference) & Volume 4, Book 23, Hadith 2746 (DarusSalam)