cosmetics in debug output

This commit is contained in:
Andreas Steffen
2007-04-06 10:35:13 +00:00
parent f5fc277463
commit babdde4fa4
2 changed files with 27 additions and 16 deletions
+2 -2
View File
@@ -196,7 +196,7 @@ static void add_crl(private_ca_info_t *this, crl_t *crl)
else else
{ {
crl->destroy(crl); crl->destroy(crl);
DBG1(" this crl is older - existing crl retained"); DBG1(" this crl is not newer - existing crl retained");
} }
} }
else else
@@ -505,7 +505,7 @@ static cert_status_t verify_by_crl(private_ca_info_t* this, certinfo_t *certinfo
else else
{ {
crl->destroy(crl); crl->destroy(crl);
DBG1("this crl is older - existing crl retained"); DBG1("this crl is not newer - existing crl retained");
continue; continue;
} }
if (crl->is_valid(crl)) if (crl->is_valid(crl))
+25 -14
View File
@@ -83,7 +83,7 @@ static size_t curl_write_buffer(void *ptr, size_t size, size_t nmemb, void *data
} }
/** /**
* Implements fetcher_t.get for http[s] and file URIs * Implements fetcher_t.get for curl methods
*/ */
static chunk_t curl_get(private_fetcher_t *this) static chunk_t curl_get(private_fetcher_t *this)
{ {
@@ -114,8 +114,7 @@ static chunk_t curl_get(private_fetcher_t *this)
} }
else else
{ {
DBG1("curl request to '%s' failed: %s", DBG1("curl request failed: %s", curl_error_buffer);
this->uri, curl_error_buffer);
} }
curl_free(curl_response.ptr); curl_free(curl_response.ptr);
} }
@@ -167,8 +166,7 @@ static chunk_t http_post(private_fetcher_t *this, const char *request_type, chun
} }
else else
{ {
DBG1("http post request to '%s' using libcurl failed: %s", DBG1("http post request using libcurl failed: %s", curl_error_buffer);
this->uri, curl_error_buffer);
} }
curl_slist_free_all(headers); curl_slist_free_all(headers);
curl_free(curl_response.ptr); curl_free(curl_response.ptr);
@@ -181,13 +179,15 @@ static chunk_t http_post(private_fetcher_t *this, const char *request_type, chun
#ifdef LIBLDAP #ifdef LIBLDAP
/** /**
* parses the result returned by an ldap query * Parses the result returned by an ldap query
*/ */
static chunk_t ldap_parse(LDAP *ldap, LDAPMessage *result) static chunk_t ldap_parse(LDAP *ldap, LDAPMessage *result)
{ {
chunk_t response = chunk_empty; chunk_t response = chunk_empty;
err_t ugh = NULL;
LDAPMessage *entry = ldap_first_entry(ldap, result); LDAPMessage *entry = ldap_first_entry(ldap, result);
if (entry != NULL) if (entry != NULL)
{ {
BerElement *ber = NULL; BerElement *ber = NULL;
@@ -206,39 +206,44 @@ static chunk_t ldap_parse(LDAP *ldap, LDAPMessage *result)
response.len = values[0]->bv_len; response.len = values[0]->bv_len;
response.ptr = malloc(response.len); response.ptr = malloc(response.len);
memcpy(response.ptr, values[0]->bv_val, response.len); memcpy(response.ptr, values[0]->bv_val, response.len);
if (values[1] != NULL) if (values[1] != NULL)
{ {
DBG1("ldap: more than one value was fetched from LDAP URL"); ugh = "more than one value was fetched - first selected";
} }
} }
else else
{ {
DBG1("ldap: no values in attribute"); ugh = "no values in attribute";
} }
ldap_value_free_len(values); ldap_value_free_len(values);
} }
else else
{ {
DBG1("ldap: %s", ldap_err2string(ldap_result2error(ldap, entry, 0))); ugh = ldap_err2string(ldap_result2error(ldap, entry, 0));
} }
ldap_memfree(attr); ldap_memfree(attr);
} }
else else
{ {
DBG1("ldap: %s", ldap_err2string(ldap_result2error(ldap, entry, 0))); ugh = ldap_err2string(ldap_result2error(ldap, entry, 0));
} }
ber_free(ber, 0); ber_free(ber, 0);
} }
else else
{ {
DBG1("ldap: %s", ldap_err2string(ldap_result2error(ldap, result, 0))); ugh = ldap_err2string(ldap_result2error(ldap, result, 0));
}
if (ugh)
{
DBG1("ldap request failed: %s", ugh);
} }
return response; return response;
} }
#endif /* LIBLDAP */ #endif /* LIBLDAP */
/** /**
* fetches a binary blob from an ldap url * Implements fetcher_t.get for curl methods
*/ */
static chunk_t ldap_get(private_fetcher_t *this) static chunk_t ldap_get(private_fetcher_t *this)
{ {
@@ -247,6 +252,7 @@ static chunk_t ldap_get(private_fetcher_t *this)
#ifdef LIBLDAP #ifdef LIBLDAP
if (this->ldap) if (this->ldap)
{ {
err_t ugh = NULL;
int rc; int rc;
int ldap_version = LDAP_VERSION3; int ldap_version = LDAP_VERSION3;
@@ -285,14 +291,19 @@ static chunk_t ldap_get(private_fetcher_t *this)
} }
else else
{ {
DBG1("ldap: %s", ldap_err2string(rc)); ugh = ldap_err2string(rc);
} }
} }
else else
{ {
DBG1("ldap: %s", ldap_err2string(rc)); ugh = ldap_err2string(rc);
} }
ldap_unbind_s(this->ldap); ldap_unbind_s(this->ldap);
if (ugh)
{
DBG1("ldap request failed: %s", ugh);
}
} }
#else /* !LIBLDAP */ #else /* !LIBLDAP */
DBG1("warning: libldap fetching not compiled in"); DBG1("warning: libldap fetching not compiled in");