diff options
author | W. Michael Petullo <mike@flyn.org> | 2008-05-01 09:57:32 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2008-05-01 09:59:43 -0400 |
commit | 29ddbc610ccc14eb70dcb7ffde7c1f5cc2b95203 (patch) | |
tree | 39e068a8915beb83b88baa8bb652c0d6cfe02f95 /ipa-client/ipa-getkeytab.c | |
parent | 274eb708c28abf25087c3656ec93370c2000efd3 (diff) | |
download | freeipa-29ddbc610ccc14eb70dcb7ffde7c1f5cc2b95203.tar.gz freeipa-29ddbc610ccc14eb70dcb7ffde7c1f5cc2b95203.tar.xz freeipa-29ddbc610ccc14eb70dcb7ffde7c1f5cc2b95203.zip |
This patch begins the process of replacing OpenLDAP with mozldap.
FreeIPA relies on RedHat's Directory Server, which uses mozldap.
A FreeIPA build using mozldap would reduce the project's dependencies and
redundant code. In addition, mozldap uses NSS instead of OpenSSL.
This is beneficial for the reasons listed in [1].
[1] http://fedoraproject.org/wiki/FedoraCryptoConsolidation
Diffstat (limited to 'ipa-client/ipa-getkeytab.c')
-rw-r--r-- | ipa-client/ipa-getkeytab.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/ipa-client/ipa-getkeytab.c b/ipa-client/ipa-getkeytab.c index 28859a7f..96426509 100644 --- a/ipa-client/ipa-getkeytab.c +++ b/ipa-client/ipa-getkeytab.c @@ -31,7 +31,11 @@ #include <errno.h> #include <time.h> #include <krb5.h> +#ifdef WITH_MOZLDAP +#include <mozldap/ldap.h> +#else #include <ldap.h> +#endif #include <sasl/sasl.h> #include <popt.h> @@ -275,7 +279,6 @@ static int ldap_set_keytab(const char *servername, BerElement *ctrl = NULL; BerElement *sctrl = NULL; struct berval *control = NULL; - char *ldap_uri = NULL; struct berval **ncvals; char *ldap_base = NULL; char *retoid = NULL; @@ -306,23 +309,16 @@ static int ldap_set_keytab(const char *servername, goto error_out; } - /* connect to ldap server */ - ret = asprintf(&ldap_uri, "ldap://%s:389", servername); - if (ret == -1) { - fprintf(stderr, "Unable to determine server URI!\n"); - goto error_out; - } - /* TODO: support referrals ? */ - ret = ldap_initialize(&ld, ldap_uri); - if(ret != LDAP_SUCCESS) { + ld = ldap_init(servername, 389); + if(ld == NULL) { fprintf(stderr, "Unable to initialize ldap library!\n"); goto error_out; } version = LDAP_VERSION3; ret = ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version); - if (ret != LDAP_OPT_SUCCESS) { + if (ret != LDAP_SUCCESS) { fprintf(stderr, "Unable to set ldap options!\n"); goto error_out; } @@ -427,8 +423,7 @@ static int ldap_set_keytab(const char *servername, ber_free(sctrl, 1); ldap_controls_free(srvctrl); ldap_msgfree(res); - ldap_unbind_ext_s(ld, NULL, NULL); - free(ldap_uri); + ldap_unbind_ext(ld, NULL, NULL); return kvno; error_out: @@ -436,8 +431,7 @@ error_out: if (srvctrl) ldap_controls_free(srvctrl); if (err) ldap_memfree(err); if (res) ldap_msgfree(res); - if (ld) ldap_unbind_ext_s(ld, NULL, NULL); - if (ldap_uri) free(ldap_uri); + if (ld) ldap_unbind_ext(ld, NULL, NULL); if (control) ber_bvfree(control); if (encs) free(encs); return 0; |