diff options
| author | Ken Raeburn <raeburn@mit.edu> | 2006-10-07 06:10:27 +0000 |
|---|---|---|
| committer | Ken Raeburn <raeburn@mit.edu> | 2006-10-07 06:10:27 +0000 |
| commit | daeeb865c329f2eb00eadb9f6d2e344f8c2d0e57 (patch) | |
| tree | 95453683a173d81852da71cf2f6c2aee97f9ea2d /src/plugins/kdb | |
| parent | 38e3f1e5b424cab804b371b4b9cc27c979b21544 (diff) | |
| download | krb5-daeeb865c329f2eb00eadb9f6d2e344f8c2d0e57.tar.gz krb5-daeeb865c329f2eb00eadb9f6d2e344f8c2d0e57.tar.xz krb5-daeeb865c329f2eb00eadb9f6d2e344f8c2d0e57.zip | |
Check for ldap_initialize and other functions that Solaris (Mozilla-based)
LDAP does not provide, and define versions a couple of them if needed.
Based on patches from and discussions with Will Fiveash.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18665 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/plugins/kdb')
| -rw-r--r-- | src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h | 9 | ||||
| -rw-r--r-- | src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c | 51 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h index a8ec7aa6d..93a47acf9 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h +++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h @@ -304,4 +304,13 @@ krb5_ldap_errcode_2_string( krb5_context, long ); void krb5_ldap_release_errcode_string (krb5_context, const char *); +#ifndef HAVE_LDAP_INITIALIZE +int +ldap_initialize(LDAP **, char *); +#endif +#ifndef HAVE_LDAP_UNBIND_EXT_S +int +ldap_unbind_ext_s(LDAP *, LDAPControl **, LDAPControl **); +#endif + #endif diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c index f7275916a..6a767fe68 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c @@ -1845,3 +1845,54 @@ krb5_error_code remove_overlapping_subtrees(char **listin, char ***listop, int * } return 0; } + +/* + * Solaris libldap does not provide the following functions which are in + * OpenLDAP. + */ +#ifndef HAVE_LDAP_INITIALIZE +int +ldap_initialize(LDAP **ldp, char *url) +{ + int rc = 0; + LDAP *ld = NULL; + LDAPURLDesc *ludp = NULL; + + /* For now, we don't use any DN that may be provided. And on + Solaris (based on Mozilla's LDAP client code), we need the + _nodn form to parse "ldap://host" without a trailing slash. + + Also, this version won't handle an input string which contains + multiple URLs, unlike the OpenLDAP ldap_initialize. See + https://bugzilla.mozilla.org/show_bug.cgi?id=353336#c1 . */ +#ifdef HAVE_LDAP_URL_PARSE_NODN + rc = ldap_url_parse_nodn(url, &ludp); +#else + rc = ldap_url_parse(url, &ludp); +#endif + if (rc == 0) { + + ld = ldap_init(ludp->lud_host, ludp->lud_port); + if (ld != NULL) { + *ldp = ld; +#if 0 + printf("lud_host %s lud_port %d\n", ludp->lud_host, + ludp->lud_port); +#endif + } + else + rc = KRB5_KDB_ACCESS_ERROR; + + ldap_free_urldesc(ludp); + } + return rc; +} +#endif /* HAVE_LDAP_INITIALIZE */ + +#ifndef HAVE_LDAP_UNBIND_EXT_S +int +ldap_unbind_ext_s(LDAP *ld, LDAPControl **sctrls, LDAPControl **cctrls) +{ + return ldap_unbind_ext(ld, sctrls, cctrls); +} +#endif /* HAVE_LDAP_UNBIND_EXT_S */ |
