CURLcode ret;
if (!candle) {
- ERROR("rlm_rest (%s): Failed to create CURL handle",
- inst->xlat_name);
+ ERROR("rlm_rest (%s): Failed to create CURL handle", inst->xlat_name);
return NULL;
}
if (!*inst->connect_uri) {
- ERROR("rlm_rest (%s): Skipping pre-connect,"
- " connect_uri not specified", inst->xlat_name);
+ ERROR("rlm_rest (%s): Skipping pre-connect, connect_uri not specified", inst->xlat_name);
return candle;
}
inst->connect_uri);
if (ret != CURLE_OK) goto error;
- DEBUG("rlm_rest (%s): Connecting to \"%s\"",
- inst->xlat_name,
- inst->connect_uri);
+ DEBUG("rlm_rest (%s): Connecting to \"%s\"", inst->xlat_name, inst->connect_uri);
ret = curl_easy_perform(candle);
if (ret != CURLE_OK) {
- ERROR("rlm_rest (%s): Connection failed: %i - %s",
- inst->xlat_name,
- ret, curl_easy_strerror(ret));
+ ERROR("rlm_rest (%s): Connection failed: %i - %s", inst->xlat_name, ret, curl_easy_strerror(ret));
goto connection_error;
}
*/
error:
- ERROR("rlm_rest (%s): Failed setting curl option: %i - %s",
- inst->xlat_name,
- ret, curl_easy_strerror(ret));
+ ERROR("rlm_rest (%s): Failed setting curl option: %i - %s", inst->xlat_name, ret, curl_easy_strerror(ret));
/*
* So we don't leak CURL handles.
ret = curl_easy_getinfo(candle, CURLINFO_LASTSOCKET, &last_socket);
if (ret != CURLE_OK) {
- ERROR("rlm_rest (%s): Couldn't determine socket"
- " state: %i - %s", inst->xlat_name, ret,
- curl_easy_strerror(ret));
+ ERROR("rlm_rest (%s): Couldn't determine socket state: %i - %s", inst->xlat_name, ret,
+ curl_easy_strerror(ret));
return false;
}
* The buffer wasn't big enough to encode a single attribute chunk.
*/
if (!len) {
- ERROR("rlm_rest (%s): AVP exceeds buffer length or chunk", ctx->instance->xlat_name);
+ REDEBUG("AVP exceeds buffer length or chunk");
} else {
RDEBUG2("Returning %i bytes of POST data (buffer full or chunk exceeded)", len);
}
* The buffer wasn't big enough to encode a single attribute chunk.
*/
if (!len) {
- ERROR("rlm_rest (%s): AVP exceeds buffer length or chunk", ctx->instance->xlat_name);
+ REDEBUG("AVP exceeds buffer length or chunk");
} else {
RDEBUG2("Returning %i bytes of JSON data (buffer full or chunk exceeded)", len);
}
vp = pairalloc(request, da);
if (!vp) {
- ERROR("rlm_rest (%s): Failed creating"
- " valuepair", instance->xlat_name);
+ REDEBUG("Failed creating valuepair");
talloc_free(expanded);
goto error;
ret = pairparsevalue(vp, expanded);
talloc_free(expanded);
if (!ret) {
- RDEBUG("Incompatible value assignment, skipping");
+ RWDEBUG("Incompatible value assignment, skipping");
talloc_free(vp);
goto skip;
}
if (++count == REST_BODY_MAX_ATTRS) {
- ERROR("rlm_rest (%s): At maximum"
- " attribute limit", instance->xlat_name);
+ REDEBUG("At maximum attribute limit");
return count;
}
}
if (!count) {
- ERROR("rlm_rest (%s): Malformed POST data \"%s\"",
- instance->xlat_name, raw);
+ REDEBUG("Malformed POST data \"%s\"", raw);
}
return count;
i = 0;
do {
if (!(*max_attrs)--) {
- ERROR("rlm_rest (%s): At "
- "maximum attribute limit",
- instance->xlat_name);
+ REDEBUG("At maximum attribute limit");
return NULL;
}
flags.op = T_OP_ADD;
}
- if (!flags.is_json &&
- json_object_is_type(value, json_type_object)) {
+ if (!flags.is_json && json_object_is_type(value, json_type_object)) {
/* TODO: Insert nested VP into VP structure...*/
REDEBUG("Found nested VP, these are not yet supported");
json = json_tokener_parse(p);
if (!json) {
- ERROR("rlm_rest (%s): Malformed JSON data \"%s\"",
- instance->xlat_name, raw);
+ RDEBUG("Malformed JSON data \"%s\"", raw);
return -1;
}
len = rest_read_wrapper(&ctx->body, func, REST_BODY_MAX_LEN,
&ctx->read);
if (len <= 0) {
- RERROR("Failed creating HTTP body content");
+ REDEBUG("Failed creating HTTP body content");
}
ret = curl_easy_setopt(candle, CURLOPT_POSTFIELDS, ctx->body);
return 0;
error:
- RERROR("Failed setting curl option: %i - %s", ret, curl_easy_strerror(ret));
+ REDEBUG("Failed setting curl option: %i - %s", ret, curl_easy_strerror(ret));
return -1;
}
return 0;
error:
- ERROR("rlm_rest (%s): Failed setting curl option: %i - %s",
- instance->xlat_name, ret, curl_easy_strerror(ret));
+ RDEBUG("Failed setting curl option: %i - %s", ret, curl_easy_strerror(ret));
return -1;
error_header:
- ERROR("rlm_rest (%s): Failed creating header",
- instance->xlat_name);
+ RDEBUG("Failed creating header", instance->xlat_name);
return -1;
}
ret = curl_easy_perform(candle);
if (ret != CURLE_OK) {
- RERROR("Request failed: %i - %s", ret, curl_easy_strerror(ret));
+ REDEBUG("Request failed: %i - %s", ret, curl_easy_strerror(ret));
return -1;
}
p = strchr(p, ':');
if (!p || (*++p != '/') || (*++p != '/')) {
malformed:
- RERROR("Error URI is malformed, can't find start of path");
+ REDEBUG("Error URI is malformed, can't find start of path");
return -1;
}
p = strchr(p + 1, '/');