Cleanup, bugfixes

Hi, I did some bugfixing and cleanup work on the libsmbclient code. Would you be interested in merging this?