He reported that the Messenger of Allah ﷺ led us in the dawn prayer at Hudaybiyah following a rainfall that had occurred during the night. When he finished, he turned to the people and asked, "Do you know what your Lord has said?"They replied, "Allah and His Messenger know best."He said, "He has said, 'This morning some of My servants have become believers in Me and others disbelievers. Whoever said, We have been given rain by the grace and mercy of Allah, that one is a believer in Me and a disbeliever in the stars. But whoever said, We have been given rain by such-and-such a star, that one is a disbeliever in Me and a believer in the stars.'"
حدثنا القعنبي عن مالك عن صالح بن كيسان عن عبيد الله بن عبد الله
أنه قال صلى لنا رسول الله ﷺ صلاة الصبح بالحديبية في إثر سماء كانت من الليل فلما انصرف أقبل على الناس فقال هل تدرون ماذا قال ربكم قالوا الله ورسوله أعلم قال قال أصبح من عبادي مؤمن بي وكافر فأما من قال مطرنا بفضل الله وبرحمته فذلك مؤمن بي كافر بالكوكب وأما من قال مطرنا بنوء كذا وكذا فذلك كافر بي مؤمن بالكوكب
Bukhari narrated it in the book of adhan, chapter "The imam faces the people when he finishes the prayer," hadith no. 846, from Qanabi. Muslim narrated it in the book of faith, chapter explaining the disbelief of one who says, "We were given rain by the star," hadith no. 71, from the hadith of Malik through the same chain. It is also found in the Muwatta (Yahya's version), 1/192.