summaryrefslogtreecommitdiffstats
path: root/include/ldaputil
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2009-07-06 12:11:01 -0600
committerRich Megginson <rmeggins@redhat.com>2009-07-07 08:32:42 -0600
commit209521323f731daad54682fd98715f7b22c88c78 (patch)
tree74a1fa8df06641fe543c8518e4db4357ab610828 /include/ldaputil
parent3116dbec570b65d2d0a1df5bd000f6e63439e8ee (diff)
downloadds-209521323f731daad54682fd98715f7b22c88c78.tar.gz
ds-209521323f731daad54682fd98715f7b22c88c78.tar.xz
ds-209521323f731daad54682fd98715f7b22c88c78.zip
OpenLDAP supportcleanup
These changes allow the server to be built with OpenLDAP (2.4.17+). A brief summary of the changes: * #defines not provided by OpenLDAP were copied into slapi-plugin.h and protected with #ifndef blocks * where it made sense, I created slapi wrapper functions for things like URL and LDIF processing to abstract way the differences in the APIs * I created a new file utf8.c which contains the UTF8 functions from MozLDAP - this is only compiled when using OpenLDAP * I tried to clean up the code - use the _ext versions of LDAP functions everywhere since the older versions should be considered deprecated * I removed some unused code NOTE that this should still be considered a work in progress since it depends on functionality not yet present in a released version of OpenLDAP, for NSS crypto and for the LDIF public API.
Diffstat (limited to 'include/ldaputil')
-rw-r--r--include/ldaputil/certmap.h5
-rw-r--r--include/ldaputil/ldapauth.h58
-rw-r--r--include/ldaputil/ldapdb.h130
-rw-r--r--include/ldaputil/ldaputil.h8
4 files changed, 8 insertions, 193 deletions
diff --git a/include/ldaputil/certmap.h b/include/ldaputil/certmap.h
index ccfa7fe5..7e1fe6c5 100644
--- a/include/ldaputil/certmap.h
+++ b/include/ldaputil/certmap.h
@@ -150,11 +150,6 @@ NSAPI_PUBLIC void *ldapu_realloc (void *ptr, int size);
NSAPI_PUBLIC void ldapu_free (void *ptr);
-NSAPI_PUBLIC int ldapu_string_set (const int type, const char *filter);
-
-
-NSAPI_PUBLIC const char *ldapu_string_get (const int type);
-
NSAPI_PUBLIC int ldaputil_exit ();
#ifdef __cplusplus
diff --git a/include/ldaputil/ldapauth.h b/include/ldaputil/ldapauth.h
index c2c7f99b..fc1ab934 100644
--- a/include/ldaputil/ldapauth.h
+++ b/include/ldaputil/ldapauth.h
@@ -54,9 +54,6 @@
#endif
#endif
-typedef int (*LDAPU_GroupCmpFn_t)(const void *groupids, const char *group,
- const int len);
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -69,61 +66,6 @@ int ldapu_find_entire_tree (LDAP *ld, int scope,
const char *filter, const char **attrs,
int attrsonly, LDAPMessage ***res);
-extern int ldapu_auth_userdn_groupdn (LDAP *ld, const char *userdn,
- const char *groupdn,
- const char *base);
-
-extern int ldapu_auth_uid_groupdn (LDAP *ld, const char *uid,
- const char *groupdn, const char *base);
-
-extern int ldapu_auth_uid_groupid (LDAP *ld, const char *uid,
- const char *groupid, const char *base);
-
-extern int ldapu_auth_userdn_groupid (LDAP *ld,
- const char *userdn, const char *groupid,
- const char *base);
-
-extern int ldapu_auth_userdn_groupids (LDAP *ld, const char *userdn,
- void *groupids,
- LDAPU_GroupCmpFn_t grpcmpfn,
- const char *base,
- char **group_out);
-
-extern int ldapu_auth_userdn_attrfilter (LDAP *ld,
- const char *userdn,
- const char *attrfilter);
-
-extern int ldapu_auth_uid_attrfilter (LDAP *ld, const char *uid,
- const char *attrfilter,
- const char *base);
-
-extern int ldapu_auth_userdn_password (LDAP *ld,
- const char *userdn,
- const char *password);
-
-extern int ldapu_find_uid_attrs (LDAP *ld, const char *uid,
- const char *base, const char **attrs,
- int attrsonly, LDAPMessage **res);
-
-extern int ldapu_find_uid (LDAP *ld, const char *uid,
- const char *base, LDAPMessage **res);
-
-NSAPI_PUBLIC extern int ldapu_find_userdn (LDAP *ld, const char *uid,
- const char *base, char **dn);
-
-extern int ldapu_find_group_attrs (LDAP *ld, const char *groupid,
- const char *base, const char **attrs,
- int attrsonly, LDAPMessage **res);
-
-extern int ldapu_find_group (LDAP *ld, const char *groupid,
- const char *base, LDAPMessage **res);
-
-extern int ldapu_find_groupdn (LDAP *ld, const char *groupid,
- const char *base, char **dn);
-
-extern int ldapu_auth_uid_password (LDAP *ld, const char *uid,
- const char *password, const char *base);
-
#ifdef __cplusplus
}
#endif
diff --git a/include/ldaputil/ldapdb.h b/include/ldaputil/ldapdb.h
deleted file mode 100644
index 5a768f59..00000000
--- a/include/ldaputil/ldapdb.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifndef _LDAPU_LDAPDB_H
-#define _LDAPU_LDAPDB_H
-
-#include <ldap.h>
-/* In the past, we used CRITICAL objects from lib/base/crit.cpp.
- * Now we use PRMonitor to avoid ldapu to depend on lib/base.
- */
-#include <prmon.h>
-
-#ifndef NSAPI_PUBLIC
-#ifdef XP_WIN32
-#define NSAPI_PUBLIC __declspec(dllexport)
-#else
-#define NSAPI_PUBLIC
-#endif
-#endif
-
-#define LDAPDB_URL_PREFIX "ldapdb:"
-#define LDAPDB_URL_PREFIX_LEN 7
-
-typedef struct {
- int use_ssl; /* Set to 0 in case of local LDAP cache */
- char *host; /* Set to 0 in case of local LDAP cache */
- int port; /* Set to 0 in case of local LDAP cache */
- char *basedn;
- char *scope;
- char *filter;
- LDAP *ld;
- char *binddn; /* Set to 0 in case of local LDAP cache */
- char *bindpw; /* Set to 0 in case of local LDAP cache */
- int bound; /* If 0 then not bound with binddn & bindpw */
- PRMonitor* crit;/* to control critical sections */
-} LDAPDatabase_t;
-
-#define LDAPU_ATTR_BINDDN "binddn"
-#define LDAPU_ATTR_BINDPW "bindpw"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-NSAPI_PUBLIC extern int ldapu_url_parse (const char *url, const char *binddn,
- const char *bindpw,
- LDAPDatabase_t **ldb);
-
-NSAPI_PUBLIC extern int ldapu_ldapdb_url_parse (const char *url,
- LDAPDatabase_t **ldb);
-
-NSAPI_PUBLIC extern int ldapu_is_local_db (const LDAPDatabase_t *ldb);
-
-NSAPI_PUBLIC extern void ldapu_free_LDAPDatabase_t (LDAPDatabase_t *ldb);
-
-NSAPI_PUBLIC extern LDAPDatabase_t *ldapu_copy_LDAPDatabase_t (const LDAPDatabase_t *ldb);
-
-NSAPI_PUBLIC extern int ldapu_ldap_init (LDAPDatabase_t *ldb);
-
-NSAPI_PUBLIC extern int ldapu_ldap_init_and_bind (LDAPDatabase_t *ldb);
-
-NSAPI_PUBLIC extern int ldapu_ldap_rebind (LDAPDatabase_t *ldb);
-
-NSAPI_PUBLIC extern int ldapu_ldap_reinit_and_rebind (LDAPDatabase_t *ldb);
-
-#ifdef __cplusplus
-}
-#endif
-
-/*
- * LDAPU_REQ --
- * 'ld' is cached in the 'ldb' structure. If the LDAP server goes down since
- * it was cached, the ldap lookup commands fail with LDAP_SERVER_DOWN. This
- * macro can be used to rebind to the server and retry the command once if
- * this happens.
- */
-#define LDAPU_REQ(rv, ldb, cmd) \
-{ \
- int numtry = 0; \
- while(1) { \
- rv = cmd; \
- if (rv != LDAP_SERVER_DOWN || numtry++ != 0) break; \
- /* Server went down since our last ldap lookup ... reconnect */ \
- rv = ldapu_ldap_reinit_and_rebind(ldb); \
- if (rv != LDAPU_SUCCESS) break; \
- } \
-}
-
-
-#endif /* LDAPUTIL_LDAPDB_H */
diff --git a/include/ldaputil/ldaputil.h b/include/ldaputil/ldaputil.h
index c8ce8a2e..e9e0fb51 100644
--- a/include/ldaputil/ldaputil.h
+++ b/include/ldaputil/ldaputil.h
@@ -135,6 +135,14 @@ NSAPI_PUBLIC extern int ldapu_list_add_info (LDAPUList_t *list, void *info);
#define USE_LDAP_SSL
#endif
+#ifndef LDAP_CALL
+#define LDAP_CALL
+#endif
+
+#ifndef LDAP_CALLBACK
+#define LDAP_CALLBACK
+#endif
+
typedef struct {
#ifdef USE_LDAP_SSL
LDAP* (LDAP_CALL LDAP_CALLBACK *ldapuV_ssl_init) ( const char*, int, int );