Fixes to make Network Browser work properly.

Network Browser plugin was broken. It was corrupting various config files and failed to connect to Samba 3.6 servers. Apparently it wasn't doing too well with Windows machines either.

These patches clean up some copy-paste code duplication and make CIFS shares on Samba servers visible.