aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2006-09-01 02:51:38 +0000
committerKen Raeburn <raeburn@mit.edu>2006-09-01 02:51:38 +0000
commitbf6906d3dd8288fa2b31892f561ddd8d6e03a5a9 (patch)
tree4fc8f77db222d82030cf19b2b3ede3cf331227d7
parent913f504d7d8268b9dba65f936bbb64fba8708125 (diff)
downloadkrb5-bf6906d3dd8288fa2b31892f561ddd8d6e03a5a9.zip
krb5-bf6906d3dd8288fa2b31892f561ddd8d6e03a5a9.tar.gz
krb5-bf6906d3dd8288fa2b31892f561ddd8d6e03a5a9.tar.bz2
Reject old OpenLDAP versions with bugs tickled by this code.
Clean up some warnings during the build. * ldap_misc.c (strptime) [NEED_STRPTIME_PROTO]: Declare, conditionally. (krb5_ldap_errcode_2_string): Return string, not error code, to fit with DAL interface spec. * kdb_ldap.h: Error out for OpenLDAP versions before 2.2.24. (LDAP_DEPRECATED): Define; openldap-2.3.27 defaults to undefined. (krb5_ldap_lib_init): Prototype. (krb5_get_policydn): Declare. (krb5_ldap_errcode_2_string): Fix return type. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18558 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h17
-rw-r--r--src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c10
2 files changed, 21 insertions, 6 deletions
diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h
index 295ba26..81fc6f6 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h
+++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h
@@ -32,7 +32,17 @@
#ifndef _KDB_LDAP_H
#define _KDB_LDAP_H 1
+/* We want the interfaces marked "deprecated" in OpenLDAP. */
+#define LDAP_DEPRECATED 1
#include <ldap.h>
+
+/* Check for acceptable versions. */
+#if defined(LDAP_API_FEATURE_X_OPENLDAP)
+# if LDAP_VENDOR_VERSION < 20224
+# error This code triggers bugs in old OpenLDAP implementations. Please update to 2.2.24 or later.
+# endif
+#endif
+
#include <k5-thread.h>
#include <kdb5.h>
#include "k5-int.h"
@@ -229,7 +239,7 @@ krb5_error_code
krb5_ldap_db_get_age(krb5_context, char *, time_t *);
krb5_error_code
-krb5_ldap_lib_init();
+krb5_ldap_lib_init(void);
krb5_error_code
krb5_ldap_lib_cleanup(void);
@@ -259,6 +269,9 @@ krb5_ldap_read_startup_information(krb5_context );
int
has_sasl_external_mech(krb5_context, char *);
+krb5_error_code
+krb5_get_policydn(krb5_context, krb5_db_entry *, char **);
+
/* DAL functions */
krb5_error_code
@@ -276,7 +289,7 @@ krb5_ldap_supported_realms( krb5_context, char ** );
krb5_error_code
krb5_ldap_free_supported_realms( krb5_context, char ** );
-krb5_error_code
+const char *
krb5_ldap_errcode_2_string( krb5_context, long );
#endif
diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c
index 41cea5f..f64d7d0 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c
+++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c
@@ -33,6 +33,10 @@
#include "ldap_misc.h"
#include "ldap_err.h"
+#ifdef NEED_STRPTIME_PROTO
+extern char *strptime (const char *, const char *, struct tm *);
+#endif
+
/*
* This function reads the parameters from the krb5.conf file. The parameters read here are
* DAL-LDAP specific attributes. Some of these are ldap_port, ldap_server ....
@@ -1505,11 +1509,9 @@ krb5_ldap_free_supported_realms(krb5_context kcontext, char **realms)
return status;
}
-krb5_error_code
+const char *
krb5_ldap_errcode_2_string(krb5_context kcontext, long err_code)
{
- krb5_error_code status = KRB5_PLUGIN_OP_NOTSUPP;
- krb5_set_error_message(kcontext, status, "LDAP %s", error_message(status));
- return status;
+ return error_message(err_code);
}