[Date Prev][Date Next] [Chronological] [Thread] [Top]

librewrite & co vs. logging & ldap-int.h



The ITS#6625 patch causes preprocessor warnings about conflicts
with ldap-int.h, so I'm looking again at old ITS#5421 to kill off

    #include "...libldap/ldap-int.h"

These occur in librewrite, rwm, back-ldap and back-meta.

The #include is for two things: Expose struct ldapmsg & LDAP_FREE, the
need of which I've just removed in HEAD, and set up libldap logging.

I expect the slapd components just as well can drop the #include and
use slapd logging?  back-*/search.c then need lber-int.h instead.

librewrite still needs the #define ldap_debug in ldap-int.h.
Instead we could either:

(1) use liblber logging in librewrite,

(2) or throw the code LDAP_INT_IN_KERNEL .. #endif /* LDAP_DEBUG */
out of ldap-int.h to a separate file, either include/ldap_log.h or
something like libldap/ldap-int-log.h.  This file would not expose
structs with different definitions depending on LDAP_R_COMPILE & co.

Since the file when not LDAP_INT_IN_KERNEL does need to refer
ldap_debug to ldap_int_global_options.ldo_debug, that can be done with:

  /* This struct starts with the same members as ldapoptions */
  struct ldapoptions_prefix {
      short ldo_valid;
      int   ldo_debug;
  };
  #define ldap_debug \
          (*(int *) ((char *) &ldap_int_global_options \
                     + offsetof(struct ldapoptions_prefix, ldo_debug)))

  struct ldapoptions;
  LDAP_V ( struct ldapoptions ) ldap_int_global_options;


Opinions?  Put it in ldap-int.h, or ldap_log.h?  Maybe the latter
only if #defined LDAP_LIBRARY_LOGGING (defined by the user)?

-- 
Hallvard