backport of #1654, #1636  and https://github.com/owncloud/3rdparty/pull/12
Merge pull request #1660 from owncloud/smb-fixes-stable45

smb/cifs fixes for stable45