On Wed, Nov 21, 2012 at 04:00:24PM +0100, Petr Spacek wrote:
> Hello,
> 
>       Add macro for LDAP error logging.
> 
> -- 
> Petr^2 Spacek

Ack

> From 1d2c1d3b5024beca92417c0dc65cbfc0f4ddff25 Mon Sep 17 00:00:00 2001
> From: Petr Spacek <pspa...@redhat.com>
> Date: Wed, 21 Nov 2012 15:52:39 +0100
> Subject: [PATCH] Add macro for LDAP error logging.
> 
> Signed-off-by: Petr Spacek <pspa...@redhat.com>
> ---
>  src/log.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/log.h b/src/log.h
> index 
> d6a40151d25b6f67cf6735ec955d45e4ebe4106c..312f24322fd0c6f9943c6beb810ac0bcd8f3896c
>  100644
> --- a/src/log.h
> +++ b/src/log.h
> @@ -54,6 +54,17 @@
>  #define log_debug(level, format, ...)        \
>       log_write(GET_LOG_LEVEL(level), format, ##__VA_ARGS__)
>  
> +/* LDAP logging functions */
> +#define log_ldap_error(ld)                                           \
> +     do {                                                            \
> +             int err;                                                \
> +             char *errmsg = "<UNKNOWN>";                             \
> +             if (ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &err)     \
> +                 == LDAP_OPT_SUCCESS)                                \
> +                     errmsg = ldap_err2string(err);                  \
> +             log_error_position("LDAP error: %s", errmsg);           \
> +     } while (0);                                                    \
> +
>  void
>  log_write(int level, const char *format, ...) ISC_FORMAT_PRINTF(2, 3);
>  
> -- 
> 1.7.11.7
> 


-- 
Adam Tkac, Red Hat, Inc.

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to