Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/compat/ldap_compat.h
blob: 039932cafba4a3b203fcd4cb539aeaff9b2f562a (plain)
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
69
70
71
72
73
/*
   ldap_compat.h - provide a replacement definitions for some ldap functions

   Copyright (C) 2009, 2010 Arthur de Jong

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
   02110-1301 USA
*/

#ifndef COMPAT__LDAP_COMPAT_H
#define COMPAT__LDAP_COMPAT_H 1

#include <lber.h>
#include <ldap.h>

/* compatibility macros */
#ifndef LDAP_CONST
#define LDAP_CONST const
#endif /* not LDAP_CONST */
#ifndef LDAP_MSG_ONE
#define LDAP_MSG_ONE 0x00
#endif /* not LDAP_MSG_ONE */

#ifndef HAVE_LDAP_INITIALIZE
/* provide a wrapper around ldap_init() if the system doesn't have
   ldap_initialize() */
int ldap_initialize(LDAP **ldp,const char *url);
#endif /* not HAVE_LDAP_INITIALIZE */

#ifndef HAVE_LDAP_CREATE_PAGE_CONTROL
int ldap_create_page_control(LDAP *ld,unsigned long pagesize,
                             struct berval *cookiep,int iscritical,
                             LDAPControl **ctrlp);
#endif /* not HAVE_LDAP_CREATE_PAGE_CONTROL */

#ifndef HAVE_LDAP_PARSE_PAGE_CONTROL
int ldap_parse_page_control(LDAP *ld,LDAPControl **ctrls,
                            unsigned long *list_countp,
                            struct berval **cookiep);
#endif /* not HAVE_LDAP_PARSE_PAGE_CONTROL */

#ifndef HAVE_LDAP_PASSWD_S
int ldap_passwd_s(LDAP *ld,struct berval *user,struct berval *oldpw,
                  struct berval *newpw,struct berval *newpasswd,
                  LDAPControl **sctrls,LDAPControl **cctrls);
#endif /* not HAVE_LDAP_PASSWD_S */

/* compatibility definition */
#ifndef LDAP_SASL_QUIET
#define LDAP_SASL_QUIET 2U
#endif /* not LDAP_SASL_QUIET */

/* on some systems LDAP_OPT_DIAGNOSTIC_MESSAGE isn't there but
   LDAP_OPT_ERROR_STRING is */
#ifndef LDAP_OPT_DIAGNOSTIC_MESSAGE
#ifdef LDAP_OPT_ERROR_STRING
#define LDAP_OPT_DIAGNOSTIC_MESSAGE LDAP_OPT_ERROR_STRING
#endif /* LDAP_OPT_ERROR_STRING */
#endif /* not LDAP_OPT_DIAGNOSTIC_MESSAGE */

#endif /* COMPAT__LDAP_COMPAT_H */