[SSSD] [PATCH] SDAP: augmented logging for group saving

Jakub Hrozek jhrozek at redhat.com
Thu Apr 17 15:30:45 UTC 2014


On Tue, Apr 15, 2014 at 04:25:50PM +0200, Pavel Reichl wrote:
> Hello,
> 
> some more generally useful logging messages are needed for that
> bugzilla.
> 
> Patches for both master and 1.11 are attached.
> 
> Thanks for review!

It would be nice to explain in the commit message why you used TRACE_LIBS
for the messages and not i.e OP_FAILURE.

> 
> On Wed, 2014-04-09 at 14:29 +0200, Pavel Reichl wrote:
> > Hello, 
> > 
> > please see attached patch. 
> > 
> > This patch was previously written for BZ 1059423. But it now seems that
> > more detailed logging information is generally useful for issues that
> > are emerging from this area lately.
> > 
> > Pavel Reichl
> 
> 

> From e7e4a06098bce4df600370274babe470b0d71c47 Mon Sep 17 00:00:00 2001
> From: Pavel Reichl <reichl.pavel at gmail.com>
> Date: Mon, 14 Apr 2014 17:27:23 +0100
> Subject: [PATCH] SDAP: augmented logging when adding new group
> 
> Resolves:
>     https://fedorahosted.org/sssd/ticket/2239
> ---
>  src/db/sysdb_ops.c                     | 92 +++++++++++++++++++++++++++++-----
>  src/providers/ldap/sdap_async_groups.c |  2 +-
>  2 files changed, 81 insertions(+), 13 deletions(-)
> 
> diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
> index 95354d98806a13cf142705dc304b7810b8ee82f4..559f8b51813fa499ec21d9e78189910cacc7b32a 100644
> --- a/src/db/sysdb_ops.c
> +++ b/src/db/sysdb_ops.c
> @@ -1428,7 +1428,15 @@ int sysdb_add_group(struct sysdb_ctx *sysdb,
>          ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain,
>                                          name, NULL, &msg);
>          if (ret != ENOENT) {
> -            if (ret == EOK) ret = EEXIST;
> +            if (ret == EOK) {
> +                DEBUG(SSSDBG_TRACE_LIBS, ("MPG domain is having a user "

"...domain contains..."

> +                                          "with the same name - %s.\n", name));
> +                ret = EEXIST;
> +            } else {
> +                DEBUG(SSSDBG_TRACE_LIBS,
> +                      ("sysdb_search_user_by_name failed for user %s.\n",
> +                       name));
> +            }
>              goto done;
>          }
>      }

[snip]

>                  goto done;
>              }
>              DEBUG(SSSDBG_MINOR_FAILURE,
>                    ("A group with the same GID [%llu] was removed from the "
>                     "cache\n", (unsigned long long) gid));

If you're touching the code anyway, can you change the DEBUG calls to
use SPRIgid here as well?

> +
>              ret = sysdb_add_group(sysdb, domain, name, gid,
>                                    attrs, cache_timeout, now);
> +            if (ret) {
> +                DEBUG(SSSDBG_MINOR_FAILURE,
> +                      ("sysdb_add_group failed (while renaming group) for: "
> +                       "%s [%"SPRIgid"].\n", name, gid));
> +            }
>          }
>          goto done;
>      }



More information about the sssd-devel mailing list