vp = fr_pair_afrom_da(ctx, map->lhs->tmpl_da);
rad_assert(vp);
- if (fr_pair_value_from_str(vp, self->values[i]->bv_val, self->values[i]->bv_len) < 0) {
- char *escaped;
-
- escaped = fr_asprint(vp, self->values[i]->bv_val, self->values[i]->bv_len, '"');
- RWDEBUG("Failed parsing value \"%s\" for attribute %s: %s", escaped,
- map->lhs->tmpl_da->name, fr_strerror());
+ if (fr_pair_value_from_str(vp, self->values[i]->bv_val,
+ self->values[i]->bv_len, '\0', true) < 0) {
+ RPWDEBUG("Failed parsing value \"%pV\" for attribute %s: %s",
+ fr_box_strvalue_len(self->values[i]->bv_val, self->values[i]->bv_len),
+ map->lhs->tmpl_da->name);
talloc_free(vp); /* also frees escaped */
continue;
struct berval *srv_cred;
if (ldap_parse_sasl_bind_result(conn->handle, result, &srv_cred, 0) == 0) {
- char *escaped;
-
- escaped = fr_asprint(request, srv_cred->bv_val, srv_cred->bv_len, '\0');
- ROPTIONAL(RDEBUG3, DEBUG3, "SASL response : %s", escaped);
-
- talloc_free(escaped);
+ ROPTIONAL(RDEBUG3, DEBUG3, "SASL response : %pV",
+ fr_box_strvalue_len(srv_cred->bv_val, srv_cred->bv_len));
ldap_memfree(srv_cred);
}
}
*/
if (rbtree_num_elements(cluster->used_nodes) > 1) {
key_slot = &cluster->key_slot[cluster_key_hash(key, key_len)];
- if (RDEBUG_ENABLED2) {
- char *p;
-
- p = fr_asprint(request, (char const *)key, key_len, '"');
- RDEBUG2("Key \"%s\" -> slot %zu", p, key_slot - cluster->key_slot);
- talloc_free(p);
- }
+ RDEBUG2("Key \"%pV\" -> slot %zu",
+ fr_box_strvalue_len((char const *)key, key_len), key_slot - cluster->key_slot);
return key_slot;
}
RDEBUG3("Got key : %s", key->str);
RDEBUG3("Got op : %s", op->str);
-
- if (RDEBUG_ENABLED3) {
- char *p;
-
- p = fr_asprint(NULL, value->str, value->len, '"');
- RDEBUG3("Got value : %s", p);
- talloc_free(p);
- }
+ RDEBUG3("Got value : %pV", fr_box_strvalue_len(value->str, value->len));
map = talloc_zero(ctx, vp_map_t);
slen = tmpl_afrom_attr_str(map, &map->lhs, key->str, REQUEST_CURRENT, PAIR_LIST_REQUEST, false, false);
* Grab all the data for this hash, should return an array
* of alternating keys/values which we then convert into maps.
*/
- if (RDEBUG_ENABLED3) {
- char *p;
-
- p = fr_asprint(NULL, (char const *)key, key_len, '"');
- RDEBUG3("LRANGE %s 0 -1", key);
- talloc_free(p);
- }
+ RDEBUG3("LRANGE %pV 0 -1", fr_box_strvalue_len((char const *)key, key_len));
reply = redisCommand(conn->handle, "LRANGE %b 0 -1", key, key_len);
status = fr_redis_command_status(conn, reply);
}
if (s_ret != REDIS_RCODE_SUCCESS) {
- char *p;
-
- p = fr_asprint(NULL, (char const *)key, key_len, '"');
- RERROR("Failed retrieving entry for key \"%s\"", p);
- talloc_free(p);
+ RERROR("Failed retrieving entry for key \"%pV\"", fr_box_strvalue_len((char const *)key, key_len));
error:
fr_redis_reply_free(reply);
redisReply *replies[5]; /* Should have the same number of elements as pipelined commands */
size_t reply_num = 0, i;
- char *p;
int cnt;
vp_tmpl_t expires_value;
pipelined++;
}
- if (RDEBUG_ENABLED3) {
- p = fr_asprint(request, (char const *)c->key, c->key_len, '\0');
- RDEBUG3("DEL \"%s\"", p);
- talloc_free(p);
-
- }
+ RDEBUG3("DEL \"%pV\"", fr_box_strvalue_len((char const *)c->key, c->key_len));
if (redisAppendCommand(conn->handle, "DEL %b", c->key, c->key_len) != REDIS_OK) goto append_error;
pipelined++;
RDEBUG3("argv command");
RINDENT();
for (i = 0; i < talloc_array_length(argv); i++) {
- p = fr_asprint(request, argv[i], argv_len[i], '\0');
- RDEBUG3("%s", p);
- talloc_free(p);
+ RDEBUG3("%pV", fr_box_strvalue_len(argv[i], argv_len[i]));
}
REXDENT();
}
* Set the expiry time and close out the transaction.
*/
if (c->expires > 0) {
- if (RDEBUG_ENABLED3) {
- p = fr_asprint(request, (char const *)c->key, c->key_len, '\"');
- RDEBUG3("EXPIREAT \"%s\" %li", p, (long)c->expires);
- talloc_free(p);
- }
+ RDEBUG3("EXPIREAT \"%pV\" %li",
+ fr_box_strvalue_len((char const *)c->key, c->key_len), (long)c->expires);
if (redisAppendCommand(conn->handle, "EXPIREAT %b %i", c->key,
c->key_len, c->expires) != REDIS_OK) goto append_error;
pipelined++;
break;
case CACHE_MISS:
- if (RDEBUG_ENABLED2) {
- char *p;
-
- p = fr_asprint(request, (char const *)key, key_len, '"');
- RDEBUG("No cache entry found for \"%s\"", p);
- talloc_free(p);
- }
+ RDEBUG2("No cache entry found for \"%pV\"", fr_box_strvalue_len((char const *)key, key_len));
return RLM_MODULE_NOTFOUND;
/* FALL-THROUGH */
* passed. Delete it, and pretend it doesn't exist.
*/
if ((c->expires < request->packet->timestamp.tv_sec) || (c->created < inst->config.epoch)) {
- if (RDEBUG_ENABLED2) {
- char *p;
-
- p = fr_asprint(request, (char const *)key, key_len, '"');
- RDEBUG2("Found entry for \"%s\", but it expired %li seconds ago. Removing it", p,
- request->packet->timestamp.tv_sec - c->expires);
- talloc_free(p);
- }
+ RDEBUG2("Found entry for \"%pV\", but it expired %li seconds ago. Removing it",
+ fr_box_strvalue_len((char const *)key, key_len),
+ request->packet->timestamp.tv_sec - c->expires);
inst->driver->expire(&inst->config, inst->driver_inst->data, request, handle, c->key, c->key_len);
cache_free(inst, &c);
return RLM_MODULE_NOTFOUND; /* Couldn't find a non-expired entry */
}
- if (RDEBUG_ENABLED2) {
- char *p;
-
- p = fr_asprint(request, (char const *)key, key_len, '"');
- RDEBUG2("Found entry for \"%s\"", p);
- talloc_free(p);
- }
+ RDEBUG2("Found entry for \"%pV\"", fr_box_strvalue_len((char const *)key, key_len));
c->hits++;
*out = c;
vp = fr_pair_afrom_da(ctx, da);
rad_assert(vp);
- if (fr_pair_value_from_str(vp, str, talloc_array_length(str) - 1) < 0) {
- char *escaped;
-
- escaped = fr_asprint(vp, str, talloc_array_length(str) - 1, '\'');
- RWDEBUG("Failed parsing value \"%s\" for attribute %s: %s", escaped,
+ if (fr_pair_value_from_str(vp, str, talloc_array_length(str) - 1, '\0', true) < 0) {
+ RWDEBUG("Failed parsing value \"%pV\" for attribute %s: %s", fr_box_strvalue_buffer(str),
map->lhs->tmpl_da->name, fr_strerror());
+ talloc_free(vp);
- talloc_free(vp); /* also frees escaped */
return -1;
}
* Buffer not always talloced, sometimes it's
* just a pointer to a field in a result struct.
*/
- if (fr_pair_value_from_str(vp, value, strlen(value)) < 0) {
- char *escaped;
-
- escaped = fr_asprint(vp, value, talloc_array_length(value) - 1, '"');
- RPEDEBUG("Failed parsing value \"%s\" for attribute %s", escaped, map->lhs->tmpl_da->name);
- talloc_free(vp); /* also frees escaped */
+ if (fr_pair_value_from_str(vp, value, -1, '\0', true) < 0) {
+ RPEDEBUG("Failed parsing value \"%pV\" for attribute %s",
+ fr_box_strvalue_buffer(value), map->lhs->tmpl_da->name);
+ talloc_free(vp);
return -1;
}