كتاب المغازى
64  
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(35)
Chapter: The Ghazwa of Al-Hudaibiya
(35)
باب غَزْوَةِ الْحُدَيْبِيَةِ
Sahih al-Bukhari 4147

Narrated Zaid bin Khalid:

We went out with Allah's Messenger (ﷺ) in the year of Al-Hudaibiya. One night it rained and Allah's Messenger (ﷺ) led us in the Fajr prayer and (after finishing it), turned to us and said, "Do you know what your Lord has said?" We replied, "Allah and His Apostle know it better." He said, "Allah said:-- "(Some of) My slaves got up believing in Me, And (some of them) disbelieving in Me. The one who said: We have been given Rain through Allah's Mercy and Allah's Blessing and Allah's Bounty, then he is a believer in Me, and is a disbeliever in the star. And whoever said: We have been given rain because of such and- such star, then he is a believer in the star, and is a disbeliever in Me."

حَدَّثَنَا خَالِدُ بْنُ مَخْلَدٍ، حَدَّثَنَا سُلَيْمَانُ بْنُ بِلاَلٍ، قَالَ حَدَّثَنِي صَالِحُ بْنُ كَيْسَانَ، عَنْ عُبَيْدِ اللَّهِ بْنِ عَبْدِ اللَّهِ، عَنْ زَيْدِ بْنِ خَالِدٍ ـ رضى الله عنه ـ قَالَ خَرَجْنَا مَعَ رَسُولِ اللَّهِ صلى الله عليه وسلم عَامَ الْحُدَيْبِيَةِ، فَأَصَابَنَا مَطَرٌ ذَاتَ لَيْلَةٍ، فَصَلَّى لَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم الصُّبْحَ، ثُمَّ أَقْبَلَ عَلَيْنَا فَقَالَ ‏"‏ أَتَدْرُونَ مَاذَا قَالَ رَبُّكُمْ ‏"‏‏.‏ قُلْنَا اللَّهُ وَرَسُولُهُ أَعْلَمُ‏.‏ فَقَالَ ‏"‏ قَالَ اللَّهُ أَصْبَحَ مِنْ عِبَادِي مُؤْمِنٌ بِي وَكَافِرٌ بِي، فَأَمَّا مَنْ قَالَ مُطِرْنَا بِرَحْمَةِ اللَّهِ وَبِرِزْقِ اللَّهِ وَبِفَضْلِ اللَّهِ‏.‏ فَهْوَ مُؤْمِنٌ بِي، كَافِرٌ بِالْكَوْكَبِ‏.‏ وَأَمَّا مَنْ قَالَ مُطِرْنَا بِنَجْمِ كَذَا‏.‏ فَهْوَ مُؤْمِنٌ بِالْكَوْكَبِ، كَافِرٌ بِي ‏"‏‏.‏
Reference : Sahih al-Bukhari 4147
In-book reference : Book 64, Hadith 191
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 468
  (deprecated numbering scheme)