Move non-config-related macros to from sudo_ldap_conf.h to sudo_ldap.h.

This commit is contained in:
Todd C. Miller
2023-03-17 10:59:30 -06:00
parent f5d0b7abf7
commit 70c533ec79
2 changed files with 45 additions and 45 deletions

View File

@@ -19,51 +19,6 @@
#ifndef SUDOERS_LDAP_CONF_H
#define SUDOERS_LDAP_CONF_H
/* Macros for checking strlcpy/strlcat/sudo_ldap_value_cat return value. */
#define CHECK_STRLCPY(d, s, l) do { \
if (strlcpy((d), (s), (l)) >= (l)) { \
goto overflow; \
} \
} while (0)
#define CHECK_STRLCAT(d, s, l) do { \
if (strlcat((d), (s), (l)) >= (l)) { \
goto overflow; \
} \
} while (0)
#define CHECK_LDAP_VCAT(d, s, l) do { \
if (sudo_ldap_value_cat((d), (s), (l)) >= (l)) { \
goto overflow; \
} \
} while (0)
#if defined(__GNUC__) && __GNUC__ == 2
# define DPRINTF1(fmt...) do { \
sudo_debug_printf(SUDO_DEBUG_DIAG, fmt); \
if (ldap_conf.debug >= 1) { \
sudo_warnx_nodebug(fmt); \
} \
} while (0)
# define DPRINTF2(fmt...) do { \
sudo_debug_printf(SUDO_DEBUG_INFO, fmt); \
if (ldap_conf.debug >= 2) { \
sudo_warnx_nodebug(fmt); \
} \
} while (0)
#else
# define DPRINTF1(...) do { \
sudo_debug_printf(SUDO_DEBUG_DIAG, __VA_ARGS__); \
if (ldap_conf.debug >= 1) { \
sudo_warnx_nodebug(__VA_ARGS__); \
} \
} while (0)
# define DPRINTF2(...) do { \
sudo_debug_printf(SUDO_DEBUG_INFO, __VA_ARGS__); \
if (ldap_conf.debug >= 2) { \
sudo_warnx_nodebug(__VA_ARGS__); \
} \
} while (0)
#endif
/*
* Configuration data types.
* When adding a new data type, be sure to update sudo_ldap_parse_keyword()