Fix DEBUG message formatting
LDAP: Setup periodic task only once.

If id provider is {ipa, ad} periodic task will be stared in sssm_{ipa,ad}_init
If you enable enumeration and use different providers for id and sudo(autofs)
then another periodic task will be scheduled.
This can cause weird behaviour (e.g. missing members of group)

Perodic tasks will be started only by id_provider.

Resolves:
https://fedorahosted.org/sssd/ticket/2153

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
UTIL: Sanitize whitespaces.

Original patches submitted by: mpesari(Thanks!!)

It can cause problems if user will hit spaces before entering username.
(e.g in gdm). Spaces are ignored by LDAP; it's better to escape them.

Resolves:
https://fedorahosted.org/sssd/ticket/1955

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
IDMAP: add sss_idmap_check_collision(_ex)

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
IPA: refactor idmap code and add test

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
IPA: check ranges for collisions before saving them

Fixes https://fedorahosted.org/sssd/ticket/2253

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
OPTS: Allow using defaults for blobs

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
DP: Provide separate dp_copy_defaults function

https://fedorahosted.org/sssd/ticket/2257

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
MAN: Clarify the ldap_access_filter option further

https://fedorahosted.org/sssd/ticket/2235

The memberof example was misleading and was making aministrators think
that the ldap_access_filter can resolve nested group memberships.

Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Stephen Gallagher <sgallagh@redhat.com>
MAN: Clarify that changing ID mapping options might require purging the cache

https://fedorahosted.org/sssd/ticket/2252

Currently SSSD chokes when IDs of users change, we don't support ID
changes yet. Because some users were confused about the failures, this
patch adds additional clarification.

Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Stephen Gallagher <sgallagh@redhat.com>
KRB5: Fix condition for empty string

Reported by: cppcheck

Finding the same expression on both sides of an operator || is suspicious and
might indicate a cut and paste or logic error.

Resolves:
https://fedorahosted.org/sssd/ticket/2258

Reviewed-by: Michal Žídek <mzidek@redhat.com>
NSS: Fix warning access array with index then check

Reported by:cppcheck

Defensive programming: The variable 'i' is used as an array index
before it is checked that is within limits. This can mean that the array might
be accessed out of bounds.

This patch eorder condition such as '(a[i] && i <blen) to
(i < blen && a[i]). That way the array will not be accessed if the index
is out of limits.

Reviewed-by: Michal Žídek <mzidek@redhat.com>
TEST: Fix warning invalid printf argument type

Reported by: cppcheck

"%d" in format string (no. 1) requires 'int' but the argument type is
'unsigned int'

Reviewed-by: Michal Žídek <mzidek@redhat.com>
Remove unused structures.

Reported by: cppcheck

'struct py_sss_transaction', 'struct resolve_get_domain_stat',
'struct sync_op_res' were defined in implementation modules, but they were not
used anywhere.

Reviewed-by: Michal Žídek <mzidek@redhat.com>
libsss_idmap: bump version-info

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
providers: Fix types passed to dbus varargs functions

Fix some incorrect types passed to dbus_message_get_args(),
dbus_message_append_args() or functions accepting similar
varargs and types.

In particular sizeof(bool) != sizeof(dbus_bool_t) on most
platforms. This probably only worked because the compiler
was aligning stack variables and so writing off the end of
one of them wasn't the end of the world.

In addition fix cases where int != int32_t != uint32_t.
Although these will work on many common platforms, assuming
these are interchangeable is not cross platform safe.
sbus: Add struct sbus_request to represent a DBus invocation

struct sbus_request represents a request from a dbus client
being handled by a dbus server implementation. The struct
contains the message, connection and method (and in the
future teh property) which is being requested.

In the future it will contain caller information as well.

sbus_request is a talloc memory context, and is a good place to
attach any allocations and memory specific to the request.

Each handler accepts an sbus_request. If a handler returns
EOK, it is assumed that the handler will finish the request.
Any of the sbus_request_*finish() methods can be used to
complete the request and send back a reply.

sbus_request_return_and_finish() uses the same argument
varargs syntax as dbus_message_append_args(), which isn't
a great syntax. Document it a bit, but don't try to redesign:
The marshalling work (will follow this patch set) will remove
the need to use varargs for most DBus implementation code.

This patch migrates the monitor and data provider dbus code
to use sbus_request, but does not try to rework the talloc
context's to use it.
sbus: Refactor how we export DBus interfaces

Most importantly, stop using per connection private data. This doesn't
scale when you have more than one thing exporting or exported on a
connection.

Remove struct sbus_interface and expand sbus_conn_add_interface()
function. Remove various struct sbus_interface args to connection
initialization functions and make callers use sbus_conn_add_interface()
directly. The old method was optimized for exporting one interface
on a connection. We'll have connections that export zero, one or more
interfaces.

To export an interface on a DBus server, call sbus_conn_add_interface()
from within the sbus_server_conn_init_fn. To export an interface on
a DBus client, call sbus_conn_add_interface() after sbus_new_connection()
returns.

As before struct sbus_interface represents an object exported via DBus.
However it is now talloc allocated. One can set instance data on the
struct sbus_interface. This instance data is passed to the various
handlers and used in their implementation.

However, we now have type safe interface exporting in the various
high level sss_process_init() sss_monitor_init() and so on.

Introspection support was not in use, and is now gone until we
implement it using the metadata (future patch).
sbus: Make sbus_new_server() work for non-priveleged processes

I'd like to use this during testing. We should check that the
socket ownership is the same as the process, rather than limiting
it to root.
sbus_tests: Add some testing of dispatch and handler code

This starts a DBus server with some handlers, and runs some method
calls against it.

Note that we don't use the codegen in the sbus_tests, as we sorta
want to test this non-codegen related functionality on its own before
we run the sbus_codegen_tests.