|
Packit |
6bd9ab |
/*
|
|
Packit |
6bd9ab |
ldap_compat.h - provide a replacement definitions for some ldap functions
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
Copyright (C) 2009-2013 Arthur de Jong
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
This library is free software; you can redistribute it and/or
|
|
Packit |
6bd9ab |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6bd9ab |
License as published by the Free Software Foundation; either
|
|
Packit |
6bd9ab |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
This library is distributed in the hope that it will be useful,
|
|
Packit |
6bd9ab |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6bd9ab |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6bd9ab |
Lesser General Public License for more details.
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6bd9ab |
License along with this library; if not, write to the Free Software
|
|
Packit |
6bd9ab |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit |
6bd9ab |
02110-1301 USA
|
|
Packit |
6bd9ab |
*/
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifndef COMPAT__LDAP_COMPAT_H
|
|
Packit |
6bd9ab |
#define COMPAT__LDAP_COMPAT_H 1
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#include <lber.h>
|
|
Packit |
6bd9ab |
#include <ldap.h>
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* compatibility macros */
|
|
Packit |
6bd9ab |
#ifndef LDAP_CONST
|
|
Packit |
6bd9ab |
#define LDAP_CONST const
|
|
Packit |
6bd9ab |
#endif /* not LDAP_CONST */
|
|
Packit |
6bd9ab |
#ifndef LDAP_MSG_ONE
|
|
Packit |
6bd9ab |
#define LDAP_MSG_ONE 0x00
|
|
Packit |
6bd9ab |
#endif /* not LDAP_MSG_ONE */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifndef HAVE_LDAP_INITIALIZE
|
|
Packit |
6bd9ab |
/* provide a wrapper around ldap_init() if the system doesn't have
|
|
Packit |
6bd9ab |
ldap_initialize() */
|
|
Packit |
6bd9ab |
int ldap_initialize(LDAP **ldp, const char *url);
|
|
Packit |
6bd9ab |
#endif /* not HAVE_LDAP_INITIALIZE */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifndef HAVE_LDAP_CREATE_PAGE_CONTROL
|
|
Packit |
6bd9ab |
int ldap_create_page_control(LDAP *ld, unsigned long pagesize,
|
|
Packit |
6bd9ab |
struct berval *cookiep, int iscritical,
|
|
Packit |
6bd9ab |
LDAPControl **ctrlp);
|
|
Packit |
6bd9ab |
#endif /* not HAVE_LDAP_CREATE_PAGE_CONTROL */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifndef HAVE_LDAP_PARSE_PAGE_CONTROL
|
|
Packit |
6bd9ab |
int ldap_parse_page_control(LDAP *ld, LDAPControl **ctrls,
|
|
Packit |
6bd9ab |
unsigned long *list_countp,
|
|
Packit |
6bd9ab |
struct berval **cookiep);
|
|
Packit |
6bd9ab |
#endif /* not HAVE_LDAP_PARSE_PAGE_CONTROL */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifndef HAVE_LDAP_PASSWD_S
|
|
Packit |
6bd9ab |
int ldap_passwd_s(LDAP *ld, struct berval *user, struct berval *oldpw,
|
|
Packit |
6bd9ab |
struct berval *newpw, struct berval *newpasswd,
|
|
Packit |
6bd9ab |
LDAPControl **sctrls, LDAPControl **cctrls);
|
|
Packit |
6bd9ab |
#endif /* not HAVE_LDAP_PASSWD_S */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifndef HAVE_LDAP_PARSE_PASSWORDPOLICY_CONTROL
|
|
Packit |
6bd9ab |
/* definition lifted from ldap.h */
|
|
Packit |
6bd9ab |
typedef enum passpolicyerror_enum {
|
|
Packit |
6bd9ab |
PP_passwordExpired = 0,
|
|
Packit |
6bd9ab |
PP_accountLocked = 1,
|
|
Packit |
6bd9ab |
PP_changeAfterReset = 2,
|
|
Packit |
6bd9ab |
PP_passwordModNotAllowed = 3,
|
|
Packit |
6bd9ab |
PP_mustSupplyOldPassword = 4,
|
|
Packit |
6bd9ab |
PP_insufficientPasswordQuality = 5,
|
|
Packit |
6bd9ab |
PP_passwordTooShort = 6,
|
|
Packit |
6bd9ab |
PP_passwordTooYoung = 7,
|
|
Packit |
6bd9ab |
PP_passwordInHistory = 8,
|
|
Packit |
6bd9ab |
PP_noError = 65535
|
|
Packit |
6bd9ab |
} LDAPPasswordPolicyError;
|
|
Packit |
6bd9ab |
int ldap_parse_passwordpolicy_control(LDAP *ld, LDAPControl *ctrl,
|
|
Packit |
6bd9ab |
ber_int_t *expirep, ber_int_t *gracep,
|
|
Packit |
6bd9ab |
LDAPPasswordPolicyError *errorp);
|
|
Packit |
6bd9ab |
#endif /* HAVE_LDAP_PARSE_PASSWORDPOLICY_CONTROL */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifndef HAVE_LDAP_PASSWORDPOLICY_ERR2TXT
|
|
Packit |
6bd9ab |
const char *ldap_passwordpolicy_err2txt(LDAPPasswordPolicyError error);
|
|
Packit |
6bd9ab |
#endif /* HAVE_LDAP_PASSWORDPOLICY_ERR2TXT */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifdef REPLACE_LDAP_CREATE_DEREF_CONTROL
|
|
Packit |
6bd9ab |
/* provide a replacement implementation of ldap_create_deref_control() */
|
|
Packit |
6bd9ab |
int replacement_ldap_create_deref_control(LDAP *ld, LDAPDerefSpec *ds,
|
|
Packit |
6bd9ab |
int iscritical, LDAPControl **ctrlp);
|
|
Packit |
6bd9ab |
#define ldap_create_deref_control(ld, dc, iscritical, ctrlp) \
|
|
Packit |
6bd9ab |
replacement_ldap_create_deref_control(ld, dc, iscritical, ctrlp)
|
|
Packit |
6bd9ab |
#endif /* REPLACE_LDAP_CREATE_DEREF_CONTROL */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* compatibility definition */
|
|
Packit |
6bd9ab |
#ifndef LDAP_SASL_QUIET
|
|
Packit |
6bd9ab |
#define LDAP_SASL_QUIET 2U
|
|
Packit |
6bd9ab |
#endif /* not LDAP_SASL_QUIET */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* on some systems LDAP_OPT_DIAGNOSTIC_MESSAGE isn't there but
|
|
Packit |
6bd9ab |
LDAP_OPT_ERROR_STRING is */
|
|
Packit |
6bd9ab |
#ifndef LDAP_OPT_DIAGNOSTIC_MESSAGE
|
|
Packit |
6bd9ab |
#ifdef LDAP_OPT_ERROR_STRING
|
|
Packit |
6bd9ab |
#define LDAP_OPT_DIAGNOSTIC_MESSAGE LDAP_OPT_ERROR_STRING
|
|
Packit |
6bd9ab |
#endif /* LDAP_OPT_ERROR_STRING */
|
|
Packit |
6bd9ab |
#endif /* not LDAP_OPT_DIAGNOSTIC_MESSAGE */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* provide replacement oid definitions */
|
|
Packit |
6bd9ab |
#ifndef LDAP_CONTROL_PWEXPIRED
|
|
Packit |
6bd9ab |
#define LDAP_CONTROL_PWEXPIRED "2.16.840.1.113730.3.4.4"
|
|
Packit |
6bd9ab |
#endif /* LDAP_CONTROL_PWEXPIRED */
|
|
Packit |
6bd9ab |
#ifndef LDAP_CONTROL_PWEXPIRING
|
|
Packit |
6bd9ab |
#define LDAP_CONTROL_PWEXPIRING "2.16.840.1.113730.3.4.5"
|
|
Packit |
6bd9ab |
#endif /* LDAP_CONTROL_PWEXPIRING */
|
|
Packit |
6bd9ab |
#ifndef LDAP_CONTROL_PASSWORDPOLICYREQUEST
|
|
Packit |
6bd9ab |
#define LDAP_CONTROL_PASSWORDPOLICYREQUEST "1.3.6.1.4.1.42.2.27.8.5.1"
|
|
Packit |
6bd9ab |
#endif /* LDAP_CONTROL_PASSWORDPOLICYREQUEST */
|
|
Packit |
6bd9ab |
#ifndef LDAP_CONTROL_PASSWORDPOLICYRESPONSE
|
|
Packit |
6bd9ab |
#define LDAP_CONTROL_PASSWORDPOLICYRESPONSE "1.3.6.1.4.1.42.2.27.8.5.1"
|
|
Packit |
6bd9ab |
#endif /* LDAP_CONTROL_PASSWORDPOLICYRESPONSE */
|
|
Packit |
6bd9ab |
#ifndef LDAP_CONTROL_X_DEREF
|
|
Packit |
6bd9ab |
#define LDAP_CONTROL_X_DEREF "1.3.6.1.4.1.4203.666.5.16"
|
|
Packit |
6bd9ab |
#endif /* LDAP_CONTROL_X_DEREF */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#endif /* COMPAT__LDAP_COMPAT_H */
|