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>
config API: add missing subdomain target to AD provider test

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
SUDO: AD provider

This patch adds the sudo target to the AD provider. The main reason is
to cover different default settings in the LDAP and AD provider. E.g.
the default for ldap_id_mapping is True in the AD provider and False
in the LDAP provider. If ldap_id_mapping was not set explicitly in the
config file both components worked with different setting.

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

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
config API: read only specific files from schemaplugindir

Currently the config API read any file in the schema plugin dir,
typically /usr/share/sssd/sssd.api.d. If there are any unexpected files,
like e.g. editor copies or backups, the python code might break because
it cannot parse the files.

With this patch only files matching the pattern '^sssd-.*\.conf$' are
read from this directory.

Additionally this patch contains a file which will break the config API
self test if it is not filtered out correctly.

Reviewed-by: Stephen Gallagher <sgallagh@redhat.com>
config API: prepend source dir search path for tests

Instead of appending the search patch in the source directory should be
prepended. Otherwise the test might find files installed in the default
paths of the system first.

As a result the compiled python files in the build directory must be
remove in the clean target to make 'make distcheck' pass.

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
ipa-server-mode: use lower-case user name for home dir

In older IPA server versions where the AD users where looked up by
winbind the user name component of the home directory path was always
lower case.  This still holds for IPA clients as well. To avoid
regression this patch makes the user name component lower case as well.

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

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