kdbus.h: add ULL suffix to shifted 64-bit values
kdbus-test: add --wait and --bus parameters
test/kdbus-util.c: reduce message size for tests
kdbus.h: comment
metadata, queue: remove all namespace translating hacks again

After carefully revisiting the entire namespace translation ideas
again, we concluded that what we're currently doing doesn't possibly
cover all use cases that we have in mind.

a) We want to be able to do create a connection inside a container,
   pass the file handle to it to the outside world, and expect to be
   operating from inside the container with it. Namespace translation
   is not on in such cases.

b) While we can map pids and uids from inside a namespace into
   something that is meaningful on the host, the other way around is
   impossible: if we pass a handle from the host into the container,
   namespace translation cannot succeed.

As user namespaces aren't something we need to support anytime soon
anyway, the easiest solution for now is to remove all the current
code again and remove the metadata from the final message in case
we're jumping across namespaces with it.
metadata: rename domain → pid_namespace
metadata: add kdbus_meta_ns_eq()

Pin the user ns as well, and introduce kdbus_meta_ns_eq() to check
whether all namespaces of a kdbus_meta objects are equal.
update kdbus.txt
test/test-metadata-ns: tweak test to reflect recent changes
typo
kdbus.h: make includes work regardless of compilation env

Lets not include different files depending on the compilation environment.
linux/ioctl.h is required for _IOW() etc. definitions, and linux/types.h
defines the required __uXY types. There is no need for anything else and
both headers are available in kernel and user-space environments.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
main: keep initial domain local to main.c

The initial domain is not special in any regard. There is no need to make
it a global kdbus symbol. Keep it local in main.c and avoid exposing it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
kdbus.h: fix typos

Several trivial typos.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
kdbus.h: remove comment on conn_flags
kdbus.txt: fix things spotted by Tom
util: fix string-length verification at end of cmd-objects

The kdbus_check_strlen() function verifies that any string at the end of
a cmd-object is properly zero-terminated within bounds. However, it also
explicitly allows empty strings with length 0 and no zero termination at
all.

Both callers of kdbus_check_strlen() expect non-empty names, and only one
of them properly guards against empty names. Fix this by disallowing
empty strings and making kdbus_check_strlen() fail in those cases. We can
now drop the extra size-check in cmd_conn_info() and at the same time fix
a buffer-overflow in cmd_acquire_name().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
connection: drop unused size argument to cmd_conn_info()

The "size" argument is no longer used, drop it. Besides, it's equivalent
to conn_info->size so it was never needed, anyway.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
util: make kdbus_check_strlen() readable

Using "strnlen(p, max) != max" is equivalent to "strnlen(p, max) < max",
as strnlen(p, max) never returns anything bigger than "max". However, we
stumbled over this multiple times now, so make it a lot easier to
understand by using a proper comparison.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
handle: drop superfluous out_size in kdbus_memdup_user()

This argument is only used by CMD_ACQUIRE, and it is always equivalent to
*(u64*)p. Lets drop it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
kdbus.txt: mention the possibilty to bind-mount domains into containers