Revert "smb: eliminate unused while loop in OpenDir"

superseed of #5817

This reverts commit aeebd22d2e88fd14f1b0624d0bdbc6f791a75892.

Revert-reason: the commit broke the automated auth request dialog on password secured samba shares (dialog didn't show up - instead an empty error dialog was visible)

thanks to @stefansaraev for bringing this up: #5740 (comment)
I can confirm that this revert fixes the issue