summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4352df7)
raw | patch | inline | side by side (parent: 4352df7)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Wed, 20 Aug 2014 10:28:09 +0000 (12:28 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Fri, 29 Aug 2014 13:09:55 +0000 (15:09 +0200) |
src/openldap.c | patch | blob | history |
diff --git a/src/openldap.c b/src/openldap.c
index 46d92679fdc0df7f70b95f36f6f6a83693bc0c52..99b719ae63e7946c64174dcb18407069bebc2681 100644 (file)
--- a/src/openldap.c
+++ b/src/openldap.c
static void ldap_free (ldap_t *st) /* {{{ */
{
- if(st == NULL)
+ if (st == NULL)
return;
sfree (st->cacert);
sfree (st->host);
sfree (st->name);
sfree (st->url);
- if(st->ld)
- ldap_memfree(st->ld);
+ if (st->ld)
+ ldap_memfree (st->ld);
sfree (st);
} /* }}} void ldap_free */
+
/* initialize ldap for each host */
static int ldap_init_host (ldap_t *st) /* {{{ */
{
ldap_set_option (st->ld, LDAP_OPT_TIMEOUT,
&(const struct timeval){st->timeout, 0});
- if(st->cacert != NULL)
+ if (st->cacert != NULL)
ldap_set_option (st->ld, LDAP_OPT_X_TLS_CACERTFILE, st->cacert);
- if(st->verifyhost == 0)
+ if (st->verifyhost == 0)
{
int never = LDAP_OPT_X_TLS_NEVER;
ldap_set_option (st->ld, LDAP_OPT_X_TLS_REQUIRE_CERT, &never);
}
- if(st->starttls != 0)
+ if (st->starttls != 0)
{
- rc = ldap_start_tls_s(ld, NULL, NULL);
+ rc = ldap_start_tls_s (ld, NULL, NULL);
if (rc != LDAP_SUCCESS)
{
ERROR ("openldap plugin: Failed to start tls on %s: %s",
st->url, ldap_err2string (rc));
st->state = 0;
- ldap_unbind_ext_s(st->ld, NULL, NULL);
+ ldap_unbind_ext_s (st->ld, NULL, NULL);
return (-1);
}
}
cred.bv_val = "";
cred.bv_len = 0;
- rc = ldap_sasl_bind_s(st->ld, NULL, NULL, &cred, NULL, NULL, NULL);
+ rc = ldap_sasl_bind_s (st->ld, NULL, NULL, &cred, NULL, NULL, NULL);
if (rc != LDAP_SUCCESS)
{
ERROR ("openldap plugin: Failed to bind to %s: %s",
st->url, ldap_err2string (rc));
st->state = 0;
- ldap_unbind_ext_s(st->ld, NULL, NULL);
+ ldap_unbind_ext_s (st->ld, NULL, NULL);
return (-1);
}
else
LDAPURLDesc *ludpp;
int rc;
- if ((rc = ldap_url_parse( st->url, &ludpp)) != 0)
+ if ((rc = ldap_url_parse (st->url, &ludpp)) != 0)
{
ERROR ("openldap plugin: Instance `%s': "
"Invalid URL: `%s'",
st->host = strdup (ludpp->lud_host);
}
- ldap_free_urldesc(ludpp);
+ ldap_free_urldesc (ludpp);
}
if (status == 0)
/* Initialize LDAP library while still single-threaded as recommended in
* ldap_initialize(3) */
int debug_level;
- ldap_get_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug_level);
+ ldap_get_option (NULL, LDAP_OPT_DEBUG_LEVEL, &debug_level);
return (0);
-
} /* }}} int ldap_init */
void module_register (void) /* {{{ */