Cperello/s4sync fixes

The fixes are for Users -> Samba integration more than s4sync fixes. The s4sync part is still a work in progress and is not yet pushed.

With this set of fixes, user, group and contacts management should work well with samba activated.