[SSSD] [PATCH 0/4] [RFC] Introduce SSSD specific error values.

Simo Sorce simo at redhat.com
Sat Nov 24 04:58:22 UTC 2012


For a long time I felt constrained using just the error values that
are available in system headers, they do not express the full range
of errors we need to express within SSSD.

So this is a RFC patchset that demonstrates how we could about getting
a richer set of error messages for SSSD that should also simplify some
of our most convoluted code when it comes to returning errors.

The first patch just introduces a very simple error number space and 2
basic errors we always missed. ERR_INTERNAL is what we wanted to use in
many places where we currently return EIO or EFAULT for example.

Patch 2 shows how we can dramatically improve error reporting for our
offline caching authentication code with just a few more targeted errors.
The main thing to note here is that now we can safely distinguish from
a real system error about a missing file (ENOENT) and actually missing
account.

Patch 3 is just an example of fixing EIO in a commonly used macro.

Patch 4 is the most complex example of converting a whole subsystem
that is really complex in its error handling.
Even after the recent refactoring patchesi, krb5_child error reporting
remained quite complex as it uses all of errno, krb5 and pam status
error codes.

The result is that we have to track multiple different error variables
and that can easily lead to hard to read code as well as bugs where one
error code does not reflect into others.
With this patch I think we show how we are able to reduce the complexity
of error handling and at the same time return precise information on what
is worng.

NOTE: This patchset depends on my previous patches for refactoring the
krb5_child as well as the patches that kix the krb5_auth style and the
patches that introduce the authtoken structure.

Simo.

Simo Sorce (4):
  Add SSSD specific error codes and definitions
  Use SSSD specific errors for offline auth
  Return ERR_INTERNAL instead of EIO
  Cleanup error message handling for krb5 child

 Makefile.am                     |    4 +-
 src/db/sysdb_ops.c              |   17 +-
 src/providers/krb5/krb5_auth.c  |  157 +++++++++-------
 src/providers/krb5/krb5_child.c |  388 ++++++++++++++++-----------------------
 src/tests/auth-tests.c          |    6 +-
 src/tests/sysdb-tests.c         |   12 +-
 src/util/auth_utils.h           |   22 ++-
 src/util/util.h                 |   10 +-
 src/util/util_errors.c          |   50 +++++
 src/util/util_errors.h          |   85 +++++++++
 10 files changed, 417 insertions(+), 334 deletions(-)
 create mode 100644 src/util/util_errors.c
 create mode 100644 src/util/util_errors.h




More information about the sssd-devel mailing list