1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
/* SPDX-FileCopyrightText: 2012-2023 Greenbone AG
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
/**
* @file
* @brief Header for LDAP-Connect Authentication module.
*/
#ifndef _GVM_UTIL_LDAPUTILS_H
#define _GVM_UTIL_LDAPUTILS_H
#include <glib.h>
/** @brief Authentication schema and address type. */
typedef struct ldap_auth_info *ldap_auth_info_t;
/**
* @brief Schema (dn) and info to use for a basic ldap authentication.
*
* Use like an opaque struct, create with ldap_auth_schema_new, do not modify,
* free with ldap_auth_schema_free.
*/
struct ldap_auth_info
{
gchar *ldap_host; ///< Address of the ldap server, might include port.
gchar *auth_dn; ///< DN to authenticate with.
gboolean allow_plaintext; ///< !Whether or not StartTLS or LDAPS is required.
gboolean ldaps_only; ///< Whether to try LDAPS before StartTLS.
};
int
ldap_enable_debug (void);
int
ldap_connect_authenticate (const gchar *, const gchar *,
/* ldap_auth_info_t */ void *, const gchar *);
void ldap_auth_info_free (ldap_auth_info_t);
ldap_auth_info_t
ldap_auth_info_new (const gchar *, const gchar *, gboolean);
ldap_auth_info_t
ldap_auth_info_new_2 (const gchar *, const gchar *, gboolean, gboolean);
#ifdef ENABLE_LDAP_AUTH
#include <ldap.h>
gchar *
ldap_auth_info_auth_dn (const ldap_auth_info_t, const gchar *);
LDAP *
ldap_auth_bind (const gchar *, const gchar *, const gchar *, gboolean,
const gchar *);
LDAP *
ldap_auth_bind_2 (const gchar *, const gchar *, const gchar *, gboolean,
const gchar *, gboolean);
gboolean
ldap_auth_dn_is_good (const gchar *);
#endif /* ENABLE_LDAP_AUTH */
#endif /* not _GVM_UTIL_LDAPUTILS_H */
|