r14522: sync socket_wrapper code with samba4