Revert "smb: eliminate  unused while loop in OpenDir"

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)
Merge pull request #5820 from Memphiz/smb

Revert "smb: eliminate unused while loop in OpenDir"