s3:messaging: use struct initializers for 'struct messaging_rec'

This makes sure new struct members will always be initialized,
without explicitly finding all users.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:unix_msg: use sendmsg() in unix_dgram_send_job()

This prepares fd-passing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:unix_msg: add close_fd_array()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:unix_msg: read fds from recvmsg in unix_dgram_recv_handler()

For now we directly close the fds, the next commits will pass them
to the recv_callback function.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
s3:unix_msg: pass the fd array to the unix_dgram recv_callback function

For now unix_msg_recv() will just close the fds, but they will be passed
to the unix_msg recv_callback in the next commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:unix_msg: add fds-array to unix_dgram_send() for fd-passing

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
s3:unix_msg: pass the fd array to the unix_msg recv_callback function

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:unix_msg: add fds-array to unix_msg_send() for fd passing

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
s3:messaging: make it possible to receive a fd array from another process

In order to receive the fd array the caller needs to use
messaging_filtered_read_send/recv(). For all higher level
methods we silently close/ignore the fd array.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:messaging: add fds-array to message-backend send function

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
s3:messaging: add fds-array to messaging_send_iov()

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
s3:torture: add test LOCAL-MESSAGING-FDPASS1

Verify that a process can not pass an fd to itself.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
selftest: run smbtorture3 LOCAL-MESSAGING-FDPASS1 test

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
s3:torture: work on LOCAL-MESSAGING-FDPASS2

- parent: fork
- parent: create up and down pipes,
- parent: pass read end of up pipe and write end of down pipe to child
- parent: write to up pipe
- child:  read from up pipe
- child:  write to down pipe
- parent: read from down pipe

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
selftest: run smbtorture3 LOCAL-MESSAGING-FDPASS2 test

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
s3:torture: in LOCAL-MESSAGING-READ3, tell child to exit and wait

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
s3:torture: in LOCAL-MESSAGING-READ3, print some messages to child

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Sep 24 11:09:43 CEST 2014 on sn-devel-104
tdb: Improve wording in a comment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 25 00:59:16 CEST 2014 on sn-devel-104