*/
if (ret == 0) {
if (dict_end >= (dicts + (NUM_ELEMENTS(dicts)))) {
- fr_strerror_printf("Reached maximum number of dictionaries");
+ fr_strerror_const("Reached maximum number of dictionaries");
goto error;
}
talloc_free(null_child);
if (talloc_set_memlimit(null_ctx, config->talloc_memory_limit) < 0) {
- fr_strerror_printf("Failed applying memory limit");
+ fr_strerror_const("Failed applying memory limit");
return -1;
}
}
*/
index_attr = fr_dict_attr_child_by_num(parent, 0);
if (!index_attr) {
- fr_strerror_printf("Unknown OID component: No index attribute at this level");
+ fr_strerror_const("Unknown OID component: No index attribute at this level");
break;
}
*/
parent = fr_dict_attr_child_by_num(parent, 1);
if (!parent) {
- fr_strerror_printf("Unknown OID component: No entry attribute at this level");
+ fr_strerror_const("Unknown OID component: No entry attribute at this level");
break;
}
}
if (da->type == FR_TYPE_TLV) {
- fr_strerror_printf("TLVs cannot hold values");
+ fr_strerror_const("TLVs cannot hold values");
return -(slen);
}
slen = snprintf(oid_buff, sizeof(oid_buff), "%u.", parent->attr);
if (is_truncated((size_t)slen, sizeof(oid_buff))) {
oob:
- fr_strerror_printf("OID Buffer too small");
+ fr_strerror_const("OID Buffer too small");
return -1;
}
p += slen;
*/
slen = fr_value_box_print(&FR_SBUFF_OUT(value_buff, sizeof(value_buff)), &vp->data, NULL);
if (slen < 0) {
- fr_strerror_printf("Insufficient fixed value buffer");
+ fr_strerror_const("Insufficient fixed value buffer");
return -1;
}
io_vector[4].iov_base = value_buff;
char *c1, *c2;
if (out_p >= out_end) {
- fr_strerror_printf("Would overflow output buffer");
+ fr_strerror_const("Would overflow output buffer");
return -(p - in);
}
slen = hex_to_bin(output, outlen, p, strlen(p));
if (slen <= 0) {
- fr_strerror_printf_push("Empty hex string");
+ fr_strerror_const_push("Empty hex string");
return slen;
}
fr_dict_t *dict;
if (in[0] == '\0') {
- fr_strerror_printf("Missing dictionary name");
+ fr_strerror_const("Missing dictionary name");
RETURN_PARSE_ERROR(0);
}
talloc_list_free(&head);
if (slen < 0) {
- fr_strerror_printf("Encoder output would overflow output buffer");
+ fr_strerror_const("Encoder output would overflow output buffer");
RETURN_OK_WITH_ERROR();
}
p = strchr(in, ':');
if (!p) {
- fr_strerror_printf("no ':name' specified");
+ fr_strerror_const("no ':name' specified");
RETURN_PARSE_ERROR(0);
}
table->read_only = true;
if (fr_command_add(table, &command_head, NULL, NULL, table) < 0) {
- fr_strerror_printf_push("ERROR: Failed adding command");
+ fr_strerror_const_push("ERROR: Failed adding command");
RETURN_OK_WITH_ERROR();
}
memcpy(&argv, &info.argv, sizeof(argv)); /* const issues */
info.argc = fr_dict_str_to_argv(in, argv, CMD_MAX_ARGV);
if (info.argc <= 0) {
- fr_strerror_printf("Failed splitting input");
+ fr_strerror_const("Failed splitting input");
RETURN_PARSE_ERROR(-(info.argc));
}
len = snprintf(p, end - p, "%d - ", num_expansions);
if (is_truncated(len, end - p)) {
oob:
- fr_strerror_printf("Out of output buffer space");
+ fr_strerror_const("Out of output buffer space");
RETURN_COMMAND_ERROR();
}
p += len;
cs = cf_section_alloc(NULL, NULL, "if", "condition");
if (!cs) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
RETURN_COMMAND_ERROR();
}
cf_filename_set(cs, cc->filename);
len = snprintf(data, COMMAND_OUTPUT_MAX, "%u", cc->test_count);
if (is_truncated(len, COMMAND_OUTPUT_MAX)) {
- fr_strerror_printf("Command count would overflow data buffer (shouldn't happen)");
+ fr_strerror_const("Command count would overflow data buffer (shouldn't happen)");
RETURN_COMMAND_ERROR();
}
slen = load_test_point_by_command((void **)&tp, in, "tp_decode_pair");
if (!tp) {
- fr_strerror_printf_push("Failed locating decoder testpoint");
+ fr_strerror_const_push("Failed locating decoder testpoint");
RETURN_COMMAND_ERROR();
}
fr_skip_whitespace(p);
if (tp->test_ctx && (tp->test_ctx(&decoder_ctx, cc->tmp_ctx) < 0)) {
- fr_strerror_printf_push("Failed initialising decoder testpoint");
+ fr_strerror_const_push("Failed initialising decoder testpoint");
RETURN_COMMAND_ERROR();
}
vp = fr_cursor_next(&cursor)) {
if ((slen = fr_pair_print(&FR_SBUFF_OUT(p, end), NULL, vp)) < 0) {
oob:
- fr_strerror_printf("Out of output buffer space");
+ fr_strerror_const("Out of output buffer space");
CLEAR_TEST_POINT(cc);
RETURN_COMMAND_ERROR();
}
slen = load_test_point_by_command((void **)&tp, in, "tp_decode_proto");
if (!tp) {
- fr_strerror_printf_push("Failed locating decoder testpoint");
+ fr_strerror_const_push("Failed locating decoder testpoint");
RETURN_COMMAND_ERROR();
}
fr_skip_whitespace(p);
if (tp->test_ctx && (tp->test_ctx(&decoder_ctx, cc->tmp_ctx) < 0)) {
- fr_strerror_printf_push("Failed initialising decoder testpoint");
+ fr_strerror_const_push("Failed initialising decoder testpoint");
RETURN_COMMAND_ERROR();
}
fr_pair_list_init(&head);
slen = load_test_point_by_command((void **)&tp, p, "tp_encode_pair");
if (!tp) {
- fr_strerror_printf_push("Failed locating encode testpoint");
+ fr_strerror_const_push("Failed locating encode testpoint");
CLEAR_TEST_POINT(cc);
RETURN_COMMAND_ERROR();
}
}
if (tp->test_ctx && (tp->test_ctx(&encoder_ctx, cc->tmp_ctx) < 0)) {
- fr_strerror_printf_push("Failed initialising encoder testpoint");
+ fr_strerror_const_push("Failed initialising encoder testpoint");
CLEAR_TEST_POINT(cc);
RETURN_COMMAND_ERROR();
}
if (len <= 0) RETURN_PARSE_ERROR(0);
if (len >= (size_t)(cc->buffer_end - cc->buffer_start)) {
- fr_strerror_printf("Encoder output would overflow output buffer");
+ fr_strerror_const("Encoder output would overflow output buffer");
RETURN_OK_WITH_ERROR();
}
slen = load_test_point_by_command((void **)&tp, p, "tp_encode_proto");
if (!tp) {
- fr_strerror_printf_push("Failed locating encode testpoint");
+ fr_strerror_const_push("Failed locating encode testpoint");
CLEAR_TEST_POINT(cc);
RETURN_COMMAND_ERROR();
}
p += ((size_t)slen);
fr_skip_whitespace(p);
if (tp->test_ctx && (tp->test_ctx(&encoder_ctx, cc->tmp_ctx) < 0)) {
- fr_strerror_printf_push("Failed initialising encoder testpoint");
+ fr_strerror_const_push("Failed initialising encoder testpoint");
CLEAR_TEST_POINT(cc);
RETURN_COMMAND_ERROR();
}
if (*in != '\0') {
size = strtoul(in, &end, 10);
if ((size == ULONG_MAX) || *end || (size >= 65536)) {
- fr_strerror_printf_push("Invalid integer");
+ fr_strerror_const_push("Invalid integer");
RETURN_COMMAND_ERROR();
}
} else {
* They MUST be identical
*/
if (fr_value_box_cmp(box, box2) != 0) {
- fr_strerror_printf("ERROR value box reparsing failed. Results not identical");
+ fr_strerror_const("ERROR value box reparsing failed. Results not identical");
fr_strerror_printf_push("out: %pV", box2);
fr_strerror_printf_push("in: %pV", box);
talloc_free(box2);
* Load the custom dictionary
*/
if (fr_dict_read(dict, raddb_dir, FR_DICTIONARY_FILE) == -1) {
- fr_strerror_printf_push("Failed to initialize the dictionaries");
+ fr_strerror_const_push("Failed to initialize the dictionaries");
fr_perror("unit_test_map");
EXIT_WITH_FAILURE;
}
* "0" is uniformly the "bad packet" type.
*/
if (!request->packet->code) {
- fr_strerror_printf("No 'Packet-Type' was found in the request list. Cannot send unknown packet");
+ fr_strerror_const("No 'Packet-Type' was found in the request list. Cannot send unknown packet");
return NULL;
}
uint8_t *p, *q;
if (len <= (EAP_HEADER_LEN + 1 + 3 + 4)) {
- fr_strerror_printf("Expanded EAP type is too short: ignoring the packet");
+ fr_strerror_const("Expanded EAP type is too short: ignoring the packet");
return false;
}
if ((eap_packet->data[1] != 0) ||
(eap_packet->data[2] != 0) ||
(eap_packet->data[3] != 0)) {
- fr_strerror_printf("Expanded EAP type has unknown Vendor-ID: ignoring the packet");
+ fr_strerror_const("Expanded EAP type has unknown Vendor-ID: ignoring the packet");
return false;
}
if ((eap_packet->data[4] != 0) ||
(eap_packet->data[5] != 0) ||
(eap_packet->data[6] != 0)) {
- fr_strerror_printf("Expanded EAP type has unknown Vendor-Type: ignoring the packet");
+ fr_strerror_const("Expanded EAP type has unknown Vendor-Type: ignoring the packet");
return false;
}
}
if (eap_packet->data[7] == FR_EAP_METHOD_NAK) {
- fr_strerror_printf("Unsupported Expanded EAP-NAK: ignoring the packet");
+ fr_strerror_const("Unsupported Expanded EAP-NAK: ignoring the packet");
return false;
}
/* we don't expect notification, but we send it */
if (eap_packet->data[0] == FR_EAP_METHOD_NOTIFICATION) {
- fr_strerror_printf("Got NOTIFICATION, Ignoring the packet");
+ fr_strerror_const("Got NOTIFICATION, Ignoring the packet");
return false;
}
*/
vp = fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_message);
if (!vp) {
- fr_strerror_printf("EAP-Message not found");
+ fr_strerror_const("EAP-Message not found");
return NULL;
}
* Sanity check the length before doing anything.
*/
if (vp->vp_length < 4) {
- fr_strerror_printf("EAP packet is too short");
+ fr_strerror_const("EAP packet is too short");
return NULL;
}
* Take out even more weird things.
*/
if (len < 4) {
- fr_strerror_printf("EAP packet has invalid length (less than 4 bytes)");
+ fr_strerror_const("EAP packet has invalid length (less than 4 bytes)");
return NULL;
}
{
*checkcode = talloc_zero(ctx, fr_aka_sim_checkcode_t);
if (!*checkcode) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
p += p[1] << 2; /* Advance */
}
- fr_strerror_printf("No MAC attribute found");
+ fr_strerror_const("No MAC attribute found");
return 1;
}
uint16_t packet_len;
if (unlikely(!eap_packet)) {
- fr_strerror_printf("Invalid argument: eap_packet is NULL");
+ fr_strerror_const("Invalid argument: eap_packet is NULL");
return -1;
}
if (unlikely(!md)) {
- fr_strerror_printf("Invalid argument: md is NULL");
+ fr_strerror_const("Invalid argument: md is NULL");
return -1;
}
if (unlikely(!key) || (key_len == 0)) {
- fr_strerror_printf("Invalid argument: key is NULL");
+ fr_strerror_const("Invalid argument: key is NULL");
return -1;
}
* the peer initialize the counter to one."
*/
if (keys->reauth.counter == 0) {
- fr_strerror_printf("Re-authentication counter not initialised, must be >= 1");
+ fr_strerror_const("Re-authentication counter not initialised, must be >= 1");
return -1;
}
vp = fr_pair_afrom_child_num(request->packet, fr_dict_root(dict), FR_SUBTYPE);
if (!vp) {
- fr_strerror_printf("Failed allocating subtype attribute");
+ fr_strerror_const("Failed allocating subtype attribute");
goto error;
}
vp->vp_uint32 = data[0];
p += 8;
if (((p + 3) < end)) {
- fr_strerror_printf("Missing MNC component");
+ fr_strerror_const("Missing MNC component");
return (domain - p);
}
num = strtoul(p, &q, 10);
if (*q != '.') {
- fr_strerror_printf("Invalid MCN component");
+ fr_strerror_const("Invalid MCN component");
return (domain - q);
}
*mnc = (uint16_t)num;
p = q + 1;
if (((p + 3) < end) || (CRYPTO_memcmp(p, "mcc", 3) != 0)) {
- fr_strerror_printf("Missing MCC component");
+ fr_strerror_const("Missing MCC component");
return (domain - p);
}
num = strtoul(p, &q, 10);
if (*q != '.') {
- fr_strerror_printf("Invalid MCC component");
+ fr_strerror_const("Invalid MCC component");
return (domain - q);
}
*mcc = (uint16_t)num;
p = q + 1;
if (((p + 15) < end) || (CRYPTO_memcmp(p, "3gppnetwork.org", 15) != 0)) {
- fr_strerror_printf("Missing 3gppnetwork.org suffix");
+ fr_strerror_const("Missing 3gppnetwork.org suffix");
return (domain - p);
}
p += 15;
if (p != end) {
- fr_strerror_printf("Trailing garbage");
+ fr_strerror_const("Trailing garbage");
return (domain - p);
}
if (id_len < 1) {
*hint = AKA_SIM_METHOD_HINT_UNKNOWN;
*type = AKA_SIM_ID_TYPE_UNKNOWN;
- fr_strerror_printf("ID length too short");
+ fr_strerror_const("ID length too short");
return -1;
}
case ID_TAG_SIM_PERMANENT:
*hint = AKA_SIM_METHOD_HINT_UNKNOWN;
*type = AKA_SIM_ID_TYPE_UNKNOWN;
- fr_strerror_printf_push("Got SIM-Permanent-ID tag, but identity is not a permanent ID");
+ fr_strerror_const_push("Got SIM-Permanent-ID tag, but identity is not a permanent ID");
return -1;
case ID_TAG_AKA_PERMANENT:
*hint = AKA_SIM_METHOD_HINT_UNKNOWN;
*type = AKA_SIM_ID_TYPE_UNKNOWN;
- fr_strerror_printf_push("Got AKA-Permanent-ID tag, but identity is not a permanent ID");
+ fr_strerror_const_push("Got AKA-Permanent-ID tag, but identity is not a permanent ID");
return -1;
default:
return -1;
}
if (unlikely(!key)) {
- fr_strerror_printf("Provided key was NULL");
+ fr_strerror_const("Provided key was NULL");
return -1;
}
*/
while (p < end) {
if (unlikely(!isdigit((char)p[0]) || !isdigit((char)p[1]))) {
- fr_strerror_printf("IMSI contains invalid character");
+ fr_strerror_const("IMSI contains invalid character");
return -1;
}
ch = talloc_zero(ctx, fr_channel_t);
if (!ch) {
nomem:
- fr_strerror_printf("Failed allocating memory");
+ fr_strerror_const("Failed allocating memory");
return NULL;
}
ch->end[TO_RESPONDER].rb = fr_ring_buffer_create(ch, FR_CONTROL_MAX_MESSAGES * FR_CONTROL_MAX_SIZE);
if (!ch->end[TO_RESPONDER].rb) {
rb_nomem:
- fr_strerror_printf_push("Failed allocating ring buffer");
+ fr_strerror_const_push("Failed allocating ring buffer");
talloc_free(ch);
return NULL;
}
c = talloc_zero(ctx, fr_control_t);
if (!c) {
- fr_strerror_printf("Failed allocating memory");
+ fr_strerror_const("Failed allocating memory");
return NULL;
}
c->el = el;
if (fr_event_fd_insert(c, el, c->pipe[0], pipe_read, NULL, NULL, c) < 0) {
talloc_free(c);
- fr_strerror_printf_push("Failed adding FD to event list control socket");
+ fr_strerror_const_push("Failed adding FD to event list control socket");
return NULL;
}
* Maybe we failed to garbage collect everything?
*/
if (fr_ring_buffer_used(rb) > 0) {
- fr_strerror_printf("Data still in control buffers");
+ fr_strerror_const("Data still in control buffers");
return -1;
}
(void) fr_control_gc(c, rb);
m = (fr_control_message_t *) fr_ring_buffer_alloc(rb, message_size);
if (!m) {
- fr_strerror_printf_push("Failed allocating from ring buffer");
+ fr_strerror_const_push("Failed allocating from ring buffer");
return NULL;
}
}
(void) fr_control_gc(c, rb);
m = fr_control_message_alloc(c, rb, id, data, data_size);
if (!m) {
- fr_strerror_printf("Failed allocationg after GC");
+ fr_strerror_const("Failed allocationg after GC");
return -2;
}
}
if (!fr_atomic_queue_push(c->aq, m)) {
m->status = FR_CONTROL_MESSAGE_DONE;
- fr_strerror_printf("Failed pushing message to atomic queue.");
+ fr_strerror_const("Failed pushing message to atomic queue.");
return -1;
}
}
if (c->type[id].callback != NULL) {
- fr_strerror_printf("Callback is already set");
+ fr_strerror_const("Callback is already set");
return -1;
}
&allow[i].addr, allow[i].prefix);
if (network && (network->prefix <= allow[i].prefix)) {
fr_strerror_printf("Cannot add overlapping entry 'allow = %pV'", fr_box_ipaddr(allow[i]));
- fr_strerror_printf("Entry is completely enclosed inside of a previously defined network.");
+ fr_strerror_const("Entry is completely enclosed inside of a previously defined network.");
talloc_free(trie);
return NULL;
}
}
if (!inst->app_io->thread_inst_size) {
- fr_strerror_printf("IO modules MUST set 'thread_inst_size' when using the master IO handler.");
+ fr_strerror_const("IO modules MUST set 'thread_inst_size' when using the master IO handler.");
return -1;
}
if (num_messages < 8) num_messages = 8;
if ((num_messages & (num_messages - 1)) != 0) {
- fr_strerror_printf("Number of messages must be a power of 2");
+ fr_strerror_const("Number of messages must be a power of 2");
return NULL;
}
}
if (message_size > 1024) {
- fr_strerror_printf("Message size must be no larger than 1024");
+ fr_strerror_const("Message size must be no larger than 1024");
return NULL;
}
ms = talloc_zero(ctx, fr_message_set_t);
if (!ms) {
- fr_strerror_printf("Failed allocating memory");
+ fr_strerror_const("Failed allocating memory");
return NULL;
}
*/
fr_assert(0 == 1);
- fr_strerror_printf("Failed marking message as done");
+ fr_strerror_const("Failed marking message as done");
return -1;
}
fr_message_t *l;
if (m->status != FR_MESSAGE_USED) {
- fr_strerror_printf("Cannot localize message unless it is in use");
+ fr_strerror_const("Cannot localize message unless it is in use");
return NULL;
}
if (message_size <= sizeof(fr_message_t)) {
- fr_strerror_printf("Message size is too small");
+ fr_strerror_const("Message size is too small");
return NULL;
}
l = talloc_memdup(ctx, m, message_size);
if (!l) {
nomem:
- fr_strerror_printf("Failed allocating memory");
+ fr_strerror_const("Failed allocating memory");
return NULL;
}
*/
if (clean) {
if (fr_message_ring_gc(ms, mr, 4) == 0) {
- fr_strerror_printf("No free memory after GC attempt");
+ fr_strerror_const("No free memory after GC attempt");
return NULL;
}
* room to allocate another array, we're dead.
*/
if ((ms->mr_max + 1) >= MSG_ARRAY_SIZE) {
- fr_strerror_printf("All message arrays are full");
+ fr_strerror_const("All message arrays are full");
return NULL;
}
*/
mr = fr_ring_buffer_create(ms, fr_ring_buffer_size(ms->mr_array[ms->mr_max]) * 2);
if (!mr) {
- fr_strerror_printf_push("Failed allocating ring buffer");
+ fr_strerror_const_push("Failed allocating ring buffer");
return NULL;
}
* room to allocate another array, we're dead.
*/
if ((ms->rb_max + 1) >= MSG_ARRAY_SIZE) {
- fr_strerror_printf("Message arrays are full");
+ fr_strerror_const("Message arrays are full");
goto cleanup;
}
*/
rb = fr_ring_buffer_create(ms, fr_ring_buffer_size(ms->rb_array[ms->rb_max]) * 2);
if (!rb) {
- fr_strerror_printf_push("Failed allocating ring buffer");
+ fr_strerror_const_push("Failed allocating ring buffer");
goto cleanup;
}
p = fr_ring_buffer_alloc(m->rb, actual_packet_size);
fr_assert(p != NULL);
if (!p) {
- fr_strerror_printf_push("Failed allocating from ring buffer");
+ fr_strerror_const_push("Failed allocating from ring buffer");
return NULL;
}
p = fr_ring_buffer_alloc(m->rb, actual_packet_size);
fr_assert(p != NULL);
if (!p) {
- fr_strerror_printf_push("Failed allocating from ring buffer");
+ fr_strerror_const_push("Failed allocating from ring buffer");
return NULL;
}
aligned_size = MS_ALIGN(actual_packet_size);
if ((aligned_p + aligned_size) > (m->data + m->rb_size)) {
- fr_strerror_printf("Aligned message size overflows reserved size");
+ fr_strerror_const("Aligned message size overflows reserved size");
return NULL;
}
p = fr_ring_buffer_alloc(m->rb, aligned_size);
fr_assert(p != NULL);
if (!p) {
- fr_strerror_printf_push("Failed allocating from ring buffer");
+ fr_strerror_const_push("Failed allocating from ring buffer");
return NULL;
}
nr = talloc_zero(ctx, fr_network_t);
if (!nr) {
- fr_strerror_printf("Failed allocating memory");
+ fr_strerror_const("Failed allocating memory");
return NULL;
}
talloc_set_destructor(nr, _fr_network_free);
nr->control = fr_control_create(nr, el, nr->aq_control);
if (!nr->control) {
- fr_strerror_printf_push("Failed creating control queue");
+ fr_strerror_const_push("Failed creating control queue");
fail:
talloc_free(nr);
return NULL;
*/
nr->rb = fr_ring_buffer_create(nr, FR_CONTROL_MAX_MESSAGES * FR_CONTROL_MAX_SIZE);
if (!nr->rb) {
- fr_strerror_printf_push("Failed creating ring buffer");
+ fr_strerror_const_push("Failed creating ring buffer");
fail2:
talloc_free(nr->control);
goto fail;
}
if (fr_control_callback_add(nr->control, FR_CONTROL_ID_CHANNEL, nr, fr_network_channel_callback) < 0) {
- fr_strerror_printf_push("Failed adding channel callback");
+ fr_strerror_const_push("Failed adding channel callback");
goto fail2;
}
if (fr_control_callback_add(nr->control, FR_CONTROL_ID_LISTEN, nr, fr_network_listen_callback) < 0) {
- fr_strerror_printf_push("Failed adding socket callback");
+ fr_strerror_const_push("Failed adding socket callback");
goto fail2;
}
if (fr_control_callback_add(nr->control, FR_CONTROL_ID_DIRECTORY, nr, fr_network_directory_callback) < 0) {
- fr_strerror_printf_push("Failed adding socket callback");
+ fr_strerror_const_push("Failed adding socket callback");
goto fail2;
}
if (fr_control_callback_add(nr->control, FR_CONTROL_ID_WORKER, nr, fr_network_worker_started_callback) < 0) {
- fr_strerror_printf_push("Failed adding worker callback");
+ fr_strerror_const_push("Failed adding worker callback");
goto fail2;
}
if (fr_control_callback_add(nr->control, FR_CONTROL_ID_INJECT, nr, fr_network_inject_callback) < 0) {
- fr_strerror_printf_push("Failed adding packet injection callback");
+ fr_strerror_const_push("Failed adding packet injection callback");
goto fail2;
}
*/
nr->sockets = rbtree_talloc_alloc(nr, socket_listen_cmp, fr_network_socket_t, NULL, RBTREE_FLAG_NONE);
if (!nr->sockets) {
- fr_strerror_printf_push("Failed creating listen tree for sockets");
+ fr_strerror_const_push("Failed creating listen tree for sockets");
goto fail2;
}
nr->sockets_by_num = rbtree_talloc_alloc(nr, socket_num_cmp, fr_network_socket_t, NULL, RBTREE_FLAG_NONE);
if (!nr->sockets_by_num) {
- fr_strerror_printf_push("Failed creating number tree for sockets");
+ fr_strerror_const_push("Failed creating number tree for sockets");
goto fail2;
}
nr->replies = fr_heap_alloc(nr, reply_cmp, fr_channel_data_t, channel.heap_id);
if (!nr->replies) {
- fr_strerror_printf_push("Failed creating heap for replies");
+ fr_strerror_const_push("Failed creating heap for replies");
goto fail2;
}
if (fr_event_pre_insert(nr->el, fr_network_pre_event, nr) < 0) {
- fr_strerror_printf("Failed adding pre-check to event list");
+ fr_strerror_const("Failed adding pre-check to event list");
goto fail2;
}
if (fr_event_post_insert(nr->el, fr_network_post_event, nr) < 0) {
- fr_strerror_printf("Failed inserting post-processing event");
+ fr_strerror_const("Failed inserting post-processing event");
goto fail2;
}
if (fr_nonblock(nr->signal_pipe[1]) < 0) goto fail2;
if (fr_event_fd_insert(nr, nr->el, nr->signal_pipe[0], _signal_pipe_read, NULL, NULL, nr) < 0) {
- fr_strerror_printf("Failed inserting event for signal pipe");
+ fr_strerror_const("Failed inserting event for signal pipe");
goto fail2;
}
rb = talloc_zero(ctx, fr_ring_buffer_t);
if (!rb) {
fail:
- fr_strerror_printf("Failed allocating memory.");
+ fr_strerror_const("Failed allocating memory.");
return NULL;
}
if (size < 1024) size = 1024;
if (size > (1 << 30)) {
- fr_strerror_printf("Ring buffer size must be no more than (1 << 30)");
+ fr_strerror_const("Ring buffer size must be no more than (1 << 30)");
talloc_free(rb);
return NULL;
}
(void) talloc_get_type_abort(rb, fr_ring_buffer_t);
if (rb->closed) {
- fr_strerror_printf("Allocation request after ring buffer is closed");
+ fr_strerror_const("Allocation request after ring buffer is closed");
return NULL;
}
return rb->buffer + rb->write_offset;
}
- fr_strerror_printf("No memory available in ring buffer");
+ fr_strerror_const("No memory available in ring buffer");
return NULL;
}
*
* |....S****WE....|
*/
- fr_strerror_printf("No memory available in ring buffer");
+ fr_strerror_const("No memory available in ring buffer");
return NULL;
}
if (rb->closed) {
#ifndef NDEBUG
- fr_strerror_printf("Allocation request after ring buffer is closed");
+ fr_strerror_const("Allocation request after ring buffer is closed");
#endif
return NULL;
}
}
#ifndef NDEBUG
- fr_strerror_printf("No memory available in ring buffer");
+ fr_strerror_const("No memory available in ring buffer");
#endif
return NULL;
}
* |....S****WE....|
*/
#ifndef NDEBUG
- fr_strerror_printf("No memory available in ring buffer");
+ fr_strerror_const("No memory available in ring buffer");
#endif
return NULL;
}
(void) talloc_get_type_abort(dst, fr_ring_buffer_t);
if (dst->closed) {
- fr_strerror_printf("Allocation request after ring buffer is closed");
+ fr_strerror_const("Allocation request after ring buffer is closed");
return NULL;
}
* split the reservation.
*/
if (src->reserved < move_size) {
- fr_strerror_printf("Cannot move more data than was reserved.");
+ fr_strerror_const("Cannot move more data than was reserved.");
return NULL;
}
* Freeing too much, return an error.
*/
if (size_to_free > block_size) {
- fr_strerror_printf("Cannot free more memory than exists.");
+ fr_strerror_const("Cannot free more memory than exists.");
return -1;
}
sc = talloc_zero(ctx, fr_schedule_t);
if (!sc) {
- fr_strerror_printf("Failed allocating memory");
+ fr_strerror_const("Failed allocating memory");
return NULL;
}
DEBUG("Scheduler created in single-threaded mode");
if (fr_event_pre_insert(el, fr_worker_pre_event, sc->single_worker) < 0) {
- fr_strerror_printf("Failed adding pre-check to event list");
+ fr_strerror_const("Failed adding pre-check to event list");
goto st_fail;
}
* Add the event which processes request_t packets.
*/
if (fr_event_post_insert(el, fr_worker_post_event, sc->single_worker) < 0) {
- fr_strerror_printf("Failed inserting post-processing event");
+ fr_strerror_const("Failed inserting post-processing event");
goto st_fail;
}
worker = talloc_zero(ctx, fr_worker_t);
if (!worker) {
nomem:
- fr_strerror_printf("Failed allocating memory");
+ fr_strerror_const("Failed allocating memory");
return NULL;
}
worker->aq_control = fr_atomic_queue_alloc(worker, 1024);
if (!worker->aq_control) {
- fr_strerror_printf("Failed creating atomic queue");
+ fr_strerror_const("Failed creating atomic queue");
fail:
talloc_free(worker);
return NULL;
worker->control = fr_control_create(worker, el, worker->aq_control);
if (!worker->control) {
- fr_strerror_printf_push("Failed creating control plane");
+ fr_strerror_const_push("Failed creating control plane");
goto fail;
}
if (fr_control_callback_add(worker->control, FR_CONTROL_ID_CHANNEL, worker, worker_channel_callback) < 0) {
- fr_strerror_printf_push("Failed adding control channel");
+ fr_strerror_const_push("Failed adding control channel");
goto fail;
}
worker->runnable = fr_heap_talloc_alloc(worker, worker_runnable_cmp, request_t, runnable_id);
if (!worker->runnable) {
- fr_strerror_printf("Failed creating runnable heap");
+ fr_strerror_const("Failed creating runnable heap");
goto fail;
}
worker->time_order = fr_heap_talloc_alloc(worker, worker_time_order_cmp, request_t, time_order_id);
if (!worker->time_order) {
- fr_strerror_printf("Failed creating time_order heap");
+ fr_strerror_const("Failed creating time_order heap");
goto fail;
}
worker->dedup = rbtree_talloc_alloc(worker, worker_dedup_cmp, request_t, NULL, RBTREE_FLAG_NONE);
if (!worker->dedup) {
- fr_strerror_printf("Failed creating de_dup tree");
+ fr_strerror_const("Failed creating de_dup tree");
goto fail;
}
fr_time_t now;
if (!request || !process) {
- fr_strerror_printf("Invalid arguments");
+ fr_strerror_const("Invalid arguments");
return -1;
}
worker = thread_local_worker;
if (!worker) {
- fr_strerror_printf("No worker has been defined");
+ fr_strerror_const("No worker has been defined");
return -1;
}
{
/* selector->type = JPATH_SELECTOR_FILTER_EXPRESSION; */
- fr_strerror_printf("Filter expressions not yet implemented");
+ fr_strerror_const("Filter expressions not yet implemented");
return 0;
}
{
/* selector->type = JPATH_SELECTOR_EXPRESSION; */
- fr_strerror_printf("Expressions not yet implemented");
+ fr_strerror_const("Expressions not yet implemented");
return 0;
}
*/
for (p = in; p < end; p++) if ((p[0] == ',') || (p[0] == ']')) break;
if (p == end) {
- fr_strerror_printf("Missing selector delimiter ',' or terminator ']'");
+ fr_strerror_const("Missing selector delimiter ',' or terminator ']'");
return -inlen;
}
ret = (p - in);
if (ret == 0) {
- fr_strerror_printf("Empty selector");
+ fr_strerror_const("Empty selector");
return 0;
}
if (inlen > sizeof(buffer)) { /* - 1 for ] */
- fr_strerror_printf("Selector too long");
+ fr_strerror_const("Selector too long");
return -inlen;
}
if (q > p) switch (q[0]) {
default:
no_term:
- fr_strerror_printf("Expected num, ':' or ']'");
+ fr_strerror_const("Expected num, ':' or ']'");
return buffer - q;
case ':': /* More integers to parse */
*/
num = (int32_t)strtol(p, &q, 10);
if (q[0] != '\0') {
- fr_strerror_printf("Expected num or ']'");
+ fr_strerror_const("Expected num or ']'");
return buffer - q;
}
if (q > p) {
if (num == 0) {
- fr_strerror_printf("Step cannot be 0");
+ fr_strerror_const("Step cannot be 0");
return buffer - p;
}
selector->slice[idx] = num;
if (buff_p == buff_end) {
name_too_big:
- fr_strerror_printf("Exceeded maximum field name length");
+ fr_strerror_const("Exceeded maximum field name length");
return in - p;
}
clen = fr_utf8_char((uint8_t const *)p, end - p);
if (clen == 0) {
- fr_strerror_printf("Bad UTF8 char");
+ fr_strerror_const("Bad UTF8 char");
return in - p;
}
}
if (buff_p == buffer) {
- fr_strerror_printf("Empty field specifier");
+ fr_strerror_const("Empty field specifier");
return 0;
}
node->selector->field = talloc_bstrndup(node, buffer, buff_p - buffer);
if (++p == end) { /* Skip past [ */
missing_terminator:
- fr_strerror_printf("Missing selector terminator ']'");
+ fr_strerror_const("Missing selector terminator ']'");
return in - p;
}
*/
*stail = selector = talloc_zero(node, jpath_selector_t);
if (!selector) {
- fr_strerror_printf("Failed allocating selector");
+ fr_strerror_const("Failed allocating selector");
return in - p;
}
stail = &selector->next;
if (inlen < 1) {
bad_start:
- fr_strerror_printf("Expected root specifier '$', or current node specifier '@'");
+ fr_strerror_const("Expected root specifier '$', or current node specifier '@'");
return 0;
}
node->selector->type = JPATH_SELECTOR_RECURSIVE_DESCENT;
if ((p + 1) == end) {
- fr_strerror_printf("Path may not end in recursive descent");
+ fr_strerror_const("Path may not end in recursive descent");
goto error;
}
break;
default:
- fr_strerror_printf("Expected field specifier '.' or selector '['");
+ fr_strerror_const("Expected field specifier '.' or selector '['");
goto error;
}
}
attr_name = attr_name_with_prefix(buf, sizeof(buf), vp->da->name, format);
if (json_afrom_value_box(ctx, &value, vp, format) < 0) {
- fr_strerror_printf("Failed to convert attribute value to JSON object");
+ fr_strerror_const("Failed to convert attribute value to JSON object");
error:
json_object_put(obj);
return NULL;
* Find the 'values' array to add the current value to.
*/
if (!fr_cond_assert(json_object_object_get_ex(vp_object, "value", &values))) {
- fr_strerror_printf("Inconsistent JSON tree");
+ fr_strerror_const("Inconsistent JSON tree");
goto error;
}
attr_name = attr_name_with_prefix(buf, sizeof(buf), vp->da->name, format);
if (json_afrom_value_box(ctx, &value, vp, format) < 0) {
- fr_strerror_printf("Failed to convert attribute value to JSON object");
+ fr_strerror_const("Failed to convert attribute value to JSON object");
json_object_put(obj);
return NULL;
}
attr_name = attr_name_with_prefix(buf, sizeof(buf), vp->da->name, format);
if (json_afrom_value_box(ctx, &value, vp, format) < 0) {
- fr_strerror_printf("Failed to convert attribute value to JSON object");
+ fr_strerror_const("Failed to convert attribute value to JSON object");
json_object_put(obj);
return NULL;
}
struct json_object *value;
if (json_afrom_value_box(ctx, &value, vp, format) < 0) {
- fr_strerror_printf("Failed to convert attribute value to JSON object");
+ fr_strerror_const("Failed to convert attribute value to JSON object");
json_object_put(obj);
return NULL;
}
ldap_get_option(conn->handle, LDAP_OPT_ERROR_NUMBER, &lib_errno);
if (lib_errno != LDAP_SUCCESS) goto process_error;
- fr_strerror_printf("No result available");
+ fr_strerror_const("No result available");
return LDAP_PROC_NO_RESULT;
}
switch (lib_errno) {
case LDAP_SUCCESS:
- fr_strerror_printf("Success");
+ fr_strerror_const("Success");
break;
case LDAP_SASL_BIND_IN_PROGRESS:
- fr_strerror_printf("Continuing");
+ fr_strerror_const("Continuing");
status = LDAP_PROC_CONTINUE;
break;
case LDAP_NO_SUCH_OBJECT:
- fr_strerror_printf("The specified DN wasn't found");
+ fr_strerror_const("The specified DN wasn't found");
status = LDAP_PROC_BAD_DN;
/*
goto error_string;
case LDAP_INSUFFICIENT_ACCESS:
- fr_strerror_printf("Insufficient access. Check the identity and password configuration directives");
+ fr_strerror_const("Insufficient access. Check the identity and password configuration directives");
status = LDAP_PROC_NOT_PERMITTED;
break;
case LDAP_UNWILLING_TO_PERFORM:
- fr_strerror_printf("Server was unwilling to perform");
+ fr_strerror_const("Server was unwilling to perform");
status = LDAP_PROC_NOT_PERMITTED;
break;
case LDAP_FILTER_ERROR:
- fr_strerror_printf("Bad search filter");
+ fr_strerror_const("Bad search filter");
status = LDAP_PROC_ERROR;
break;
case LDAP_TIMEOUT:
- fr_strerror_printf("Timed out while waiting for server to respond");
+ fr_strerror_const("Timed out while waiting for server to respond");
status = LDAP_PROC_TIMEOUT;
break;
case LDAP_TIMELIMIT_EXCEEDED:
- fr_strerror_printf("Time limit exceeded");
+ fr_strerror_const("Time limit exceeded");
status = LDAP_PROC_TIMEOUT;
break;
switch (lib_errno) {
case 0:
lib_errno = LDAP_TIMEOUT;
- fr_strerror_printf("timeout waiting for result");
+ fr_strerror_const("timeout waiting for result");
return LDAP_PROC_TIMEOUT;
case -1:
} else if (strncmp(REDIS_ERROR_ASK_STR, redirect->str, sizeof(REDIS_ERROR_ASK_STR) - 1) == 0) {
q = p + sizeof(REDIS_ERROR_ASK_STR); /* not a typo, skip space too */
} else {
- fr_strerror_printf("No '-MOVED' or '-ASK' log_prefix");
+ fr_strerror_const("No '-MOVED' or '-ASK' log_prefix");
return FR_REDIS_CLUSTER_RCODE_BAD_INPUT;
}
if ((size_t)(q - p) >= (size_t)redirect->len) {
- fr_strerror_printf("Truncated");
+ fr_strerror_const("Truncated");
return FR_REDIS_CLUSTER_RCODE_BAD_INPUT;
}
p = q;
p = q;
if (*p != ' ') {
- fr_strerror_printf("Missing key/host separator");
+ fr_strerror_const("Missing key/host separator");
return FR_REDIS_CLUSTER_RCODE_BAD_INPUT;
}
p++; /* Skip the ' ' */
spare = fr_fifo_peek(cluster->free_nodes);
if (!spare) {
out_of_nodes:
- fr_strerror_printf("Reached maximum connected nodes");
+ fr_strerror_const("Reached maximum connected nodes");
rcode = FR_REDIS_CLUSTER_RCODE_FAILED;
error:
cluster->remapping = false;
switch (fr_redis_command_status(conn, reply)) {
case REDIS_RCODE_RECONNECT:
fr_redis_reply_free(&reply);
- fr_strerror_printf("No connections available");
+ fr_strerror_const("No connections available");
return FR_REDIS_CLUSTER_RCODE_NO_CONNECTION;
case REDIS_RCODE_ERROR:
fr_redis_reply_free(&reply);
return FR_REDIS_CLUSTER_RCODE_IGNORED;
}
- fr_strerror_printf("Unknown client error");
+ fr_strerror_const("Unknown client error");
return FR_REDIS_CLUSTER_RCODE_FAILED;
case REDIS_RCODE_SUCCESS:
*/
spare = fr_fifo_peek(cluster->free_nodes);
if (!spare) {
- fr_strerror_printf("Reached maximum connected nodes");
+ fr_strerror_const("Reached maximum connected nodes");
pthread_mutex_unlock(&cluster->mutex);
return FR_REDIS_CLUSTER_RCODE_FAILED;
}
fr_fifo_push(cluster->free_nodes, spare);
pthread_mutex_unlock(&cluster->mutex);
- fr_strerror_printf("No connections available");
+ fr_strerror_const("No connections available");
return FR_REDIS_CLUSTER_RCODE_NO_CONNECTION;
}
fr_pool_connection_release(found->pool, NULL, rconn);
spare = fr_fifo_peek(cluster->free_nodes);
if (!spare) {
- fr_strerror_printf("Reached maximum connected nodes");
+ fr_strerror_const("Reached maximum connected nodes");
pthread_mutex_unlock(&cluster->mutex);
return -1;
}
context.count = 0;
context.found = talloc_zero_array(ctx, fr_socket_t, in_use);
if (!context.found) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
*pipelined = 0; /* all outstanding responses should be cleared */
- fr_strerror_printf("Too many pipelined commands");
+ fr_strerror_const("Too many pipelined commands");
out[0] = NULL;
return REDIS_RCODE_ERROR;
}
p = strstr(reply->str, "redis_version:");
if (!p) {
- fr_strerror_printf("Response did not contain version string");
+ fr_strerror_const("Response did not contain version string");
goto error;
}
for (p = (uint8_t const *) name; *p != '\0'; p++) {
if (*p < ' ') {
- fr_strerror_printf("Invalid control character in name");
+ fr_strerror_const("Invalid control character in name");
return false;
}
((*p >= '[') && (*p <= '^')) ||
((*p > 'z') && (*p <= 0xf7)) ||
(*p == '`')) {
- fr_strerror_printf("Invalid special character");
+ fr_strerror_const("Invalid special character");
return false;
}
*/
if (fr_utf8_char(p, -1)) continue;
- fr_strerror_printf("Invalid non-UTF8 character in name");
+ fr_strerror_const("Invalid non-UTF8 character in name");
}
return true;
*/
while ((*str != end) || (count > 0)) {
if (!*str) {
- fr_strerror_printf("String ends before closing brace.");
+ fr_strerror_const("String ends before closing brace.");
return -1;
}
(*str != ' ') &&
(*str != '|') &&
(*str != '\t')) {
- fr_strerror_printf("Invalid text after quoted string.");
+ fr_strerror_const("Invalid text after quoted string.");
return -1;
}
} else {
while (*str != quote) {
if (!*str) {
- fr_strerror_printf("String is not terminated with a quotation character.");
+ fr_strerror_const("String is not terminated with a quotation character.");
return -1;
}
if (*str == '\\') {
str++;
if (!*str) {
- fr_strerror_printf("Invalid backslash at end of string.");
+ fr_strerror_const("Invalid backslash at end of string.");
return -1;
}
str++;
(*str != '\t') &&
(*str != '\r') &&
(*str != '\n')) {
- fr_strerror_printf("Invalid text after quoted string.");
+ fr_strerror_const("Invalid text after quoted string.");
return -1;
}
*/
while ((*str != end) || (count > 0)) {
if (!*str) {
- fr_strerror_printf("String ends before closing brace.");
+ fr_strerror_const("String ends before closing brace.");
return -1;
}
(*str != '\t') &&
(*str != '\r') &&
(*str != '\n')) {
- fr_strerror_printf("Invalid text after quoted string.");
+ fr_strerror_const("Invalid text after quoted string.");
return -1;
}
} else {
*/
if (strcmp(name, "...") == 0) {
if (!allow_varargs) {
- fr_strerror_printf("Varargs MUST NOT be in an [...] or (...) syntax.");
+ fr_strerror_const("Varargs MUST NOT be in an [...] or (...) syntax.");
return -1;
}
if (!prev || *p) {
- fr_strerror_printf("Varargs MUST be the last argument in the syntax list.");
+ fr_strerror_const("Varargs MUST be the last argument in the syntax list.");
return -1;
}
* MUST be a known data type.
*/
if (prev->type >= FR_TYPE_FIXED) {
- fr_strerror_printf("Varargs MUST be preceded by a data type.");
+ fr_strerror_const("Varargs MUST be preceded by a data type.");
return -1;
}
argv = talloc_zero(ctx, fr_cmd_argv_t);
q = option + strlen(option) - 1;
if (*q != ']') {
- fr_strerror_printf("Optional syntax is not properly terminated");
+ fr_strerror_const("Optional syntax is not properly terminated");
return -1;
}
q = option + strlen(option) - 1;
if (*q != ')') {
- fr_strerror_printf("Alternate syntax is not properly terminated");
+ fr_strerror_const("Alternate syntax is not properly terminated");
return -1;
}
}
if (*p) {
- fr_strerror_printf("Too many arguments passed in syntax string");
+ fr_strerror_const("Too many arguments passed in syntax string");
return -1;
}
* This is a place-holder for tab expansion.
*/
if (!table->name) {
- fr_strerror_printf("A name MUST be specified.");
+ fr_strerror_const("A name MUST be specified.");
return -1;
}
if (!name && table->add_name) {
- fr_strerror_printf("An additional name must be specified");
+ fr_strerror_const("An additional name must be specified");
return -1;
}
}
if (!cmd->intermediate) {
- fr_strerror_printf("Cannot add a subcommand to a pre-existing command.");
+ fr_strerror_const("Cannot add a subcommand to a pre-existing command.");
return -1;
}
*/
if (argc == 0) {
talloc_free(syntax);
- fr_strerror_printf("Invalid empty string was supplied for syntax");
+ fr_strerror_const("Invalid empty string was supplied for syntax");
return -1;
}
if ((depth + argc) >= CMD_MAX_ARGV) {
talloc_free(syntax);
- fr_strerror_printf("Too many arguments were supplied to the command.");
+ fr_strerror_const("Too many arguments were supplied to the command.");
return -1;
}
}
fr_cmd_walk_info_t info;
if (!walk_ctx || !callback) {
- fr_strerror_printf("No walk_ctx or callback specified");
+ fr_strerror_const("No walk_ctx or callback specified");
return -1;
}
p = skip_word(word);
if (!p) {
- fr_strerror_printf("Invalid string");
+ fr_strerror_const("Invalid string");
return -1;
}
type = argv->type;
if (!info->box) {
- fr_strerror_printf("No array defined for values");
+ fr_strerror_const("No array defined for values");
return -1;
}
/*
* Not done yet!
*/
- fr_strerror_printf("Internal sanity check failed");
+ fr_strerror_const("Internal sanity check failed");
return -1;
next:
fr_cmd_t *cmd;
if ((info->argc < 0) || (info->max_argc <= 0)) {
- fr_strerror_printf("argc / max_argc must be greater than zero");
+ fr_strerror_const("argc / max_argc must be greater than zero");
return -1;
}
if (!text) {
- fr_strerror_printf("No string to split.");
+ fr_strerror_const("No string to split.");
return -1;
}
* Must have something to check.
*/
if (!head) {
- fr_strerror_printf("No commands to parse.");
+ fr_strerror_const("No commands to parse.");
return -1;
}
if (!MATCHED_NAME) {
if (argc < info->argc) {
invalid:
- fr_strerror_printf("Invalid internal state");
+ fr_strerror_const("Invalid internal state");
return -1;
}
if (argc == info->max_argc) {
too_many:
- fr_strerror_printf("Too many arguments for command.");
+ fr_strerror_const("Too many arguments for command.");
return -1;
}
if ((new_argc < 0) || (new_argc >= CMD_MAX_ARGV) ||
(new_argc > info->argc)) {
- fr_strerror_printf("Invalid argument");
+ fr_strerror_const("Invalid argument");
return -1;
}
#ifdef HAVE_REGEX
if (tmpl_contains_regex(c->data.map->rhs)) {
- fr_strerror_printf("Cannot use cast with regex comparison");
+ fr_strerror_const("Cannot use cast with regex comparison");
return -(rhs - start);
}
#endif
*/
if (tmpl_is_unresolved(c->data.map->lhs) &&
(tmpl_cast_in_place(c->data.map->lhs, c->cast->type, c->cast) < 0)) {
- fr_strerror_printf("Failed to parse field");
+ fr_strerror_const("Failed to parse field");
return -(lhs - start);
}
if ((tmpl_is_data(c->data.map->lhs)) &&
(tmpl_is_unresolved(c->data.map->rhs)) &&
(tmpl_cast_in_place(c->data.map->rhs, c->cast->type, c->cast) < 0)) {
- fr_strerror_printf("Failed to parse field");
+ fr_strerror_const("Failed to parse field");
return -(rhs - start);
}
*/
if ((dict_attr_sizes[c->cast->type][1] < dict_attr_sizes[tmpl_da(c->data.map->lhs)->type][0]) ||
(dict_attr_sizes[c->cast->type][0] > dict_attr_sizes[tmpl_da(c->data.map->lhs)->type][1])) {
- fr_strerror_printf("Cannot cast to attribute of incompatible size");
+ fr_strerror_const("Cannot cast to attribute of incompatible size");
return 0;
}
}
}
if (tmpl_cast_in_place(data, type, tmpl_da(attr)) < 0) {
- fr_strerror_printf_push("Failed casting data to match attribute");
+ fr_strerror_const_push("Failed casting data to match attribute");
return -(data == lhs ? fr_sbuff_used(m_lhs) : fr_sbuff_used(m_rhs));
}
}
*/
if (c->cast && tmpl_is_unresolved(rhs) &&
(tmpl_cast_in_place(rhs, c->cast->type, c->cast) < 0)) {
- fr_strerror_printf("Failed to parse field");
+ fr_strerror_const("Failed to parse field");
return -fr_sbuff_used(m_rhs);
}
(op != T_OP_CMP_TRUE) &&
(op != T_OP_CMP_FALSE) &&
(vpt->quote == T_BARE_WORD)) {
- fr_strerror_printf("Comparison value must be a quoted string");
+ fr_strerror_const("Comparison value must be a quoted string");
TMPL_RETURN(vpt);
}
default:
if (!attr->data.attribute.was_oid) {
- fr_strerror_printf("Failed to parse value for attribute");
+ fr_strerror_const("Failed to parse value for attribute");
TMPL_RETURN(vpt);
}
/*
tmpl_attr_to_raw(attr);
if (tmpl_cast_in_place(vpt, tmpl_da(attr)->type,
c->cast ? NULL : tmpl_da(attr)) < 0) {
- fr_strerror_printf("Failed to parse value for attribute");
+ fr_strerror_const("Failed to parse value for attribute");
TMPL_RETURN(vpt);
}
break;
*/
if (tmpl_da(attr)->type == FR_TYPE_COMBO_IP_ADDR) {
if (tmpl_attr_abstract_to_concrete(attr, tmpl_value_type(vpt)) < 0) {
- fr_strerror_printf("Cannot find type for attribute");
+ fr_strerror_const("Cannot find type for attribute");
TMPL_RETURN(attr);
}
}
break;
default:
- fr_strerror_printf("Internal sanity check failed 1");
+ fr_strerror_const("Internal sanity check failed 1");
return -1;
}
rcode = fr_table_value_by_str(allowed_return_codes, c->data.vpt->name, 0);
if (!rcode) {
- fr_strerror_printf("Expected a module return code");
+ fr_strerror_const("Expected a module return code");
return -1;
}
}
static int cond_forbid_groups(tmpl_t *vpt, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs)
{
if (tmpl_is_list(vpt)) {
- fr_strerror_printf("Cannot use list references in condition");
+ fr_strerror_const("Cannot use list references in condition");
fr_sbuff_set(in, m_lhs);
return -1;
}
break;
#ifndef HAVE_REGEX
case T_SOLIDUS_QUOTED_STRING:
- fr_strerror_printf("Compiled without support for regexes");
+ fr_strerror_const("Compiled without support for regexes");
fr_sbuff_set(&our_in, &m);
fr_sbuff_advance(&our_in, 1);
goto error;
}
if ((type != T_BARE_WORD) && !fr_sbuff_next_if_char(&our_in, fr_token_quote[type])) { /* Quoting */
- fr_strerror_printf("Unterminated string");
+ fr_strerror_const("Unterminated string");
fr_sbuff_set(&our_in, &m);
fr_sbuff_advance(&our_in, 1);
goto error;
*/
if (type == T_SOLIDUS_QUOTED_STRING) {
if (!tmpl_contains_regex(vpt)) {
- fr_strerror_printf("Expected regex");
+ fr_strerror_const("Expected regex");
fr_sbuff_set(&our_in, &m);
goto error;
}
fr_sbuff_adv_past_whitespace(&our_in, SIZE_MAX);
if (!fr_sbuff_extend(&our_in)) {
- fr_strerror_printf("Empty condition is invalid");
+ fr_strerror_const("Empty condition is invalid");
error:
talloc_free(c);
return -(fr_sbuff_used_total(&our_in));
* Just for stupidity
*/
if (fr_sbuff_is_char(&our_in, '!')) {
- fr_strerror_printf("Double negation is invalid");
+ fr_strerror_const("Double negation is invalid");
goto error;
}
}
}
if (!c->data.child) {
- fr_strerror_printf("Empty condition is invalid");
+ fr_strerror_const("Empty condition is invalid");
goto error;
}
*/
if (fr_sbuff_is_char(&our_in, ')')) {
if (fr_sbuff_used_total(&our_in) == 0) {
- fr_strerror_printf("Empty string is invalid");
+ fr_strerror_const("Empty string is invalid");
goto error;
}
*/
} else if (!fr_sbuff_extend(&our_in)) {
if (brace) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
goto error;
}
if ((cond_op == COND_AND) || (cond_op == COND_OR)) {
unary:
if (c->cast) {
- fr_strerror_printf("Cannot do cast for existence check");
+ fr_strerror_const("Cannot do cast for existence check");
fr_sbuff_set(&our_in, &m_lhs_cast);
goto error;
}
if (tmpl_contains_regex(lhs)) {
- fr_strerror_printf("Unexpected regular expression");
+ fr_strerror_const("Unexpected regular expression");
fr_sbuff_set(&our_in, &m_lhs);
goto error;
}
rcode = fr_table_value_by_str(rcode_table, lhs->data.unescaped, RLM_MODULE_UNKNOWN);
if (rcode == RLM_MODULE_UNKNOWN) {
- fr_strerror_printf("Expected a module return code");
+ fr_strerror_const("Expected a module return code");
fr_sbuff_set(&our_in, &m_lhs);
goto error;
}
fr_sbuff_marker(&m_op, &our_in);
fr_sbuff_out_by_longest_prefix(&slen, &op, cond_cmp_op_table, &our_in, 0);
if (slen == 0) {
- fr_strerror_printf("Invalid operator");
+ fr_strerror_const("Invalid operator");
goto error;
}
fr_sbuff_adv_past_whitespace(&our_in, SIZE_MAX);
}
if (!fr_sbuff_extend(&our_in)) {
- fr_strerror_printf("Expected text after operator");
+ fr_strerror_const("Expected text after operator");
goto error;
}
};
if (rhs->cast != FR_TYPE_INVALID) {
- fr_strerror_printf("Unexpected cast");
+ fr_strerror_const("Unexpected cast");
fr_sbuff_set(&our_in, &m_rhs_cast);
goto error;
}
if (((op == T_OP_REG_EQ) || (op == T_OP_REG_NE)) &&
(!tmpl_contains_regex(lhs) && !tmpl_contains_regex(rhs))) {
- fr_strerror_printf("Expected regular expression");
+ fr_strerror_const("Expected regular expression");
fr_sbuff_set(&our_in, &m_rhs);
goto error;
}
if (((op != T_OP_REG_EQ) && (op != T_OP_REG_NE)) &&
(tmpl_contains_regex(lhs) || tmpl_contains_regex(rhs))) {
- fr_strerror_printf("Unexpected regular expression"); /* Fixme should point to correct operand */
+ fr_strerror_const("Unexpected regular expression"); /* Fixme should point to correct operand */
fr_sbuff_set(&our_in, &m_rhs);
goto error;
}
*/
if (fr_sbuff_is_char(&our_in, ')')) {
if (!brace) {
- fr_strerror_printf("Unexpected closing brace");
+ fr_strerror_const("Unexpected closing brace");
goto error;
}
fr_sbuff_advance(&our_in, 1);
*/
if (!fr_sbuff_extend(&our_in)) {
if (brace) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
goto error;
}
goto done;
fr_sbuff_out_by_longest_prefix(&slen, &cond_op, cond_logical_op_table,
&our_in, COND_NONE);
if (slen == 0) {
- fr_strerror_printf("Unexpected text after condition");
+ fr_strerror_const("Unexpected text after condition");
goto error;
}
if (!cf_expand_variables(cf_filename(cs), cf_lineno(cs), cf_item_to_section(cf_parent(cs)),
buffer, sizeof(buffer),
fr_sbuff_current(in), fr_sbuff_remaining(in), NULL)) {
- fr_strerror_printf("Failed expanding configuration variable");
+ fr_strerror_const("Failed expanding configuration variable");
return 0;
}
if (input_fd) {
if (pipe(to_child) < 0) {
error2:
- fr_strerror_printf_push("Failed opening pipe to read to child");
+ fr_strerror_const_push("Failed opening pipe to read to child");
talloc_free(argv);
goto error;
}
pthread_mutex_unlock(&(ef->mutex));
- fr_strerror_printf("Attempt to unlock file which is not tracked");
+ fr_strerror_const("Attempt to unlock file which is not tracked");
return -1;
}
config = talloc_zero(ctx, main_config_t);
if (!config) {
- fr_strerror_printf("Failed allocating main config");
+ fr_strerror_const("Failed allocating main config");
return NULL;
}
*/
if (token != T_BARE_WORD) {
if (!fr_sbuff_is_char(&sbuff, fr_token_quote[token])) {
- fr_strerror_printf("Unexpected end of quoted string");
+ fr_strerror_const("Unexpected end of quoted string");
return -1;
}
slen = fr_sbuff_adv_past_whitespace(&sbuff, SIZE_MAX);
if (slen < 0) {
- fr_strerror_printf("Unexpected end of string after parsing left side");
+ fr_strerror_const("Unexpected end of string after parsing left side");
goto error;
}
*/
fr_sbuff_out_by_longest_prefix(&slen, &map->op, op_table, &sbuff, 0);
if (slen <= 0) {
- fr_strerror_printf("Invalid operator");
+ fr_strerror_const("Invalid operator");
goto error;
}
slen = fr_sbuff_adv_past_whitespace(&sbuff, SIZE_MAX);
if (slen < 0) {
- fr_strerror_printf("Unexpected end of string after operator");
+ fr_strerror_const("Unexpected end of string after operator");
goto error;
}
if (slen < 0) goto error;
if (slen == 0) {
- fr_strerror_printf("Unexpected end of input after operator");
+ fr_strerror_const("Unexpected end of input after operator");
goto error;
}
fr_assert(map->rhs != NULL);
*/
if (token != T_BARE_WORD) {
if (!fr_sbuff_is_char(&sbuff, fr_token_quote[token])) {
- fr_strerror_printf("Unexpected end of quoted string");
+ fr_strerror_const("Unexpected end of quoted string");
return -1;
}
if (!tmpl_is_attr((*out)->lhs)) {
TALLOC_FREE(*out);
- fr_strerror_printf("Left operand must be an attribute");
+ fr_strerror_const("Left operand must be an attribute");
return -1;
}
map = map_alloc(ctx);
if (!map) {
oom:
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
tmp_ctx = talloc_new(request);
if (!tmp_ctx) {
- fr_strerror_printf("Out Of Memory");
+ fr_strerror_const("Out Of Memory");
return -(depth);
}
if (snmp_op != FR_FREERADIUS_SNMP_OPERATION_VALUE_GETNEXT) {
invalid:
- fr_strerror_printf("Invalid OID: Match stopped here");
+ fr_strerror_const("Invalid OID: Match stopped here");
return -(depth);
}
return 0; /* done */
}
- fr_strerror_printf("Invalid OID: Hit max index");
+ fr_strerror_const("Invalid OID: Hit max index");
return -(depth);
}
FR_PROTO_STACK_PRINT(da_stack, depth);
if (map[0].last < &map[1]) {
- fr_strerror_printf("Invalid OID: Empty map");
+ fr_strerror_const("Invalid OID: Empty map");
error:
return -(ssize_t)depth;
}
if (map[1].type != FR_FREERADIUS_SNMP_TYPE_OBJECT) {
- fr_strerror_printf("Invalid OID: Cannot traverse leaf");
+ fr_strerror_const("Invalid OID: Cannot traverse leaf");
goto error;
}
map_p = snmp_map_search(map, da_stack->da[depth]);
if (!map_p) {
invalid:
- fr_strerror_printf("Invalid OID: Match stopped here");
+ fr_strerror_const("Invalid OID: Match stopped here");
error:
return -(ssize_t)depth;
}
if (!map_p->child) {
- fr_strerror_printf("Internal error: Dictionary and SNMP map structure mismatch");
+ fr_strerror_const("Internal error: Dictionary and SNMP map structure mismatch");
goto error;
}
*/
map_p = snmp_map_search(map, da_stack->da[depth]);
if (!map_p) {
- fr_strerror_printf("Invalid OID: Match stopped here");
+ fr_strerror_const("Invalid OID: Match stopped here");
error:
return -(ssize_t)depth;
}
* Verify map is a leaf
*/
if (map_p->type == FR_FREERADIUS_SNMP_TYPE_OBJECT) {
- fr_strerror_printf("Invalid OID: Is not a leaf node");
+ fr_strerror_const("Invalid OID: Is not a leaf node");
goto error;
}
if (!map_p->get) {
- fr_strerror_printf("Invalid operation: Node does not support GET operations");
+ fr_strerror_const("Invalid operation: Node does not support GET operations");
goto error;
}
*/
if (!da_stack->da[depth]) {
if (snmp_op != FR_FREERADIUS_SNMP_OPERATION_VALUE_GETNEXT) {
- fr_strerror_printf("Invalid OID: Not a leaf");
+ fr_strerror_const("Invalid OID: Not a leaf");
return -(ssize_t)(depth - 1);
}
snmp_next_leaf(da_stack, depth, &map[1]);
{
RDEBUG4("EXPAND TMPL EXEC");
if (!buff) {
- fr_strerror_printf("Missing expansion buffer for EXEC");
+ fr_strerror_const("Missing expansion buffer for EXEC");
return -1;
}
RDEBUG4("EXPAND TMPL XLAT PARSED");
RDEBUG2("EXPAND %s", vpt->name); /* xlat_struct doesn't do this */
if (!buff) {
- fr_strerror_printf("Missing expansion buffer for XLAT_STRUCT");
+ fr_strerror_const("Missing expansion buffer for XLAT_STRUCT");
return -1;
}
/* Error in expansion, this is distinct from zero length expansion */
*/
case FR_TYPE_STRING:
if (!buff) {
- fr_strerror_printf("Missing expansion buffer for octet->string cast");
+ fr_strerror_const("Missing expansion buffer for octet->string cast");
return -1;
}
if (bufflen <= to_cast->vb_length) {
switch (dst_type) {
case FR_TYPE_STRING:
if (!buff) {
- fr_strerror_printf("Missing expansion buffer to store cast output");
+ fr_strerror_const("Missing expansion buffer to store cast output");
error:
talloc_free(ctx);
return -1;
case FR_TYPE_OCTETS:
if (!buff) {
- fr_strerror_printf("Missing expansion buffer to store cast output");
+ fr_strerror_const("Missing expansion buffer to store cast output");
goto error;
}
if (from_cast->vb_length > bufflen) {
vp = fr_pair_copy(ctx, vp);
if (!vp) {
fr_pair_list_free(out);
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
err = -4;
break;
}
parent = fr_dlist_prev(&vpt->data.attribute.ar, ref);
if (!fr_dict_attr_common_parent(parent->ar_da, da, true)) {
- fr_strerror_printf("New leaf da and old leaf da do not share the same ancestor");
+ fr_strerror_const("New leaf da and old leaf da do not share the same ancestor");
return -1;
}
} else {
if (fr_sbuff_out(&sberr, &ar->num, &tmp) == 0) {
if (sberr == FR_SBUFF_PARSE_ERROR_NOT_FOUND) {
- fr_strerror_printf("Invalid array index");
+ fr_strerror_const("Invalid array index");
if (err) *err = TMPL_ATTR_ERROR_INVALID_ARRAY_INDEX;
error:
return TMPL_ATTR_REF_BAD_FILTER;
}
- fr_strerror_printf("Invalid array index");
+ fr_strerror_const("Invalid array index");
if (err) *err = TMPL_ATTR_ERROR_INVALID_ARRAY_INDEX;
goto error;
}
* marker points to the bad char.
*/
if (!fr_sbuff_next_if_char(name, ']')) {
- fr_strerror_printf("No closing ']' for array index");
+ fr_strerror_const("No closing ']' for array index");
if (err) *err = TMPL_ATTR_ERROR_INVALID_ARRAY_INDEX;
goto error;
}
size_t len;
if (depth > FR_DICT_MAX_TLV_STACK) {
- fr_strerror_printf("Attribute nesting too deep");
+ fr_strerror_const("Attribute nesting too deep");
if (err) *err = TMPL_ATTR_ERROR_NESTING_TOO_DEEP;
return -1;
}
* Input too short
*/
if (!fr_sbuff_extend(name)) {
- fr_strerror_printf("Missing attribute reference");
+ fr_strerror_const("Missing attribute reference");
if (err) *err = TMPL_ATTR_ERROR_INVALID_NAME;
return -1;
}
name, FR_DICT_ATTR_MAX_NAME_LEN + 1,
fr_dict_attr_allowed_chars);
if (len == 0) {
- fr_strerror_printf("Invalid attribute name");
+ fr_strerror_const("Invalid attribute name");
if (err) *err = TMPL_ATTR_ERROR_INVALID_NAME;
error:
talloc_free(ar);
return -1;
}
if (len > FR_DICT_ATTR_MAX_NAME_LEN) {
- fr_strerror_printf("Attribute name is too long");
+ fr_strerror_const("Attribute name is too long");
if (err) *err = TMPL_ATTR_ERROR_INVALID_NAME;
goto error;
}
fr_sbuff_marker(&m_s, name);
if (depth > FR_DICT_MAX_TLV_STACK) {
- fr_strerror_printf("Attribute nesting too deep");
+ fr_strerror_const("Attribute nesting too deep");
if (err) *err = TMPL_ATTR_ERROR_NESTING_TOO_DEEP;
error:
fr_sbuff_marker_release(&m_s);
* Input too short
*/
if (!fr_sbuff_extend(name)) {
- fr_strerror_printf("Missing attribute reference");
+ fr_strerror_const("Missing attribute reference");
if (err) *err = TMPL_ATTR_ERROR_INVALID_NAME;
goto error;
}
if (!namespace && t_rules->dict_def) parent = namespace = fr_dict_root(t_rules->dict_def);
if (!namespace && !t_rules->disallow_internal) parent = namespace = fr_dict_root(fr_dict_internal());
if (!namespace) {
- fr_strerror_printf("Attribute references must be qualified with a protocol when used here");
+ fr_strerror_const("Attribute references must be qualified with a protocol when used here");
if (err) *err = TMPL_ATTR_ERROR_UNQUALIFIED_NOT_ALLOWED;
fr_sbuff_set(name, &m_s);
goto error;
}
if (!t_rules->allow_unknown) {
- fr_strerror_printf("Unknown attributes not allowed here");
+ fr_strerror_const("Unknown attributes not allowed here");
if (err) *err = TMPL_ATTR_ERROR_UNKNOWN_NOT_ALLOWED;
fr_sbuff_set(name, &m_s);
goto error;
* errors from the dictionary code.
*/
if (!t_rules->allow_unresolved) {
- fr_strerror_printf_push("Unresolved attributes not allowed here");
+ fr_strerror_const_push("Unresolved attributes not allowed here");
if (err) *err = TMPL_ATTR_ERROR_UNRESOLVED_NOT_ALLOWED;
fr_sbuff_set(name, &m_s);
goto error;
* true, we still allow the resolution.
*/
if (t_rules->disallow_internal && (found_in == fr_dict_internal())) {
- fr_strerror_printf("Internal attributes not allowed here");
+ fr_strerror_const("Internal attributes not allowed here");
if (err) *err = TMPL_ATTR_ERROR_INTERNAL_NOT_ALLOWED;
fr_sbuff_set(name, &m_s);
goto error;
* Nesting level too deep
*/
if (depth > TMPL_MAX_REQUEST_REF_NESTING) {
- fr_strerror_printf("Request ref nesting too deep");
+ fr_strerror_const("Request ref nesting too deep");
if (err) *err = TMPL_ATTR_ERROR_NESTING_TOO_DEEP;
return -1;
}
if (t_rules->attr_parent || t_rules->disallow_qualifiers) {
- fr_strerror_printf("It is not permitted to specify a request reference here");
+ fr_strerror_const("It is not permitted to specify a request reference here");
if (err) *err = TMPL_ATTR_ERROR_INVALID_LIST_QUALIFIER;
return -1;
}
if (err) *err = TMPL_ATTR_ERROR_NONE;
if (!fr_sbuff_extend(&our_name)) {
- fr_strerror_printf("Empty attribute reference");
+ fr_strerror_const("Empty attribute reference");
if (err) *err = TMPL_ATTR_ERROR_EMPTY;
FR_SBUFF_ERROR_RETURN(&our_name);
}
switch (t_rules->prefix) {
case TMPL_ATTR_REF_PREFIX_YES:
if (!fr_sbuff_next_if_char(&our_name, '&')) {
- fr_strerror_printf("Invalid attribute reference, missing '&' prefix");
+ fr_strerror_const("Invalid attribute reference, missing '&' prefix");
if (err) *err = TMPL_ATTR_ERROR_BAD_PREFIX;
FR_SBUFF_ERROR_RETURN(&our_name);
}
case TMPL_ATTR_REF_PREFIX_NO:
if (fr_sbuff_is_char(&our_name, '&')) {
- fr_strerror_printf("Attribute references used here must not have a '&' prefix");
+ fr_strerror_const("Attribute references used here must not have a '&' prefix");
if (err) *err = TMPL_ATTR_ERROR_BAD_PREFIX;
FR_SBUFF_ERROR_RETURN(&our_name);
}
&our_name, t_rules->list_def);
if ((t_rules->attr_parent || t_rules->disallow_qualifiers) && (list_len > 0)) {
- fr_strerror_printf("It is not permitted to specify a pair list here");
+ fr_strerror_const("It is not permitted to specify a pair list here");
if (err) *err = TMPL_ATTR_ERROR_INVALID_LIST_QUALIFIER;
talloc_free(vpt);
FR_SBUFF_ERROR_RETURN(&our_name);
vpt->rules = *t_rules; /* Record the rules */
if (!tmpl_substr_terminal_check(&our_name, p_rules)) {
- fr_strerror_printf("Unexpected text after attribute reference");
+ fr_strerror_const("Unexpected text after attribute reference");
if (err) *err = TMPL_ATTR_ERROR_MISSING_TERMINATOR;
talloc_free(vpt);
*out = NULL;
tmpl_t *vpt;
if (!fr_sbuff_out(NULL, &a_bool, &our_in)) {
- fr_strerror_printf("Not a boolean value");
+ fr_strerror_const("Not a boolean value");
return 0;
}
if (!tmpl_substr_terminal_check(&our_in, p_rules)) {
- fr_strerror_printf("Unexpected text after bool");
+ fr_strerror_const("Unexpected text after bool");
return -fr_sbuff_used(in);
}
*/
len = fr_sbuff_out_abstrncpy_allowed(vpt, &hex, &our_in, SIZE_MAX, sbuff_char_class_hex);
if (len & 0x01) {
- fr_strerror_printf("Hex string not even length");
+ fr_strerror_const("Hex string not even length");
error:
talloc_free(vpt);
return -fr_sbuff_used(&our_in);
}
if (len == 0) {
- fr_strerror_printf("Zero length hex string is invalid");
+ fr_strerror_const("Zero length hex string is invalid");
goto error;
}
if (!tmpl_substr_terminal_check(&our_in, p_rules)) {
- fr_strerror_printf("Unexpected text after hex string");
+ fr_strerror_const("Unexpected text after hex string");
goto error;
}
*/
if (fr_sbuff_next_if_char(&our_in, '/')) {
if (!fr_sbuff_out(NULL, &octet, &our_in)) {
- fr_strerror_printf("IPv4 CIDR mask malformed");
+ fr_strerror_const("IPv4 CIDR mask malformed");
goto error;
}
if (octet > 32) {
- fr_strerror_printf("IPv4 CIDR mask too high");
+ fr_strerror_const("IPv4 CIDR mask too high");
goto error;
}
}
if (!tmpl_substr_terminal_check(&our_in, p_rules)) {
- fr_strerror_printf("Unexpected text after IPv4 string or prefix");
+ fr_strerror_const("Unexpected text after IPv4 string or prefix");
goto error;
}
*/
sep_a = memchr(fr_sbuff_current(&m), '.', len);
if (sep_a && (!(sep_b = memchr(fr_sbuff_current(&m), ':', len)) || (sep_b > sep_a))) {
- fr_strerror_printf("First IPv6 component separator was a '.'");
+ fr_strerror_const("First IPv6 component separator was a '.'");
goto error;
}
*/
sep_a = memchr(fr_sbuff_current(&m), ':', len);
if (!sep_a) {
- fr_strerror_printf("No IPv6 component separator");
+ fr_strerror_const("No IPv6 component separator");
goto error;
}
if (fr_sbuff_next_if_char(&our_in, '%')) {
len = fr_sbuff_adv_until(&our_in, IFNAMSIZ + 1, p_rules->terminals, '\0');
if ((len < 1) || (len > IFNAMSIZ)) {
- fr_strerror_printf("IPv6 scope too long");
+ fr_strerror_const("IPv6 scope too long");
goto error;
}
}
uint8_t mask;
if (!fr_sbuff_out(NULL, &mask, &our_in)) {
- fr_strerror_printf("IPv6 CIDR mask malformed");
+ fr_strerror_const("IPv6 CIDR mask malformed");
goto error;
}
if (mask > 128) {
- fr_strerror_printf("IPv6 CIDR mask too high");
+ fr_strerror_const("IPv6 CIDR mask too high");
goto error;
}
}
if (!tmpl_substr_terminal_check(&our_in, p_rules)) {
- fr_strerror_printf("Unexpected text after IPv6 string or prefix");
+ fr_strerror_const("Unexpected text after IPv6 string or prefix");
goto error;
}
if (slen <= 0) return 0;
if (!tmpl_substr_terminal_check(&our_in, p_rules)) {
- fr_strerror_printf("Unexpected text after signed integer");
+ fr_strerror_const("Unexpected text after signed integer");
error:
return -fr_sbuff_used(&our_in);
}
if (slen <= 0) return slen;
if (!tmpl_substr_terminal_check(&our_in, p_rules)) {
- fr_strerror_printf("Unexpected text after unsigned integer");
+ fr_strerror_const("Unexpected text after unsigned integer");
goto error;
}
p_rules ? p_rules->terminals : NULL,
p_rules ? p_rules->escapes : NULL);
if (slen == 0) {
- fr_strerror_printf("Empty bareword is invalid");
+ fr_strerror_const("Empty bareword is invalid");
talloc_free(vpt);
return 0;
}
fr_sbuff_marker(&m, &our_in);
fr_sbuff_out_by_longest_prefix(&slen, &cast, fr_value_box_type_table, &our_in, FR_TYPE_INVALID);
if (cast == FR_TYPE_INVALID) {
- fr_strerror_printf("Unknown data type");
+ fr_strerror_const("Unknown data type");
FR_SBUFF_ERROR_RETURN(&our_in);
}
if (fr_dict_non_data_types[cast]) {
- fr_strerror_printf("Forbidden data type in cast");
+ fr_strerror_const("Forbidden data type in cast");
FR_SBUFF_MARKER_ERROR_RETURN(&m);
}
if (!fr_sbuff_next_if_char(&our_in, '>')) {
- fr_strerror_printf("Unterminated cast");
+ fr_strerror_const("Unterminated cast");
FR_SBUFF_ERROR_RETURN(&our_in);
}
fr_sbuff_adv_past_whitespace(&our_in, SIZE_MAX);
int tmpl_cast_set(tmpl_t *vpt, fr_type_t type)
{
if (fr_dict_non_data_types[type]) {
- fr_strerror_printf("Forbidden data type in cast");
+ fr_strerror_const("Forbidden data type in cast");
return -1;
}
continue;
case TMPL_ATTR_TYPE_UNRESOLVED: /* Shouldn't have been called */
- fr_strerror_printf("Remaining attributes are unresolved");
+ fr_strerror_const("Remaining attributes are unresolved");
return -1;
case TMPL_ATTR_TYPE_UNKNOWN:
fr_dict_unknown_free(&ar->ar_da);
ar->ar_da = known;
} else if (!fr_cond_assert(!next)) {
- fr_strerror_printf("Only the leaf may be raw");
+ fr_strerror_const("Only the leaf may be raw");
return -1;
}
}
int left;
if (strlen(cmd) > (argv_buflen - 1)) {
- fr_strerror_printf("Expansion string is too long for output buffer");
+ fr_strerror_const("Expansion string is too long for output buffer");
return -1;
}
* Check for bad escapes.
*/
if (cmd[strlen(cmd) - 1] == '\\') {
- fr_strerror_printf("Expansion string ends with a trailing backslash - invalid escape sequence");
+ fr_strerror_const("Expansion string ends with a trailing backslash - invalid escape sequence");
return -1;
}
*/
while (*from && (*from != ' ') && (*from != '\t')) {
if (to >= argv_buf + argv_buflen - 1) {
- fr_strerror_printf("Expansion string is too long for output buffer");
+ fr_strerror_const("Expansion string is too long for output buffer");
return -1;
}
case '\'':
length = rad_copy_string_bare(to, from);
if (length < 0) {
- fr_strerror_printf("Invalid quoted string in expansion");
+ fr_strerror_const("Invalid quoted string in expansion");
return -1;
}
from += length+2;
length = rad_copy_variable(to, from);
if (length < 0) {
- fr_strerror_printf("Invalid variable in expansion");
+ fr_strerror_const("Invalid variable in expansion");
return -1;
}
from += length;
* We have to have SOMETHING, at least.
*/
if (argc <= 0) {
- fr_strerror_printf("Expansion string is empty");
+ fr_strerror_const("Expansion string is empty");
return -1;
}
*/
sublen = 0;
} else {
- fr_strerror_printf("Failed expanding substring");
+ fr_strerror_const("Failed expanding substring");
return -1;
}
}
left--;
if (left <= 0) {
- fr_strerror_printf("Ran out of space while expanding arguments");
+ fr_strerror_const("Ran out of space while expanding arguments");
return -1;
}
}
#endif
if (!rbtree_insert(server_section_name_tree, entry)) {
- fr_strerror_printf("Failed inserting entry into internal tree");
+ fr_strerror_const("Failed inserting entry into internal tree");
return -1;
}
if (CRYPTO_memcmp(mac_a, autn + 8, 8) != 0) {
FR_PROTO_HEX_DUMP(autn + 8, 8, "Received MAC_A");
- fr_strerror_printf("MAC mismatch");
+ fr_strerror_const("MAC mismatch");
return -1;
}
value = fr_value_box_alloc(ctx, FR_TYPE_UINT32, NULL, false);
if (!value) {
oom:
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
ret = XLAT_ACTION_FAIL;
goto done;
}
}
if (!fr_sbuff_adv_past_str_literal(in, ":-")) {
- fr_strerror_printf("Expected ':-' after first expansion");
+ fr_strerror_const("Expected ':-' after first expansion");
goto error;
}
if (!node->alternate) {
talloc_free(node);
- fr_strerror_printf("Empty expansion is invalid");
+ fr_strerror_const("Empty expansion is invalid");
goto error;
}
if (!fr_sbuff_next_if_char(in, '}')) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
goto error;
}
if (!fr_sbuff_is_char(in, '}')) {
if (!fr_sbuff_remaining(in)) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
fr_sbuff_marker_release(&m_s);
return -1;
}
fr_sbuff_adv_past_allowed(in, SIZE_MAX, func_chars);
if (!fr_sbuff_is_char(in, ':')) {
- fr_strerror_printf("Can't find function/argument separator");
+ fr_strerror_const("Can't find function/argument separator");
bad_function:
*head = NULL;
fr_sbuff_set(in, &m_s); /* backtrack */
node = xlat_exp_alloc(ctx, XLAT_FUNC, fr_sbuff_current(&m_s), fr_sbuff_behind(&m_s));
if (!func) {
if (!rules || !rules->allow_unresolved) {
- fr_strerror_printf("Unresolved expansion functions are not allowed here");
+ fr_strerror_const("Unresolved expansion functions are not allowed here");
goto bad_function;
}
xlat_exp_set_type(node, XLAT_FUNC_UNRESOLVED);
}
if (!fr_sbuff_next_if_char(in, '}')) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
goto error;
}
fr_sbuff_adv_past_allowed(in, SIZE_MAX, func_chars);
if (!fr_sbuff_is_char(in, ':')) {
- fr_strerror_printf("Can't find function/argument separator");
+ fr_strerror_const("Can't find function/argument separator");
bad_function:
*head = NULL;
fr_sbuff_set(in, &m_s); /* backtrack */
node = xlat_exp_alloc(ctx, XLAT_FUNC, fr_sbuff_current(&m_s), fr_sbuff_behind(&m_s));
if (!func) {
if (!rules || !rules->allow_unresolved) {
- fr_strerror_printf("Unresolved expansion functions are not allowed here");
+ fr_strerror_const("Unresolved expansion functions are not allowed here");
goto bad_function;
}
xlat_exp_set_type(node, XLAT_FUNC_UNRESOLVED);
}
if (!fr_sbuff_next_if_char(in, ')')) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
goto error;
}
node->flags.needs_async = func->needs_async;
if (!fr_sbuff_next_if_char(in, '}')) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
goto error;
}
if (!t_rules || !t_rules->allow_unresolved) {
talloc_free(vpt);
- fr_strerror_printf("Unresolved attributes not allowed in expansions here");
+ fr_strerror_const("Unresolved attributes not allowed in expansions here");
fr_sbuff_set(in, &m_s); /* Error at the start of the attribute */
goto error;
}
}
if (!fr_sbuff_next_if_char(in, '}')) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
goto error;
}
* :-bar}
*/
if (fr_sbuff_is_str_literal(in, ":-")) {
- fr_strerror_printf("First item in alternation cannot be empty");
+ fr_strerror_const("First item in alternation cannot be empty");
return -2;
}
* e.g. '%{myfirstxlat'
*/
if (!fr_sbuff_remaining(in)) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
fr_sbuff_marker_release(&s_m);
return -1;
}
if (len == 0) {
switch (hint) {
case '}':
- fr_strerror_printf("Empty expression is invalid");
+ fr_strerror_const("Empty expression is invalid");
return -1;
case ':':
- fr_strerror_printf("Missing expansion function");
+ fr_strerror_const("Missing expansion function");
return -1;
case '[':
- fr_strerror_printf("Missing attribute name");
+ fr_strerror_const("Missing attribute name");
return -1;
default:
if (len == 0) TALLOC_FREE(node); /* Free the empty node */
if (!fr_sbuff_is_char(in, '}')) {
- fr_strerror_printf("Missing closing brace");
+ fr_strerror_const("Missing closing brace");
goto error;
}
/*
* Create ephemeral instance data for the xlat
*/
if (xlat_instantiate_ephemeral(*head) < 0) {
- fr_strerror_printf("Failed performing ephemeral instantiation for xlat");
+ fr_strerror_const("Failed performing ephemeral instantiation for xlat");
TALLOC_FREE(*head);
return 0;
}
* `back quoted strings aren't supported`
*/
case T_BACK_QUOTED_STRING:
- fr_strerror_printf("Unexpected `...` string");
+ fr_strerror_const("Unexpected `...` string");
goto error;
default:
}
if ((quote != T_BARE_WORD) && !fr_sbuff_next_if_char(&our_in, fr_token_quote[quote])) { /* Quoting */
- fr_strerror_printf("Unterminated string");
+ fr_strerror_const("Unterminated string");
fr_sbuff_set(&our_in, &m);
goto error;
}
* arguments were smushed together.
*/
if (fr_sbuff_extend(&our_in) && (len == 0)) {
- fr_strerror_printf("Unexpected text after argument");
+ fr_strerror_const("Unexpected text after argument");
goto error;
}
}
break;
default:
- fr_strerror_printf("Invalid base64 padding data");
+ fr_strerror_const("Invalid base64 padding data");
return p - end;
}
pthread_mutex_lock(&cap_mutex);
if (set == CAP_PERMITTED) {
- fr_strerror_printf("Can't modify permitted capabilities");
+ fr_strerror_const("Can't modify permitted capabilities");
goto done;
}
#else
int fr_get_lsan_state(void)
{
- fr_strerror_printf("Not built with support for LSAN interface");
+ fr_strerror_const("Not built with support for LSAN interface");
return -2;
}
#endif
#else
static int fr_get_debug_state(void)
{
- fr_strerror_printf("PTRACE not available");
+ fr_strerror_const("PTRACE not available");
return DEBUGGER_STATE_UNKNOWN_NO_PTRACE;
}
#else
static int fr_set_pr_dumpable_flag(UNUSED bool dumpable)
{
- fr_strerror_printf("Changing value of PR_DUMPABLE not supported on this system");
+ fr_strerror_const("Changing value of PR_DUMPABLE not supported on this system");
return -2;
}
#endif
#else
static int fr_get_pr_dumpable_flag(void)
{
- fr_strerror_printf("Getting value of PR_DUMPABLE not supported on this system");
+ fr_strerror_const("Getting value of PR_DUMPABLE not supported on this system");
return -2;
}
#endif
*/
len = snprintf(filename, sizeof(filename), "%.*s", (int)(q - panic_action), panic_action);
if (is_truncated(len, sizeof(filename))) {
- fr_strerror_printf("Failed writing panic_action to temporary buffer (truncated)");
+ fr_strerror_const("Failed writing panic_action to temporary buffer (truncated)");
return -1;
}
p = filename;
out += ret = snprintf(out, left, "%.*s%s", (int) (q - p), p, program ? program : "");
if (left <= ret) {
oob:
- fr_strerror_printf("Panic action too long");
+ fr_strerror_const("Panic action too long");
return -1;
}
left -= ret;
{
common->filename = talloc_strdup(common, filename);
if (!common->filename) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
common->line = line;
fixup = talloc(fctx->pool, dict_fixup_enumv_t);
if (!fixup) {
oom:
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
*fixup = (dict_fixup_enumv_t) {
fixup = talloc(fctx->pool, dict_fixup_group_t);
if (!fixup) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
*fixup = (dict_fixup_group_t) {
fixup = talloc(fctx->pool, dict_fixup_clone_t);
if (!fixup) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
*fixup = (dict_fixup_clone_t) {
if (!(_dict)) { \
_dict = dict_gctx ? dict_gctx->internal : NULL; \
if (unlikely(!(_dict))) { \
- fr_strerror_printf("No dictionaries available for attribute resolution"); \
+ fr_strerror_const("No dictionaries available for attribute resolution"); \
return (_ret); \
} \
} \
};
if (!fr_cond_assert(!dict->root)) {
- fr_strerror_printf("Dictionary root already set");
+ fr_strerror_const("Dictionary root already set");
return -1;
}
} else if (strcmp(name, "bit") == 0) {
if (ctx->stack[ctx->stack_depth].da->type != FR_TYPE_STRUCT) {
- fr_strerror_printf("Bit fields can only be used inside of a STRUCT");
+ fr_strerror_const("Bit fields can only be used inside of a STRUCT");
return -1;
}
} else if (length < 56) { /* for laziness in encode / decode */
type = FR_TYPE_UINT64;
} else {
- fr_strerror_printf("Invalid length for bit field");
+ fr_strerror_const("Invalid length for bit field");
return -1;
}
flags->type_size = length;
} else {
- fr_strerror_printf("Only 'octets' types can have a 'length' parameter");
+ fr_strerror_const("Only 'octets' types can have a 'length' parameter");
return -1;
}
} else if (strcmp(key, "key") == 0) {
if ((type != FR_TYPE_UINT8) && (type != FR_TYPE_UINT16) && (type != FR_TYPE_UINT32)) {
- fr_strerror_printf("The 'key' flag can only be used for attributes of type 'uint8', 'uint16', or 'uint32'");
+ fr_strerror_const("The 'key' flag can only be used for attributes of type 'uint8', 'uint16', or 'uint32'");
return -1;
}
if (flags->extra) {
- fr_strerror_printf("Bit fields cannot be key fields");
+ fr_strerror_const("Bit fields cannot be key fields");
return -1;
}
} else if (strcmp(key, "length") == 0) {
if (!value || (strcmp(value, "uint16") != 0)) {
- fr_strerror_printf("The 'length' flag can only be used with value 'uint16'");
+ fr_strerror_const("The 'length' flag can only be used with value 'uint16'");
}
flags->extra = 1;
} else if (strcmp(key, "ref") == 0) {
if (!value) {
- fr_strerror_printf("Missing attribute name for 'ref=...'");
+ fr_strerror_const("Missing attribute name for 'ref=...'");
return -1;
}
if (flags->extra) {
- fr_strerror_printf("Cannot use 'ref' with other flags");
+ fr_strerror_const("Cannot use 'ref' with other flags");
return -1;
}
} else if (strcmp(key, "clone") == 0) {
if (!value) {
- fr_strerror_printf("Missing attribute name for 'clone=...'");
+ fr_strerror_const("Missing attribute name for 'clone=...'");
return -1;
}
static int dict_gctx_push(dict_tokenize_ctx_t *ctx, fr_dict_attr_t const *da)
{
if ((ctx->stack_depth + 1) >= MAX_STACK) {
- fr_strerror_printf_push("Attribute definitions are nested too deep.");
+ fr_strerror_const_push("Attribute definitions are nested too deep.");
return -1;
}
fr_hash_table_t *namespace;
if (argc != 2) {
- fr_strerror_printf("Invalid ALIAS syntax");
+ fr_strerror_const("Invalid ALIAS syntax");
return -1;
}
* Dictionaries need to have real names, not shitty ones.
*/
if (strncmp(argv[0], "Attr-", 5) == 0) {
- fr_strerror_printf("Invalid ALIAS name");
+ fr_strerror_const("Invalid ALIAS name");
return -1;
}
}
if (!fr_hash_table_insert(namespace, new)) {
- fr_strerror_printf("Internal error storing attribute");
+ fr_strerror_const("Internal error storing attribute");
goto error;
}
char *ref = NULL;
if ((argc < 3) || (argc > 4)) {
- fr_strerror_printf("Invalid ATTRIBUTE syntax");
+ fr_strerror_const("Invalid ATTRIBUTE syntax");
return -1;
}
* Dictionaries need to have real names, not shitty ones.
*/
if (strncmp(argv[0], "Attr-", 5) == 0) {
- fr_strerror_printf("Invalid ATTRIBUTE name");
+ fr_strerror_const("Invalid ATTRIBUTE name");
return -1;
}
if (dict_process_type_field(ctx, argv[2], &type, &flags) < 0) return -1;
if (flags.extra && (flags.subtype == FLAG_BIT_FIELD)) {
- fr_strerror_printf("Bit fields can only be defined as a MEMBER of a STRUCT");
+ fr_strerror_const("Bit fields can only be defined as a MEMBER of a STRUCT");
return -1;
}
*/
if (strchr(argv[1], '.') == 0) {
if (!dict_read_sscanf_i(&attr, argv[1])) {
- fr_strerror_printf("Invalid ATTRIBUTE number");
+ fr_strerror_const("Invalid ATTRIBUTE number");
return -1;
}
} else {
if (!ctx->relative_attr) {
- fr_strerror_printf("Unknown parent for partial OID");
+ fr_strerror_const("Unknown parent for partial OID");
return -1;
}
check:
if (fr_dict_attr_ref(da)) {
- fr_strerror_printf("References MUST NOT refer to an ATTRIBUTE which also has 'ref=...'");
+ fr_strerror_const("References MUST NOT refer to an ATTRIBUTE which also has 'ref=...'");
talloc_free(ref);
return -1;
}
char *ref = NULL;
if ((argc < 2) || (argc > 3)) {
- fr_strerror_printf("Invalid MEMBER syntax");
+ fr_strerror_const("Invalid MEMBER syntax");
return -1;
}
if (ctx->stack[ctx->stack_depth].da->type != FR_TYPE_STRUCT) {
- fr_strerror_printf("MEMBER can only be used for ATTRIBUTEs of type 'struct'");
+ fr_strerror_const("MEMBER can only be used for ATTRIBUTEs of type 'struct'");
return -1;
}
* Dictionaries need to have real names, not shitty ones.
*/
if (strncmp(argv[0], "Attr-", 5) == 0) {
- fr_strerror_printf("Invalid MEMBER name");
+ fr_strerror_const("Invalid MEMBER name");
return -1;
}
if (dict_process_flag_field(ctx, argv[2], type, &flags, &ref) < 0) return -1;
if (ref && (type != FR_TYPE_TLV) && !(flags.extra && (flags.subtype == FLAG_KEY_FIELD))) {
- fr_strerror_printf("Only MEMBERs of type 'tlv' or with 'key' flags can have references");\
+ fr_strerror_const("Only MEMBERs of type 'tlv' or with 'key' flags can have references");\
return -1;
}
previous = dict_attr_child_by_num(ctx->stack[ctx->stack_depth].da,
ctx->stack[ctx->stack_depth].member_num);
if (!previous) {
- fr_strerror_printf("Failed to find previous MEMBER");
+ fr_strerror_const("Failed to find previous MEMBER");
return -1;
}
fr_dict_attr_t const *parent = ctx->stack[ctx->stack_depth].da;
if (argc != 3) {
- fr_strerror_printf("Invalid VALUE syntax");
+ fr_strerror_const("Invalid VALUE syntax");
return -1;
}
argv[0], strlen(argv[0]),
argv[1], strlen(argv[1]),
argv[2], strlen(argv[2]), parent) < 0) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
return 0;
}
}
- fr_strerror_printf("Invalid FLAGS syntax");
+ fr_strerror_const("Invalid FLAGS syntax");
return -1;
}
char *name = argv[0];
if (argc != 3) {
- fr_strerror_printf("Invalid STRUCT syntax");
+ fr_strerror_const("Invalid STRUCT syntax");
return -1;
}
if ((*pvalue != VENDORPEC_WIMAX) ||
(type != 1) || (length != 1)) {
- fr_strerror_printf("Only WiMAX VSAs can have continuations");
+ fr_strerror_const("Only WiMAX VSAs can have continuations");
return -1;
}
}
bool require_dl = false;
if ((argc < 2) || (argc > 3)) {
- fr_strerror_printf("Missing arguments after PROTOCOL. Expected PROTOCOL <num> <name>");
+ fr_strerror_const("Missing arguments after PROTOCOL. Expected PROTOCOL <num> <name>");
return -1;
}
fr_dict_vendor_t *mutable;
if ((argc < 2) || (argc > 3)) {
- fr_strerror_printf("Invalid VENDOR syntax");
+ fr_strerror_const("Invalid VENDOR syntax");
return -1;
}
* Validate all entries
*/
if (!dict_read_sscanf_i(&value, argv[1])) {
- fr_strerror_printf("Invalid number in VENDOR");
+ fr_strerror_const("Invalid number in VENDOR");
return -1;
}
dv = fr_dict_vendor_by_num(dict, value);
if (!dv) {
- fr_strerror_printf("Failed adding format for VENDOR");
+ fr_strerror_const("Failed adding format for VENDOR");
return -1;
}
if (argc == 0) continue;
if (argc == 1) {
- fr_strerror_printf("Invalid entry");
+ fr_strerror_const("Invalid entry");
error:
fr_strerror_printf_push("Failed parsing dictionary at %s[%d]", fr_cwd_strip(fn), line);
*/
if (strcasecmp(argv[0], "PROTOCOL") == 0) {
if (argc < 2) {
- fr_strerror_printf_push("Invalid PROTOCOL entry");
+ fr_strerror_const_push("Invalid PROTOCOL entry");
goto error;
}
if (dict_read_process_protocol(argv + 1, argc - 1) == -1) goto error;
fr_dict_t *found;
if (argc != 2) {
- fr_strerror_printf_push("Invalid BEGIN-PROTOCOL entry");
+ fr_strerror_const_push("Invalid BEGIN-PROTOCOL entry");
goto error;
}
* statements.
*/
if (ctx->dict != dict_gctx->internal) {
- fr_strerror_printf_push("Nested BEGIN-PROTOCOL statements are not allowed");
+ fr_strerror_const_push("Nested BEGIN-PROTOCOL statements are not allowed");
goto error;
}
fr_dict_t const *found;
if (argc != 2) {
- fr_strerror_printf("Invalid END-PROTOCOL entry");
+ fr_strerror_const("Invalid END-PROTOCOL entry");
goto error;
}
fr_dict_attr_t const *common;
if (argc != 2) {
- fr_strerror_printf_push("Invalid BEGIN-TLV entry");
+ fr_strerror_const_push("Invalid BEGIN-TLV entry");
goto error;
}
da = fr_dict_attr_by_oid(NULL, ctx->stack[ctx->stack_depth].da, argv[1]);
if (!da) {
- fr_strerror_printf_push("Failed resolving attribute in BEGIN-TLV entry");
+ fr_strerror_const_push("Failed resolving attribute in BEGIN-TLV entry");
goto error;
}
*/
if (strcasecmp(argv[0], "END-TLV") == 0) {
if (argc != 2) {
- fr_strerror_printf_push("Invalid END-TLV entry");
+ fr_strerror_const_push("Invalid END-TLV entry");
goto error;
}
da = fr_dict_attr_by_oid(NULL, ctx->stack[ctx->stack_depth - 1].da, argv[1]);
if (!da) {
- fr_strerror_printf_push("Failed resolving attribute in END-TLV entry");
+ fr_strerror_const_push("Failed resolving attribute in END-TLV entry");
goto error;
}
fr_dict_attr_t *mutable;
if (argc < 2) {
- fr_strerror_printf_push("Invalid BEGIN-VENDOR entry");
+ fr_strerror_const_push("Invalid BEGIN-VENDOR entry");
goto error;
}
fr_dict_vendor_t const *vendor;
if (argc != 2) {
- fr_strerror_printf_push("Invalid END-VENDOR entry");
+ fr_strerror_const_push("Invalid END-VENDOR entry");
goto error;
}
char *type_name;
if (unlikely(!dict_gctx)) {
- fr_strerror_printf("fr_dict_global_ctx_init() must be called before loading dictionary files");
+ fr_strerror_const("fr_dict_global_ctx_init() must be called before loading dictionary files");
return -1;
}
*out = NULL;
if (unlikely(!dict_gctx)) {
- fr_strerror_printf("fr_dict_global_ctx_init() must be called before loading dictionary files");
+ fr_strerror_const("fr_dict_global_ctx_init() must be called before loading dictionary files");
return -1;
}
if (unlikely(!dict_gctx->internal)) {
- fr_strerror_printf("Internal dictionary must be initialised before loading protocol dictionaries");
+ fr_strerror_const("Internal dictionary must be initialised before loading protocol dictionaries");
return -1;
}
case FR_TYPE_VENDOR:
if (!fr_cond_assert(!parent->flags.is_unknown)) return NULL;
- fr_strerror_printf("Unknown vendor cannot be parented by another vendor");
+ fr_strerror_const("Unknown vendor cannot be parented by another vendor");
return NULL;
default:
vendor = talloc_zero(dict, fr_dict_vendor_t);
if (!vendor) {
oom:
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
if (!children) {
children = talloc_zero_array(parent, fr_dict_attr_t const *, UINT8_MAX + 1);
if (!children) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
if (dict_attr_children_set(parent, children) < 0) return -1;
* updated to point to the new definition.
*/
if (!fr_hash_table_replace(namespace, da)) {
- fr_strerror_printf("Internal error storing attribute");
+ fr_strerror_const("Internal error storing attribute");
goto error;
}
}
v6->type = FR_TYPE_IPV6_ADDR;
if (!fr_hash_table_replace(dict->attributes_combo, v4)) {
- fr_strerror_printf("Failed inserting IPv4 version of combo attribute");
+ fr_strerror_const("Failed inserting IPv4 version of combo attribute");
goto error;
}
if (!fr_hash_table_replace(dict->attributes_combo, v6)) {
- fr_strerror_printf("Failed inserting IPv6 version of combo attribute");
+ fr_strerror_const("Failed inserting IPv6 version of combo attribute");
goto error;
}
break;
v6->type = FR_TYPE_IPV6_PREFIX;
if (!fr_hash_table_replace(dict->attributes_combo, v4)) {
- fr_strerror_printf("Failed inserting IPv4 version of combo attribute");
+ fr_strerror_const("Failed inserting IPv4 version of combo attribute");
goto error;
}
if (!fr_hash_table_replace(dict->attributes_combo, v6)) {
- fr_strerror_printf("Failed inserting IPv6 version of combo attribute");
+ fr_strerror_const("Failed inserting IPv6 version of combo attribute");
goto error;
}
break;
* If the parent isn't a key field, then we CANNOT add a child struct.
*/
if (!fr_dict_attr_is_key_field(da) && child_struct) {
- fr_strerror_printf("Child structures cannot be defined for VALUEs which are not for 'key' attributes");
+ fr_strerror_const("Child structures cannot be defined for VALUEs which are not for 'key' attributes");
return -1;
}
fr_value_box_increment(&v);
if (fr_value_box_cmp_op(T_OP_CMP_EQ, &v, &s) == 0) {
- fr_strerror_printf("No free integer values for enumeration");
+ fr_strerror_const("No free integer values for enumeration");
return -1;
}
return 0;
default:
- fr_strerror_printf("Unexpected text after OID component");
+ fr_strerror_const("Unexpected text after OID component");
*out = 0;
return -1;
}
*/
if (((*parent)->type != FR_TYPE_VENDOR) && ((*parent)->type != FR_TYPE_VSA) && !(*parent)->flags.is_root &&
(num > UINT8_MAX)) {
- fr_strerror_printf("TLV attributes must be between 0..255 inclusive");
+ fr_strerror_const("TLV attributes must be between 0..255 inclusive");
return 0;
}
&our_name, SIZE_MAX,
fr_dict_attr_allowed_chars);
if (len == 0) {
- fr_strerror_printf("Zero length attribute name");
+ fr_strerror_const("Zero length attribute name");
if (err) *err = FR_DICT_ATTR_PARSE_ERROR;
return 0;
}
if (len > FR_DICT_ATTR_MAX_NAME_LEN) {
- fr_strerror_printf("Attribute name too long");
+ fr_strerror_const("Attribute name too long");
if (err) *err = FR_DICT_ATTR_PARSE_ERROR;
return -(FR_DICT_ATTR_MAX_NAME_LEN);
}
&our_name, SIZE_MAX,
fr_dict_attr_allowed_chars);
if (len == 0) {
- fr_strerror_printf("Zero length attribute name");
+ fr_strerror_const("Zero length attribute name");
if (err) *err = FR_DICT_ATTR_PARSE_ERROR;
return 0;
}
if (len > FR_DICT_ATTR_MAX_NAME_LEN) {
- fr_strerror_printf("Attribute name too long");
+ fr_strerror_const("Attribute name too long");
if (err) *err = FR_DICT_ATTR_PARSE_ERROR;
return -(FR_DICT_ATTR_MAX_NAME_LEN);
}
fr_dict_t *dict;
if (!dict_gctx) {
- fr_strerror_printf("Initialise global dictionary ctx with fr_dict_global_ctx_init()");
+ fr_strerror_const("Initialise global dictionary ctx with fr_dict_global_ctx_init()");
return NULL;
}
dict = talloc_zero(ctx, fr_dict_t);
if (!dict) {
- fr_strerror_printf("Failed allocating memory for dictionary");
+ fr_strerror_const("Failed allocating memory for dictionary");
error:
talloc_free(dict);
return NULL;
*/
dict->pool = talloc_pool(dict, DICT_POOL_SIZE);
if (!dict->pool) {
- fr_strerror_printf("Failed allocating talloc pool for dictionary");
+ fr_strerror_const("Failed allocating talloc pool for dictionary");
goto error;
}
for (p = to_load; p->out; p++) {
if (unlikely(!p->attr)) {
- fr_strerror_printf("Invalid autoload entry, missing attribute pointer");
+ fr_strerror_const("Invalid autoload entry, missing attribute pointer");
return -1;
}
for (p = to_load; p->out; p++) {
if (!p->dict) {
- fr_strerror_printf("Invalid autoload entry, missing dictionary pointer");
+ fr_strerror_const("Invalid autoload entry, missing dictionary pointer");
return -1;
}
fr_dict_t *dict = NULL;
if (unlikely(!p->proto)) {
- fr_strerror_printf("autoload missing parameter proto");
+ fr_strerror_const("autoload missing parameter proto");
return -1;
}
bool still_loaded = false;
if (gctx->internal) {
- fr_strerror_printf("Refusing to free dict gctx. Internal dictionary is still loaded");
+ fr_strerror_const("Refusing to free dict gctx. Internal dictionary is still loaded");
still_loaded = true;
}
fr_dict_gctx_t *new_ctx;
if (!dict_dir) {
- fr_strerror_printf("No dictionary location provided");
+ fr_strerror_const("No dictionary location provided");
return NULL;
}
new_ctx = talloc_zero(ctx, fr_dict_gctx_t);
if (!new_ctx) {
- fr_strerror_printf("Out of Memory");
+ fr_strerror_const("Out of Memory");
return NULL;
}
new_ctx->protocol_by_name = fr_hash_table_create(new_ctx, dict_protocol_name_hash, dict_protocol_name_cmp, NULL);
if (!new_ctx->protocol_by_name) {
- fr_strerror_printf("Failed initializing protocol_by_name hash");
+ fr_strerror_const("Failed initializing protocol_by_name hash");
error:
talloc_free(new_ctx);
return NULL;
new_ctx->protocol_by_num = fr_hash_table_create(new_ctx, dict_protocol_num_hash, dict_protocol_num_cmp, NULL);
if (!new_ctx->protocol_by_num) {
- fr_strerror_printf("Failed initializing protocol_by_num hash");
+ fr_strerror_const("Failed initializing protocol_by_num hash");
goto error;
}
if (len < 0) len = strlen(name);
if (len > FR_DICT_ATTR_MAX_NAME_LEN) {
- fr_strerror_printf("Attribute name is too long");
+ fr_strerror_const("Attribute name is too long");
return -1;
}
}
if (flags->is_unknown) {
- fr_strerror_printf("The 'unknown' flag cannot be set for attributes in the dictionary.");
+ fr_strerror_const("The 'unknown' flag cannot be set for attributes in the dictionary.");
return false;
}
if (flags->is_raw) {
- fr_strerror_printf("The 'raw' flag cannot be set for attributes in the dictionary.");
+ fr_strerror_const("The 'raw' flag cannot be set for attributes in the dictionary.");
return false;
}
*/
if (flags->virtual) {
if (!parent->flags.is_root) {
- fr_strerror_printf("The 'virtual' flag can only be used for normal attributes");
+ fr_strerror_const("The 'virtual' flag can only be used for normal attributes");
return false;
}
if (attr && !flags->internal && (*attr <= (1 << (8 * parent->flags.type_size)))) {
- fr_strerror_printf("The 'virtual' flag can only be used for non-protocol attributes");
+ fr_strerror_const("The 'virtual' flag can only be used for non-protocol attributes");
return false;
}
if (flags->extra) {
if ((flags->subtype != FLAG_KEY_FIELD) && (flags->subtype != FLAG_LENGTH_UINT16) &&
(flags->subtype != FLAG_BIT_FIELD) && (flags->subtype != FLAG_HAS_REF)) {
- fr_strerror_printf("The 'key' and 'length' flags cannot be used with any other flags.");
+ fr_strerror_const("The 'key' and 'length' flags cannot be used with any other flags.");
return false;
}
case FR_TYPE_UINT32:
case FR_TYPE_UINT64:
if ((flags->subtype != FLAG_KEY_FIELD) && (flags->subtype != FLAG_BIT_FIELD)) {
- fr_strerror_printf("Invalid type for extra flag.");
+ fr_strerror_const("Invalid type for extra flag.");
return false;
}
if (parent->type != FR_TYPE_STRUCT) {
- fr_strerror_printf("The 'key' flag can only be used inside of a 'struct'.");
+ fr_strerror_const("The 'key' flag can only be used inside of a 'struct'.");
return false;
}
case FR_TYPE_OCTETS:
if (flags->length != 0) {
- fr_strerror_printf("Cannot use [..] and length=uint16");
+ fr_strerror_const("Cannot use [..] and length=uint16");
return false;
}
FALL_THROUGH;
case FR_TYPE_STRING:
if (flags->subtype != FLAG_LENGTH_UINT16) {
- fr_strerror_printf("Invalid type for extra flag.");
+ fr_strerror_const("Invalid type for extra flag.");
return false;
}
case FR_TYPE_STRUCT:
if (flags->subtype != FLAG_LENGTH_UINT16) {
- fr_strerror_printf("Invalid type for extra flag.");
+ fr_strerror_const("Invalid type for extra flag.");
return false;
}
case FR_TYPE_TLV:
if (flags->subtype != FLAG_HAS_REF) {
- fr_strerror_printf("Invalid type for extra flag.");
+ fr_strerror_const("Invalid type for extra flag.");
return false;
}
case FR_TYPE_STRUCT:
ALLOW_FLAG(internal);
if (all_flags) {
- fr_strerror_printf("Invalid flag for attribute of type 'struct'");
+ fr_strerror_const("Invalid flag for attribute of type 'struct'");
return false;
}
break;
if ((flags->length != 1) &&
(flags->length != 2) &&
(flags->length != 4)) {
- fr_strerror_printf("The 'length' flag can only be used for attributes of type 'vendor' with lengths of 1,2 or 4");
+ fr_strerror_const("The 'length' flag can only be used for attributes of type 'vendor' with lengths of 1,2 or 4");
return false;
}
if ((flags->length != 1) &&
(flags->length != 2) &&
(flags->length != 4)) {
- fr_strerror_printf("The 'length' flag can only be used for attributes of type 'tlv' with lengths of 1,2 or 4");
+ fr_strerror_const("The 'length' flag can only be used for attributes of type 'tlv' with lengths of 1,2 or 4");
return false;
}
ALLOW_FLAG(array);
if (all_flags) {
- fr_strerror_printf("The 'octets[...]' syntax cannot be used any other flag");
+ fr_strerror_const("The 'octets[...]' syntax cannot be used any other flag");
return false;
}
case FR_TYPE_COMBO_IP_ADDR:
if (strcasecmp(dict->root->name, "RADIUS") != 0) {
- fr_strerror_printf("The 'combo-ip' type can only be used in the RADIUS dictionary.");
+ fr_strerror_const("The 'combo-ip' type can only be used in the RADIUS dictionary.");
return false;
}
}
if (!v) {
- fr_strerror_printf("Attributes of type 'combo-ip' can only be used in VSA dictionaries");
+ fr_strerror_const("Attributes of type 'combo-ip' can only be used in VSA dictionaries");
return false;
}
break;
}
} else if (!flags->extra) {
if ((type != FR_TYPE_TLV) && (type != FR_TYPE_VENDOR)) {
- fr_strerror_printf("The 'format=' flag can only be used with attributes of type 'tlv'");
+ fr_strerror_const("The 'format=' flag can only be used with attributes of type 'tlv'");
return false;
}
if ((flags->type_size != 1) &&
(flags->type_size != 2) &&
(flags->type_size != 4)) {
- fr_strerror_printf("The 'format=' flag can only be used with attributes of type size 1,2 or 4");
+ fr_strerror_const("The 'format=' flag can only be used with attributes of type size 1,2 or 4");
return false;
}
}
ALLOW_FLAG(extra);
ALLOW_FLAG(subtype);
if (all_flags) {
- fr_strerror_printf("Invalid flag for attribute inside of a 'struct'");
+ fr_strerror_const("Invalid flag for attribute inside of a 'struct'");
return false;
}
*/
if ((dict_attr_sizes[sibling->type][1] == ~(size_t) 0) &&
(sibling->flags.length == 0)) {
- fr_strerror_printf("Only the last child of a 'struct' attribute can have variable length");
+ fr_strerror_const("Only the last child of a 'struct' attribute can have variable length");
return false;
}
case FR_TYPE_STRING:
case FR_TYPE_OCTETS:
if (flags->length != 0) {
- fr_strerror_printf("The 'octets' type MUST be fixed-width when used inside of a 'struct'");
+ fr_strerror_const("The 'octets' type MUST be fixed-width when used inside of a 'struct'");
return false;
}
break;
dl_loader->lib_dir = talloc_strdup(dl_loader, lib_dir);
if (!dl_loader->lib_dir) {
- fr_strerror_printf("Failed allocating memory for dl search path");
+ fr_strerror_const("Failed allocating memory for dl search path");
return -1;
}
dl_loader->lib_dir = talloc_strdup(dl_loader->lib_dir, lib_dir);
if (!dl_loader->lib_dir) {
oom:
- fr_strerror_printf("Failed allocating memory for dl search path");
+ fr_strerror_const("Failed allocating memory for dl search path");
return -1;
}
return 0;
dl_loader->lib_dir = talloc_strdup(dl_loader->lib_dir, lib_dir);
if (!dl_loader->lib_dir) {
oom:
- fr_strerror_printf("Failed allocating memory for dl search path");
+ fr_strerror_const("Failed allocating memory for dl search path");
return -1;
}
return 0;
dl_loader = talloc_zero(NULL, dl_loader_t);
if (!dl_loader) {
- fr_strerror_printf("Failed allocating dl_loader");
+ fr_strerror_const("Failed allocating dl_loader");
return NULL;
}
dl_loader->tree = rbtree_talloc_alloc(dl_loader, dl_handle_cmp, dl_t, NULL, 0);
if (!dl_loader->tree) {
- fr_strerror_printf("Failed initialising dl->tree");
+ fr_strerror_const("Failed initialising dl->tree");
error:
TALLOC_FREE(dl_loader);
return NULL;
dl_loader->lib_dir = talloc_strdup(dl_loader, fr_path_default_lib_dir());
if (!dl_loader->lib_dir) {
- fr_strerror_printf("Failed allocating memory for dl search path");
+ fr_strerror_const("Failed allocating memory for dl search path");
goto error;
}
uint8_t *data;
if (!buf || !buf_len || !where || !value) {
- fr_strerror_printf("Invalid input");
+ fr_strerror_const("Invalid input");
return -1;
}
* Don't allow stupidities
*/
if (!((where >= buf) && (where < (buf + buf_len)))) {
- fr_strerror_printf("Label to write is outside of buffer");
+ fr_strerror_const("Label to write is outside of buffer");
return -1;
}
* We can only encode strings.
*/
if (value->type != FR_TYPE_STRING) {
- fr_strerror_printf("Asked to encode non-string type");
+ fr_strerror_const("Asked to encode non-string type");
return -1;
}
last = q;
if (*q == '.') {
- fr_strerror_printf("Empty labels are invalid");
+ fr_strerror_const("Empty labels are invalid");
return -1;
}
}
if (q[1] == '.') {
- fr_strerror_printf("Double dots '..' are forbidden");
+ fr_strerror_const("Double dots '..' are forbidden");
return -1;
}
last = q;
q++;
if ((q - last) > 63) {
- fr_strerror_printf("Label is larger than 63 characters");
+ fr_strerror_const("Label is larger than 63 characters");
return -1;
}
}
* 0b10 and 0b10 are forbidden
*/
if ((*p > 63) && (*p < 0xc0)) {
- fr_strerror_printf("Data with invalid high bits");
+ fr_strerror_const("Data with invalid high bits");
return -(p - buf);
}
if ((p + 2) > end) {
overflow:
- fr_strerror_printf("Label overflows buffer");
+ fr_strerror_const("Label overflows buffer");
return -(p - buf);
}
* DNS names can be no more than 255 octets.
*/
if (length > 255) {
- fr_strerror_printf("Total length of labels is > 255");
+ fr_strerror_const("Total length of labels is > 255");
return -(p - buf);
}
} while (1);
if (out > end) {
- fr_strerror_printf("Out of memory to store kevent filters");
+ fr_strerror_const("Out of memory to store kevent filters");
return -1;
}
if (has_current_func &&
(!has_prev_func || (current_fflags != prev_fflags))) {
if ((size_t)(add_p - add) >= (NUM_ELEMENTS(add))) {
- fr_strerror_printf("Out of memory to store kevent EV_ADD filters");
+ fr_strerror_const("Out of memory to store kevent EV_ADD filters");
return -1;
}
EVENT_DEBUG("\tEV_SET EV_ADD filter %s (%i), flags %i, fflags %i",
int ret;
if (fr_event_loop_exiting(dst)) {
- fr_strerror_printf("Destination event loop exiting");
+ fr_strerror_const("Destination event loop exiting");
return -1;
}
struct kevent evset[10];
if (unlikely(!el)) {
- fr_strerror_printf("Invalid argument: NULL event list");
+ fr_strerror_const("Invalid argument: NULL event list");
return -1;
}
}
if (unlikely(el->exit)) {
- fr_strerror_printf("Event loop exiting");
+ fr_strerror_const("Event loop exiting");
return -1;
}
if (!ef) {
ef = talloc_zero(el, fr_event_fd_t);
if (unlikely(!ef)) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
talloc_set_destructor(ef, _event_fd_delete);
fr_event_io_func_t funcs = { .read = read_fn, .write = write_fn };
if (unlikely(!read_fn && !write_fn)) {
- fr_strerror_printf("Invalid arguments: All callbacks are NULL");
+ fr_strerror_const("Invalid arguments: All callbacks are NULL");
return -1;
}
fr_event_timer_t *ev;
if (unlikely(!el)) {
- fr_strerror_printf("Invalid arguments: NULL event list");
+ fr_strerror_const("Invalid arguments: NULL event list");
return -1;
}
if (unlikely(!callback)) {
- fr_strerror_printf("Invalid arguments: NULL callback");
+ fr_strerror_const("Invalid arguments: NULL callback");
return -1;
}
if (unlikely(!ev_p)) {
- fr_strerror_printf("Invalid arguments: NULL ev_p");
+ fr_strerror_const("Invalid arguments: NULL ev_p");
return -1;
}
if (unlikely(el->exit)) {
- fr_strerror_printf("Event loop exiting");
+ fr_strerror_const("Event loop exiting");
return -1;
}
*/
if (!fr_dlist_entry_in_list(&ev->entry)) fr_dlist_insert_head(&el->ev_to_add, ev);
} else if (unlikely(fr_heap_insert(el->times, ev) < 0)) {
- fr_strerror_printf_push("Failed inserting event");
+ fr_strerror_const_push("Failed inserting event");
talloc_set_destructor(ev, NULL);
*ev_p = NULL;
talloc_free(ev);
if (el->will_exit || el->exit) {
el->exit = el->will_exit;
- fr_strerror_printf("Event loop exiting");
+ fr_strerror_const("Event loop exiting");
return -1;
}
el = talloc_zero(ctx, fr_event_list_t);
if (!fr_cond_assert(el)) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return NULL;
}
el->time = fr_time;
el->times = fr_heap_talloc_alloc(el, fr_event_timer_cmp, fr_event_timer_t, heap_id);
if (!el->times) {
- fr_strerror_printf("Failed allocating event heap");
+ fr_strerror_const("Failed allocating event heap");
error:
talloc_free(el);
return NULL;
el->fds = rbtree_talloc_alloc(el, fr_event_fd_cmp, fr_event_fd_t, NULL, 0);
if (!el->fds) {
- fr_strerror_printf("Failed allocating FD tree");
+ fr_strerror_const("Failed allocating FD tree");
goto error;
}
#ifdef LOCAL_PID
el->pids = fr_heap_talloc_alloc(el, fr_event_pid_cmp, fr_event_pid_t, heap_id);
if (!el->pids) {
- fr_strerror_printf("Failed allocating PID heap");
+ fr_strerror_const("Failed allocating PID heap");
goto error;
}
#endif
chunk_len = talloc_get_size(chunk);
offset = ROUND_UP_DIV(chunk_len, FR_EXT_ALIGNMENT);
if (unlikely(offset > UINT8_MAX)) {
- fr_strerror_printf("Insufficient space remaining for extensions");
+ fr_strerror_const("Insufficient space remaining for extensions");
return NULL;
}
fr_ext_info_t const *info = &def->info[ext];
if (!info->can_copy) {
- fr_strerror_printf("Extension cannot be copied");
+ fr_strerror_const("Extension cannot be copied");
return NULL;
}
*/
our_path = talloc_bstrndup(NULL, path, (size_t)len);
if (!our_path) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
talloc_abs_path = talloc_strdup(ctx, abs_path);
free(abs_path);
if (!talloc_abs_path) {
- fr_strerror_printf("Out of Memory");
+ fr_strerror_const("Out of Memory");
return NULL;
}
*/
child = index_get(hp, data);
if ((child > 0) || ((child == 0) && (hp->num_elements > 0) && (data == hp->p[0]))) {
- fr_strerror_printf("Node is already in the heap");
+ fr_strerror_const("Node is already in the heap");
return -1;
}
*/
if (n_size > INT32_MAX) {
if (hp->size == INT32_MAX) {
- fr_strerror_printf("Heap is full");
+ fr_strerror_const("Heap is full");
return -1;
} else {
n_size = INT32_MAX;
*/
if (!data) {
if (unlikely((hp->num_elements == 0) || !hp->p[0])) {
- fr_strerror_printf("Tried to extract element from empty heap");
+ fr_strerror_const("Tried to extract element from empty heap");
return -1;
}
parent = 0;
#endif
} else {
- fr_strerror_printf("Unknown address family");
+ fr_strerror_const("Unknown address family");
return -1;
}
#endif
} else {
- fr_strerror_printf("Unknown address family");
+ fr_strerror_const("Unknown address family");
return -1;
}
return (ipaddr->prefix < 128);
default:
- fr_strerror_printf("Unknown address family");
+ fr_strerror_const("Unknown address family");
return -1;
}
}
ret = fr_ipaddr_from_sockaddr(out, NULL, (struct sockaddr_storage *)ai->ai_addr, ai->ai_addrlen);
freeaddrinfo(res);
if (ret < 0) {
- fr_strerror_printf("Failed converting sockaddr to ipaddr");
+ fr_strerror_const("Failed converting sockaddr to ipaddr");
return -1;
}
end = value + inlen;
while (isspace((int) *value) && (value < end)) value++;
if (value == end) {
- fr_strerror_printf("Empty IPv4 address string is invalid");
+ fr_strerror_const("Empty IPv4 address string is invalid");
return -1;
}
inlen = end - value;
end = value + inlen;
while (isspace((int) *value) && (value < end)) value++;
if (value == end) {
- fr_strerror_printf("Empty IPv4 address string is invalid");
+ fr_strerror_const("Empty IPv4 address string is invalid");
return -1;
}
inlen = end - value;
end = value + inlen;
while (isspace((int) *value) && (value < end)) value++;
if (value == end) {
- fr_strerror_printf("Empty IPv4 address string is invalid");
+ fr_strerror_const("Empty IPv4 address string is invalid");
return -1;
}
inlen = end - value;
* asked to do DNS resolution, we can't do it.
*/
if (!resolve) {
- fr_strerror_printf("Not IPv4/6 address, and asked not to resolve");
+ fr_strerror_const("Not IPv4/6 address, and asked not to resolve");
return -1;
}
* early.
*/
if (!hostname) {
- fr_strerror_printf("Invalid address");
+ fr_strerror_const("Invalid address");
return -1;
}
}
*/
if (ipv6 && !hostname) {
if (af == AF_INET) {
- fr_strerror_printf("Invalid address");
+ fr_strerror_const("Invalid address");
return -1;
}
if (*p == '[') {
if (!(q = memchr(p + 1, ']', len - 1))) {
- fr_strerror_printf("Missing closing ']' for IPv6 address");
+ fr_strerror_const("Missing closing ']' for IPv6 address");
return -1;
}
*/
if (len > (size_t) ((q + sizeof(buffer)) - value)) {
error:
- fr_strerror_printf("IP string contains trailing garbage after port delimiter");
+ fr_strerror_const("IP string contains trailing garbage after port delimiter");
return -1;
}
struct sockaddr_in s4;
if (salen < sizeof(s4)) {
- fr_strerror_printf("IPv4 address is too small");
+ fr_strerror_const("IPv4 address is too small");
return 0;
}
struct sockaddr_in6 s6;
if (salen < sizeof(s6)) {
- fr_strerror_printf("IPv6 address is too small");
+ fr_strerror_const("IPv6 address is too small");
return 0;
}
md_ctx = EVP_MD_CTX_new();
if (unlikely(!md_ctx)) {
oom:
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return NULL;
}
fr_thread_local_set_destructor(md4_ctx, _md4_ctx_openssl_free_on_exit, md_ctx);
md_ctx = EVP_MD_CTX_new();
if (unlikely(!md_ctx)) {
oom:
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return NULL;
}
EVP_DigestInit_ex(md_ctx, EVP_md5(), NULL);
#else
int fr_nonblock(UNUSED int fd)
{
- fr_strerror_printf("Non blocking sockets are not supported");
+ fr_strerror_const("Non blocking sockets are not supported");
return -1;
}
int fr_blocking(UNUSED int fd)
{
- fr_strerror_printf("Non blocking sockets are not supported");
+ fr_strerror_const("Non blocking sockets are not supported");
return -1;
}
#endif
/* Select returned 0 which means it reached the timeout */
if (ret == 0) {
- fr_strerror_printf("Write timed out");
+ fr_strerror_const("Write timed out");
return -1;
}
p++;
subseconds = strtoul(p, &tail, 10);
if (subseconds > NSEC) {
- fr_strerror_printf("Invalid nanosecond specifier");
+ fr_strerror_const("Invalid nanosecond specifier");
return -1;
}
f[2] = mystrtok(&p, " \t");
f[3] = mystrtok(&p, " \t"); /* may, or may not, be present */
if (!f[0] || !f[1] || !f[2]) {
- fr_strerror_printf("Too few fields");
+ fr_strerror_const("Too few fields");
return -1;
}
/* month not found? */
if (tm->tm_mon == 12) {
- fr_strerror_printf("No month found");
+ fr_strerror_const("No month found");
return -1;
}
* impossible to tell what's the day, and what's the year.
*/
if (tm->tm_mday < 1900) {
- fr_strerror_printf("Invalid year < 1900");
+ fr_strerror_const("Invalid year < 1900");
return -1;
}
* If the day is out of range, die.
*/
if ((tm->tm_mday < 1) || (tm->tm_mday > 31)) {
- fr_strerror_printf("Invalid day of month");
+ fr_strerror_const("Invalid day of month");
return -1;
}
f[0] = f[3]; /* HH */
f[1] = strchr(f[0], ':'); /* find : separator */
if (!f[1]) {
- fr_strerror_printf("No ':' after hour");
+ fr_strerror_const("No ':' after hour");
return -1;
}
switch (tolower(q[0])) {
case 'n': /* nibble */
if (size & 0x01) {
- fr_strerror_printf("Sizes specified in nibbles must be an even number");
+ fr_strerror_const("Sizes specified in nibbles must be an even number");
return -1;
}
size /= 2;
rp = talloc_zero(ctx, fr_radius_packet_t);
if (!rp) {
- fr_strerror_printf("out of memory");
+ fr_strerror_const("out of memory");
return NULL;
}
rp->id = -1;
vp = talloc_zero(ctx, fr_pair_t);
if (!vp) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return NULL;
}
vp = fr_pair_alloc_null(ctx);
if (!vp) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return NULL;
}
if (count == 0) count = UINT_MAX;
if (unlikely(!da)) {
- fr_strerror_printf("No search attribute provided");
+ fr_strerror_const("No search attribute provided");
return -1;
}
if (count == 0) count = UINT_MAX;
if (unlikely(!parent_da)) {
- fr_strerror_printf("No search attribute provided");
+ fr_strerror_const("No search attribute provided");
return -1;
}
* valuepair should not already have a value.
*/
if (vp->type != VT_NONE) {
- fr_strerror_printf("Pair already has a value");
+ fr_strerror_const("Pair already has a value");
return -1;
}
raw = talloc_typed_strdup(vp, value);
if (!raw) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
}
if (da->type == FR_TYPE_GROUP) {
- fr_strerror_printf("Attributes of type 'group' are not supported");
+ fr_strerror_const("Attributes of type 'group' are not supported");
return NULL;
}
case T_OP_REG_NE: /* !~ */
{
#ifndef HAVE_REGEX
- fr_strerror_printf("Regular expressions are not supported");
+ fr_strerror_const("Regular expressions are not supported");
return NULL;
#else
ssize_t slen;
if ((size_t) (next - p) >= sizeof(raw.l_opand)) {
fr_dict_unknown_free(&da);
- fr_strerror_printf("Attribute name too long");
+ fr_strerror_const("Attribute name too long");
goto error;
}
raw.op = gettoken(&p, raw.r_opand, sizeof(raw.r_opand), false);
if ((raw.op < T_EQSTART) || (raw.op > T_EQEND)) {
fr_dict_unknown_free(&da);
- fr_strerror_printf("Expecting operator");
+ fr_strerror_const("Expecting operator");
goto error;
}
if (last_token != T_RCBRACE) {
failed_group:
- fr_strerror_printf("Failed to end group list with '}'");
+ fr_strerror_const("Failed to end group list with '}'");
talloc_free(vp);
goto error;
}
*/
quote = gettoken(&p, raw.r_opand, sizeof(raw.r_opand), false);
if (quote == T_EOL) {
- fr_strerror_printf("Failed to get value");
+ fr_strerror_const("Failed to get value");
goto error;
}
switch (*p) {
default:
- fr_strerror_printf("Invalid text. Expected comparison operator");
+ fr_strerror_const("Invalid text. Expected comparison operator");
return -(p - op);
case '!':
} else {
invalid_operator:
- fr_strerror_printf("Invalid operator");
+ fr_strerror_const("Invalid operator");
return -(p - op);
}
break;
p = in + slen;
if (p >= end) {
- fr_strerror_printf("Attribute name overflows the input buffer");
+ fr_strerror_const("Attribute name overflows the input buffer");
return -(in - start);
}
while ((isspace((int) *p)) && (p < end)) p++;
if (p >= end) {
- fr_strerror_printf("No operator found in the input buffer");
+ fr_strerror_const("No operator found in the input buffer");
return -(p - start);
}
*/
slen = op_to_token(&op, p, (end - p));
if (slen <= 0) {
- fr_strerror_printf("Syntax error: expected '='");
+ fr_strerror_const("Syntax error: expected '='");
return slen - -(p - start);
}
p += slen;
while ((isspace((int) *p)) && (p < end)) p++;
if (p >= end) {
- fr_strerror_printf("No value found in the input buffer");
+ fr_strerror_const("No value found in the input buffer");
return -(p - start);
}
if (*p == '`') {
- fr_strerror_printf("Invalid string quotation");
+ fr_strerror_const("Invalid string quotation");
return -(p - start);
}
}
if (p > end) {
- fr_strerror_printf("Value overflows the input buffer");
+ fr_strerror_const("Value overflows the input buffer");
return -(p - start);
}
}
if ((p + slen) > end) {
- fr_strerror_printf("Attribute name overflows the input buffer");
+ fr_strerror_const("Attribute name overflows the input buffer");
return -(p - in);
}
* We now MUST have FOO.BAR
*/
if (*p != '.') {
- fr_strerror_printf("Unexpected text after attribute");
+ fr_strerror_const("Unexpected text after attribute");
return -(p - in);
}
p++;
if ((p >= end) || (*p == ',')) return p - in;
if (*p != '.') {
- fr_strerror_printf("Unexpected text");
+ fr_strerror_const("Unexpected text");
return - (p - in);
}
}
pcap->handle = pcap_open_dead(pcap->link_layer, SNAPLEN);
if (!pcap->handle) {
- fr_strerror_printf("Unknown error occurred opening dead PCAP handle");
+ fr_strerror_const("Unknown error occurred opening dead PCAP handle");
return -1;
}
break;
#else
case PCAP_STDIO_IN:
- fr_strerror_printf("This version of libpcap does not support reading pcap data from streams");
+ fr_strerror_const("This version of libpcap does not support reading pcap data from streams");
return -1;
#endif
break;
#else
case PCAP_STDIO_OUT:
- fr_strerror_printf("This version of libpcap does not support writing pcap data to streams");
+ fr_strerror_const("This version of libpcap does not support writing pcap data to streams");
return -1;
#endif
*/
#ifdef DLT_NFLOG
if (pcap->link_layer == DLT_NFLOG) {
- fr_strerror_printf("NFLOG link-layer type filtering not implemented");
+ fr_strerror_const("NFLOG link-layer type filtering not implemented");
return 1;
}
goto done;
}
}
- fr_strerror_printf("Exceeded maximum level of VLAN tag nesting (2)");
+ fr_strerror_const("Exceeded maximum level of VLAN tag nesting (2)");
return -1;
}
talloc_free(sub_fmt);
if (!out_tmp) {
oom:
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
talloc_free(out);
talloc_free(subst);
va_end(ap_p);
int ret;
if (!fp) {
- fr_strerror_printf("Invalid 'fp'");
+ fr_strerror_const("Invalid 'fp'");
return -1;
}
/* setup new node */
x = talloc_zero(tree->node_ctx, rbnode_t);
if (!x) {
- fr_strerror_printf("No memory for new rbtree node");
+ fr_strerror_const("No memory for new rbtree node");
if (tree->lock) pthread_mutex_unlock(&tree->mutex);
return NULL;
}
tls->gcontext = pcre2_general_context_create(_pcre2_talloc, _pcre2_talloc_free, NULL);
if (!tls->gcontext) {
- fr_strerror_printf("Failed allocating general context");
+ fr_strerror_const("Failed allocating general context");
return -1;
}
tls->ccontext = pcre2_compile_context_create(tls->gcontext);
if (!tls->ccontext) {
- fr_strerror_printf("Failed allocating compile context");
+ fr_strerror_const("Failed allocating compile context");
error:
fr_pcre2_tls = NULL;
_pcre2_tls_free(tls);
tls->mcontext = pcre2_match_context_create(tls->gcontext);
if (!tls->mcontext) {
- fr_strerror_printf("Failed allocating match context");
+ fr_strerror_const("Failed allocating match context");
goto error;
}
if (tls->do_jit) {
tls->jit_stack = pcre2_jit_stack_create(FR_PCRE_JIT_STACK_MIN, FR_PCRE_JIT_STACK_MAX, tls->gcontext);
if (!tls->jit_stack) {
- fr_strerror_printf("Failed allocating JIT stack");
+ fr_strerror_const("Failed allocating JIT stack");
goto error;
}
pcre2_jit_stack_assign(tls->mcontext, NULL, tls->jit_stack);
if (unlikely(!fr_pcre2_tls) && (fr_pcre2_tls_init() < 0)) return -1;
if (len == 0) {
- fr_strerror_printf("Empty expression");
+ fr_strerror_const("Empty expression");
return 0;
}
*/
subject = our_subject = talloc_bstrndup(regmatch, subject, len);
if (!subject) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
#ifndef NDEBUG
if (!regmatch) {
match_data = pcre2_match_data_create_from_pattern(preg->compiled, fr_pcre2_tls->gcontext);
if (!match_data) {
- fr_strerror_printf("Failed allocating temporary match data");
+ fr_strerror_const("Failed allocating temporary match data");
return -1;
}
} else {
*/
subject = our_subject = talloc_bstrndup(regmatch, subject, subject_len);
if (!subject) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
#else
#ifndef PCRE2_COPY_MATCHED_SUBJECT
talloc_free(our_subject);
#endif
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
* an actual error.
*/
if (actual_len == buff_len) {
- fr_strerror_printf("libpcre2 out of memory");
+ fr_strerror_const("libpcre2 out of memory");
return -1;
}
if (actual_len < (buff_len - 1)) {
buff = talloc_bstr_realloc(ctx, buff, actual_len);
if (!buff) {
- fr_strerror_printf("reallocing pcre2_substitute result buffer failed");
+ fr_strerror_const("reallocing pcre2_substitute result buffer failed");
return -1;
}
}
uint32_t count;
if (pcre2_pattern_info(preg->compiled, PCRE2_INFO_CAPTURECOUNT, &count) != 0) {
- fr_strerror_printf("Error determining subcapture group count");
+ fr_strerror_const("Error determining subcapture group count");
return 0;
}
regmatch = talloc(ctx, fr_regmatch_t);
if (!regmatch) {
oom:
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return NULL;
}
*out = NULL;
if (len == 0) {
- fr_strerror_printf("Empty expression");
+ fr_strerror_const("Empty expression");
return 0;
}
*/
if (flags) {
if (flags->global) {
- fr_strerror_printf("g - Global matching/substitution not supported with libpcre");
+ fr_strerror_const("g - Global matching/substitution not supported with libpcre");
return 0;
}
if (flags->ignore_case) cflags |= PCRE_CASELESS;
fr_thread_local_set_destructor(fr_pcre_jit_stack, _pcre_jit_stack_free,
pcre_jit_stack_alloc(FR_PCRE_JIT_STACK_MIN, FR_PCRE_JIT_STACK_MAX));
if (!fr_pcre_jit_stack) {
- fr_strerror_printf("Allocating JIT stack failed");
+ fr_strerror_const("Allocating JIT stack failed");
return -1;
}
}
if (regmatch->subject) talloc_const_free(regmatch->subject);
regmatch->subject = talloc_bstrndup(regmatch, subject, len);
if (!regmatch->subject) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
}
int count;
if (pcre_fullinfo(preg->compiled, preg->extra, PCRE_INFO_CAPTURECOUNT, &count) != 0) {
- fr_strerror_printf("Error determining subcapture group count");
+ fr_strerror_const("Error determining subcapture group count");
return 0;
}
regex_t *preg;
if (len == 0) {
- fr_strerror_printf("Empty expression");
+ fr_strerror_const("Empty expression");
return 0;
}
*/
if (flags) {
if (flags->global) {
- fr_strerror_printf("g - Global matching/substitution not supported with posix-regex");
+ fr_strerror_const("g - Global matching/substitution not supported with posix-regex");
return 0;
}
if (flags->dot_all) {
- fr_strerror_printf("s - Single line matching is not supported with posix-regex");
+ fr_strerror_const("s - Single line matching is not supported with posix-regex");
return 0;
}
if (flags->unicode) {
- fr_strerror_printf("u - Unicode matching not supported with posix-regex");
+ fr_strerror_const("u - Unicode matching not supported with posix-regex");
return 0;
}
if (flags->extended) {
- fr_strerror_printf("x - Whitespace and comments not supported with posix-regex");
+ fr_strerror_const("x - Whitespace and comments not supported with posix-regex");
return 0;
}
if (regmatch->subject) talloc_const_free(regmatch->subject);
regmatch->subject = talloc_bstrndup(regmatch, subject, len);
if (!regmatch->subject) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
}
regmatch = talloc_zero_pooled_object(ctx, fr_regmatch_t, 2, (sizeof(regmatch_t) * count) + 128);
if (unlikely(!regmatch)) {
error:
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
talloc_free(regmatch);
return NULL;
}
if (!scratch) {
scratch = talloc_pool(NULL, 4096);
if (unlikely(!scratch)) {
- fr_strerror_printf("Out of Memory");
+ fr_strerror_const("Out of Memory");
return -1;
}
fr_thread_local_set_destructor(sbuff_scratch, _sbuff_scratch_free, scratch);
char const *proto_name;
if (!port_name) {
- fr_strerror_printf("No port specified");
+ fr_strerror_const("No port specified");
return -1;
}
}
if (FD_ISSET(sockfd, &error_set)) {
- fr_strerror_printf("Failed connecting socket: Unknown error");
+ fr_strerror_const("Failed connecting socket: Unknown error");
return -1;
}
}
* Check IP looks OK
*/
if (!src_ipaddr || ((src_ipaddr->af != AF_INET) && (src_ipaddr->af != AF_INET6))) {
- fr_strerror_printf("No address specified");
+ fr_strerror_const("No address specified");
return -1;
}
* Check IP looks OK
*/
if (!src_ipaddr || ((src_ipaddr->af != AF_INET) && (src_ipaddr->af != AF_INET6))) {
- fr_strerror_printf("No address specified");
+ fr_strerror_const("No address specified");
return -1;
}
typedef struct fr_log_entry_s fr_log_entry_t;
struct fr_log_entry_s {
fr_dlist_t list;
- char *msg; //!< Log message.
+ char const *msg; //!< Log message.
- char *subject; //!< Subject for error markers.
+ char const *subject; //!< Subject for error markers.
size_t offset; //!< Where to place the msg marker relative to the subject.
};
*
* @hidecallergraph
*/
-static fr_log_entry_t *strerror_const(char const *msg)
+static inline CC_HINT(always_inline) fr_log_entry_t *strerror_const(char const *msg)
{
fr_log_entry_t *entry;
fr_log_buffer_t *buffer;
return NULL;
}
- entry = talloc_zero(pool_alternate(buffer), fr_log_entry_t);
+ entry = talloc(pool_alternate(buffer), fr_log_entry_t);
if (!entry) {
fr_perror("Failed allocating memory for libradius error buffer");
return NULL;
}
- memcpy(&entry->msg, &msg, sizeof(entry->msg));
+ *entry = (fr_log_entry_t) {
+ .msg = msg
+ };
pool_free_alt(buffer);
fr_strerror_clear(buffer, false);
fr_perror("Failed allocating memory for libradius error buffer");
return NULL;
}
- memcpy(&entry->msg, &msg, sizeof(entry->msg));
+ entry->msg = msg;
return entry;
}
fr_assert(!key_vp);
if (!decode_tlv) {
- fr_strerror_printf("Decoding TLVs requires a decode_tlv() function to be passed");
+ fr_strerror_const("Decoding TLVs requires a decode_tlv() function to be passed");
return -(p - data);
}
break;
default:
- fr_strerror_printf("Invalid bit field");
+ fr_strerror_const("Invalid bit field");
return -1;
}
/* Not a bit field; insist that no buffered bits remain. */
if (offset != 0) {
leftover_bits:
- fr_strerror_printf("leftover bits");
+ fr_strerror_const("leftover bits");
return -1;
}
if (do_length) {
uint32_t len = fr_dbuff_used(&work_dbuff) - 2;
if (len > 65535) {
- fr_strerror_printf("Structure size is too large for 16-bit length field.");
+ fr_strerror_const("Structure size is too large for 16-bit length field.");
return -1;
}
fr_dbuff_in(&hdr_dbuff, (uint16_t)len);
fr_talloc_destructor_t *d;
if (!fire_ctx) {
- fr_strerror_printf("No firing ctx provided when setting destructor");
+ fr_strerror_const("No firing ctx provided when setting destructor");
return NULL;
}
d = talloc(fire_ctx, fr_talloc_destructor_t);
if (!d) {
oom:
- fr_strerror_printf("Out of Memory");
+ fr_strerror_const("Out of Memory");
return NULL;
}
array_size = rounded + alignment;
array = talloc_array(ctx, uint8_t, array_size); /* Over allocate */
if (!array) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return NULL;
}
pool_size = rounded + page_size;
pool = talloc_pool(ctx, pool_size); /* Over allocate */
if (!pool) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return NULL;
}
chunk = talloc_size(pool, 1); /* Get the starting address */
if (!fr_cond_assert((chunk > pool) && ((uintptr_t)chunk < ((uintptr_t)pool + rounded)))) {
- fr_strerror_printf("Initial allocation outside of pool memory");
+ fr_strerror_const("Initial allocation outside of pool memory");
error:
talloc_free(pool);
return NULL;
padding = talloc_size(pool, pad_size);
if (!fr_cond_assert(((uintptr_t)padding + (uintptr_t)pad_size) >= (uintptr_t)next)) {
- fr_strerror_printf("Failed padding pool memory");
+ fr_strerror_const("Failed padding pool memory");
goto error;
}
}
*/
while ((*p >= '0') && (*p <= '9')) {
if (len > 9) {
- fr_strerror_printf("Too much precision for time_delta");
+ fr_strerror_const("Too much precision for time_delta");
}
sec *= 10;
len = strlen(end + 1);
if (len > 6) {
- fr_strerror_printf("Too much precision for timeval");
+ fr_strerror_const("Too much precision for timeval");
return -1;
}
* There's nothing after the backslash, it's an error.
*/
if (!p[1]) {
- fr_strerror_printf("Unterminated string");
+ fr_strerror_const("Unterminated string");
return T_INVALID;
}
p++;
} else {
if (buflen < 2) {
- fr_strerror_printf("Truncated input");
+ fr_strerror_const("Truncated input");
return T_INVALID;
}
*s++ = 0;
if (quote) {
- fr_strerror_printf("Unterminated string");
+ fr_strerror_const("Unterminated string");
return T_INVALID;
}
token = getthing(ptr, op, sizeof(op), true, fr_tokens_table, fr_tokens_table_len, false);
if (!fr_assignment_op[token] && !fr_equality_op[token]) {
- fr_strerror_printf("Expected operator");
+ fr_strerror_const("Expected operator");
return T_INVALID;
}
return token;
/*
* Unexpected end of string.
*/
- fr_strerror_printf("Unexpected end of string");
+ fr_strerror_const("Unexpected end of string");
return -(p - start);
}
node = (fr_trie_node_t *) talloc_zero_array(ctx, uint8_t, sizeof(fr_trie_node_t) + sizeof(node->trie[0]) * size);
if (!node) {
- fr_strerror_printf("failed allocating node trie");
+ fr_strerror_const("failed allocating node trie");
return NULL;
}
user = talloc_zero(ctx, fr_trie_user_t);
if (!user) {
- fr_strerror_printf("failed allocating user trie");
+ fr_strerror_const("failed allocating user trie");
return NULL;
}
path = talloc_zero(ctx, fr_trie_path_t);
if (!path) {
- fr_strerror_printf("failed allocating path trie");
+ fr_strerror_const("failed allocating path trie");
return NULL;
}
comp = talloc_zero(ctx, fr_trie_comp_t);
if (!comp) {
- fr_strerror_printf("failed allocating comp trie");
+ fr_strerror_const("failed allocating comp trie");
return NULL;
}
* This should have been caught above.
*/
if (lcp == path->bits) {
- fr_strerror_printf("found lcp which should have been previously found");
+ fr_strerror_const("found lcp which should have been previously found");
return -1;
}
* place without worry.
*/
if (fr_trie_key_match(user->trie, key, 0, keylen, true) != NULL) {
- fr_strerror_printf("Cannot insert due to pre-existing key");
+ fr_strerror_const("Cannot insert due to pre-existing key");
return -1;
}
fr_trie_user_t *user = (fr_trie_user_t *) trie;
if (!user->data) {
- fr_strerror_printf("user node has no user data");
+ fr_strerror_const("user node has no user data");
return -1;
}
}
if (!path->trie) {
- fr_strerror_printf("path node has no child trie");
+ fr_strerror_const("path node has no child trie");
return -1;
}
if (slen <= 0) goto done;
if (fr_ipaddr_from_sockaddr(&socket_out->inet.src_ipaddr, &socket_out->inet.src_port, &src, sizeof_src) < 0) {
- fr_strerror_printf_push("Failed converting src sockaddr to ipaddr");
+ fr_strerror_const_push("Failed converting src sockaddr to ipaddr");
return -1;
}
if (fr_ipaddr_from_sockaddr(&socket_out->inet.dst_ipaddr, &socket_out->inet.dst_port, &dst, sizeof_dst) < 0) {
- fr_strerror_printf_push("Failed converting dst sockaddr to ipaddr");
+ fr_strerror_const_push("Failed converting dst sockaddr to ipaddr");
return -1;
}
b->vb_ip.prefix, (uint8_t const *) &b->vb_ip.addr.v4.s_addr);
default:
- fr_strerror_printf("Cannot compare IPv4 with IPv6 address");
+ fr_strerror_const("Cannot compare IPv4 with IPv6 address");
return -1;
}
b->vb_ip.prefix, (uint8_t const *) &b->vb_ip.addr.v4.s_addr);
default:
- fr_strerror_printf("Cannot compare IPv4 with IPv6 address");
+ fr_strerror_const("Cannot compare IPv4 with IPv6 address");
return -1;
}
b->vb_ip.prefix, (uint8_t const *) &b->vb_ip.addr.v6);
default:
- fr_strerror_printf("Cannot compare IPv6 with IPv4 address");
+ fr_strerror_const("Cannot compare IPv6 with IPv4 address");
return -1;
}
b->vb_ip.prefix, (uint8_t const *) &b->vb_ip.addr.v6);
default:
- fr_strerror_printf("Cannot compare IPv6 with IPv4 address");
+ fr_strerror_const("Cannot compare IPv6 with IPv4 address");
return -1;
}
*/
str = talloc_bstrndup(ctx, src->vb_strvalue, src->vb_length);
if (!str) {
- fr_strerror_printf("Failed allocating string buffer");
+ fr_strerror_const("Failed allocating string buffer");
return -1;
}
dst->vb_strvalue = str;
if (src->vb_length) {
bin = talloc_memdup(ctx, src->vb_octets, src->vb_length);
if (!bin) {
- fr_strerror_printf("Failed allocating octets buffer");
+ fr_strerror_const("Failed allocating octets buffer");
return -1;
}
talloc_set_type(bin, uint8_t);
str = talloc_steal(ctx, src->vb_strvalue);
if (!str) {
- fr_strerror_printf("Failed stealing string buffer");
+ fr_strerror_const("Failed stealing string buffer");
return -1;
}
talloc_set_type(str, char);
bin = talloc_steal(ctx, src->vb_octets);
if (!bin) {
- fr_strerror_printf("Failed stealing octets buffer");
+ fr_strerror_const("Failed stealing octets buffer");
return -1;
}
talloc_set_type(bin, uint8_t);
str = talloc_typed_strdup(ctx, src);
if (!str) {
- fr_strerror_printf("Failed allocating string buffer");
+ fr_strerror_const("Failed allocating string buffer");
return -1;
}
memcpy(&mutable, &vb->vb_strvalue, sizeof(mutable));
str = talloc_realloc(ctx, mutable, char, len + 1);
if (!str) {
- fr_strerror_printf("Failed re-allocing string buffer");
+ fr_strerror_const("Failed re-allocing string buffer");
return -1;
}
vb->vb_length = len;
str = talloc_zero_array(ctx, char, len + 1);
if (!str) {
- fr_strerror_printf("Failed allocating string buffer");
+ fr_strerror_const("Failed allocating string buffer");
return -1;
}
str[len] = '\0';
str = talloc_bstrndup(ctx, src, len);
if (!str) {
- fr_strerror_printf("Failed allocating string buffer");
+ fr_strerror_const("Failed allocating string buffer");
return -1;
}
len = talloc_array_length(src);
if ((len == 0) || (src[len - 1] != '\0')) {
- fr_strerror_printf("Input buffer not \\0 terminated");
+ fr_strerror_const("Input buffer not \\0 terminated");
return -1;
}
len = talloc_array_length(src);
if ((len == 0) || (src[len - 1] != '\0')) {
- fr_strerror_printf("Input buffer not \\0 terminated");
+ fr_strerror_const("Input buffer not \\0 terminated");
return -1;
}
len = talloc_array_length(src);
if ((len == 0) || (src[len - 1] != '\0')) {
- fr_strerror_printf("Input buffer not \\0 terminated");
+ fr_strerror_const("Input buffer not \\0 terminated");
return -1;
}
bin = talloc_array(ctx, uint8_t, len);
if (!bin) {
- fr_strerror_printf("Failed allocating octets buffer");
+ fr_strerror_const("Failed allocating octets buffer");
return -1;
}
talloc_set_type(bin, uint8_t);
bin = talloc_memdup(ctx, src, len);
if (!bin) {
- fr_strerror_printf("Failed allocating octets buffer");
+ fr_strerror_const("Failed allocating octets buffer");
return -1;
}
talloc_set_type(bin, uint8_t);
p = talloc_array(ctx, uint8_t, ret);
if (fr_hex2bin(NULL, &FR_DBUFF_TMP(p, ret), &FR_SBUFF_IN(in + 2, len), false) != (ssize_t)ret) {
talloc_free(p);
- fr_strerror_printf("Invalid hex data");
+ fr_strerror_const("Invalid hex data");
return -1;
}
*/
if (inlen > 0) {
if (len >= sizeof(buffer)) {
- fr_strerror_printf("Temporary buffer too small");
+ fr_strerror_const("Temporary buffer too small");
return -1;
}
fr_value_box_t const *vb;
if (!list || !*list) {
- fr_strerror_printf("Invalid arguments. List was NULL");
+ fr_strerror_const("Invalid arguments. List was NULL");
return -1;
}
struct stat buf;
if (!path) {
- fr_strerror_printf("No path provided, was NULL");
+ fr_strerror_const("No path provided, was NULL");
return -1;
}
len = strlen(path);
if (len >= sizeof(salocal.sun_path)) {
- fr_strerror_printf("Path too long in socket filename");
+ fr_strerror_const("Path too long in socket filename");
return -1;
}
p = strrchr(dir, FR_DIR_SEP);
if (!p) {
- fr_strerror_printf("Failed determining parent directory");
+ fr_strerror_const("Failed determining parent directory");
error:
talloc_free(dir);
if (sock_fd >= 0) close(sock_fd);
name = strrchr(path, FR_DIR_SEP);
if (!name) {
- fr_strerror_printf("Can't determine socket name");
+ fr_strerror_const("Can't determine socket name");
goto error;
}
name++;
len = strlen(path);
#endif
if (len >= sizeof(salocal.sun_path)) {
- fr_strerror_printf("Path too long in socket filename");
+ fr_strerror_const("Path too long in socket filename");
goto error;
}
* is malformed. Fail.
*/
if (flags & FR_DIAMETER_AVP_FLAG_MANDATORY) {
- fr_strerror_printf("Mandatory bit is set and attribute is malformed");
+ fr_strerror_const("Mandatory bit is set and attribute is malformed");
talloc_free(vp);
goto error;
}
char label[] = "ttls challenge";
if ((vp->vp_length < 8) || (vp->vp_length > 16)) {
- fr_strerror_printf("Tunneled challenge has invalid length");
+ fr_strerror_const("Tunneled challenge has invalid length");
goto error;
}
}
if (memcmp(challenge, vp->vp_octets, vp->vp_length) != 0) {
- fr_strerror_printf("Tunneled challenge is incorrect");
+ fr_strerror_const("Tunneled challenge is incorrect");
goto error;
}
}
switch (af) {
default:
- fr_strerror_printf("Unsupported address family");
+ fr_strerror_const("Unsupported address family");
return -1;
case AF_UNSPEC:
NULL,
mod_icmp_error,
t) < 0) {
- fr_strerror_printf_push("Failed adding socket to event loop");
+ fr_strerror_const_push("Failed adding socket to event loop");
close(fd);
return -1;
}
while (true) {
if (!*p) {
- fr_strerror_printf("unterminated string");
+ fr_strerror_const("unterminated string");
return -1;
}
}
if ((size_t) (q - state->string) >= sizeof(state->string)) {
- fr_strerror_printf("string is too long");
+ fr_strerror_const("string is too long");
return -1;
}
if (ret == 0) {
if (!state->allow_eof) {
- fr_strerror_printf("Unexpected EOF");
+ fr_strerror_const("Unexpected EOF");
return -1;
}
*/
if (*p == ';') {
if (semicolon == NO_SEMICOLON) {
- fr_strerror_printf("unexpected ';'");
+ fr_strerror_const("unexpected ';'");
return -1;
}
state->token_len = p - state->token;
if (state->token_len == 0) {
- fr_strerror_printf("FUCK");
+ fr_strerror_const("FUCK");
return -1;
}
if (state->token_len >= 256) {
- fr_strerror_printf("token too large");
+ fr_strerror_const("token too large");
return -1;
}
*/
if (hint == T_LCBRACE) {
if (*state->token != '{') {
- fr_strerror_printf("missing '{'");
+ fr_strerror_const("missing '{'");
return -1;
}
if ((size_t) state->braces >= (sizeof(spaces) - 1)) {
- fr_strerror_printf("sections are nested too deep");
+ fr_strerror_const("sections are nested too deep");
return -1;
}
if (hint == T_RCBRACE) {
if (*state->token != '}') {
- fr_strerror_printf("missing '}'");
+ fr_strerror_const("missing '}'");
return -1;
}
*/
if (*state->token == '}') {
if (!allow_rcbrace) {
- fr_strerror_printf("unexpected '}'");
+ fr_strerror_const("unexpected '}'");
return -1;
}
*/
if ((hint == T_BARE_WORD) || (hint == T_DOUBLE_QUOTED_STRING)) {
if (*state->token == '{') {
- fr_strerror_printf("unexpected '{'");
+ fr_strerror_const("unexpected '{'");
return -1;
}
}
{
// @todo - register the named option space with inst->option_space
// and create inst->option_space
- fr_strerror_printf("please implement 'option space name [ [ code width number ] [ length width number ] [ hash size number ] ]'");
+ fr_strerror_const("please implement 'option space name [ [ code width number ] [ length width number ] [ hash size number ] ]'");
return -1;
}
p = strchr(name, '.');
if (p) {
- fr_strerror_printf("cannot (yet) define options in spaces");
+ fr_strerror_const("cannot (yet) define options in spaces");
error:
talloc_free(name);
return -1;
}
if (parent != state->inst->head) {
- fr_strerror_printf("option definitions cannot be scoped");
+ fr_strerror_const("option definitions cannot be scoped");
goto error;
}
}
if ((state->token_len == 1) && (state->token[0] == '{')) {
- fr_strerror_printf("records are not supported in option definition");
+ fr_strerror_const("records are not supported in option definition");
goto error;
}
* not a *semicolon* error.
*/
if (!state->saw_semicolon) {
- fr_strerror_printf("expected ';'");
+ fr_strerror_const("expected ';'");
goto error;
}
* Must have at least two arguments.
*/
if (argc < 2) {
- fr_strerror_printf("unexpected ';'");
+ fr_strerror_const("unexpected ';'");
return -1;
}
*/
if ((semicolon == NO_SEMICOLON) && state->saw_semicolon) {
unexpected:
- fr_strerror_printf("unexpected ';'");
+ fr_strerror_const("unexpected ';'");
talloc_free(info);
return -1;
}
if ((semicolon == YES_SEMICOLON) && !state->saw_semicolon) {
- fr_strerror_printf("missing ';'");
+ fr_strerror_const("missing ';'");
talloc_free(info);
return -1;
}
for (child = info->child; child != NULL; child = child->next) {
if (child->cmd->type == ISC_HARDWARE_ETHERNET) {
if (ether) {
- fr_strerror_printf("cannot have two 'hardware ethernet' entries in a 'host'");
+ fr_strerror_const("cannot have two 'hardware ethernet' entries in a 'host'");
return -1;
}
static int parse_filename(UNUSED rlm_isc_dhcp_tokenizer_t *state, rlm_isc_dhcp_info_t *info)
{
if (info->argv[0]->vb_length > member_size(dhcp_packet_t, file)) {
- fr_strerror_printf("filename is too long");
+ fr_strerror_const("filename is too long");
return -1;
}
static int parse_server_name(UNUSED rlm_isc_dhcp_tokenizer_t *state, rlm_isc_dhcp_info_t *info)
{
if (info->argv[0]->vb_length > member_size(dhcp_packet_t, sname)) {
- fr_strerror_printf("filename is too long");
+ fr_strerror_const("filename is too long");
return -1;
}
* Request Authenticator. Oh well...
*/
if (!tt->use_authenticator) {
- fr_strerror_printf("No free entries");
+ fr_strerror_const("No free entries");
return -1;
}
struct arpreq req;
if (!interface) {
- fr_strerror_printf("No interface specified. Cannot update ARP table");
+ fr_strerror_const("No interface specified. Cannot update ARP table");
return -1;
}
int fr_arp_entry_add(UNUSED int fd, UNUSED char const *interface,
UNUSED uint8_t ipaddr[static 4], UNUSED uint8_t macaddr[static 6])
{
- fr_strerror_printf("Adding ARP entry is unsupported on this system");
+ fr_strerror_const("Adding ARP entry is unsupported on this system");
return -1;
}
#endif
fr_dbuff_t work_dbuff = FR_DBUFF_NO_ADVANCE(dbuff);
if (!*vps) {
- fr_strerror_printf("Cannot encode empty packet");
+ fr_strerror_const("Cannot encode empty packet");
return -1;
}
* that they don't care about.
*/
if (!vp) {
- fr_strerror_printf("No ARP attributes in the attribute list");
+ fr_strerror_const("No ARP attributes in the attribute list");
return -1;
}
*/
arp = (fr_arp_packet_t const *) packet;
if ((arp->htype[0] != 0) || (arp->htype[1] != 1)) {
- fr_strerror_printf("Hardware-Format != Ethernet");
+ fr_strerror_const("Hardware-Format != Ethernet");
return -1;
}
if ((arp->ptype[0] != 8) || (arp->ptype[1] != 0)) {
- fr_strerror_printf("Protocol-Format != IPv4");
+ fr_strerror_const("Protocol-Format != IPv4");
return -1;
}
if (arp->hlen != 6) {
- fr_strerror_printf("Hardware-Length != 6");
+ fr_strerror_const("Hardware-Length != 6");
return -1;
}
if (arp->plen != 4) {
- fr_strerror_printf("Protocol-Length != 4");
+ fr_strerror_const("Protocol-Length != 4");
return -1;
}
memcpy(&magic, data + 236, 4);
magic = ntohl(magic);
if (magic != DHCP_OPTION_MAGIC_NUMBER) {
- fr_strerror_printf("BOOTP not supported");
+ fr_strerror_const("BOOTP not supported");
return false;
}
code = fr_dhcpv4_packet_get_option((dhcp_packet_t const *) data, data_len, attr_dhcp_message_type);
if (!code || (code[1] == 0)) {
- fr_strerror_printf("No message-type option was found in the packet");
+ fr_strerror_const("No message-type option was found in the packet");
return false;
}
if (flags->extra || !flags->subtype) return true;
if (type != FR_TYPE_STRING) {
- fr_strerror_printf("The 'dns_label' flag can only be used with attributes of type 'string'");
+ fr_strerror_const("The 'dns_label' flag can only be used with attributes of type 'string'");
return false;
}
len = decode_value_internal(ctx, cursor, parent, p, value_len);
if (len <= 0) return len;
if (len != (ssize_t)value_len) {
- fr_strerror_printf("Failed decoding complete option value");
+ fr_strerror_const("Failed decoding complete option value");
return -1;
}
p += len;
for (i = 0; i < 14; i++) {
vp = fr_pair_afrom_da(ctx, *dhcp_header_attrs[i]);
if (!vp) {
- fr_strerror_printf_push("Cannot decode packet due to internal error");
+ fr_strerror_const_push("Cannot decode packet due to internal error");
error:
talloc_free(vp);
fr_cursor_head(cursor);
mtu = fr_pair_find_by_da(&head, attr_dhcp_interface_mtu_size);
if (mtu && (mtu->vp_uint16 < DEFAULT_PACKET_SIZE)) {
- fr_strerror_printf("Client says MTU is smaller than minimum permitted by the specification");
+ fr_strerror_const("Client says MTU is smaller than minimum permitted by the specification");
return -1;
}
/* Now that checks are done, allocate packet */
packet = fr_radius_alloc(NULL, false);
if (!packet) {
- fr_strerror_printf("Failed allocating packet");
+ fr_strerror_const("Failed allocating packet");
return NULL;
}
ret = pcap_next_ex(pcap->handle, &header, &data);
if (ret == 0) {
- fr_strerror_printf("No packet received from libpcap");
+ fr_strerror_const("No packet received from libpcap");
return NULL; /* no packet */
}
if (ret < 0) {
link_len = fr_pcap_link_layer_offset(data, header->caplen, pcap->link_layer);
if (link_len < 0) {
- fr_strerror_printf_push("Failed determining link layer header offset");
+ fr_strerror_const_push("Failed determining link layer header offset");
return NULL;
}
break;
case 6:
- fr_strerror_printf("IPv6 packets not supported by DHCPv4");
+ fr_strerror_const("IPv6 packets not supported by DHCPv4");
return NULL;
default:
packet = fr_radius_alloc(NULL, false);
if (!packet) {
- fr_strerror_printf("Failed allocating packet");
+ fr_strerror_const("Failed allocating packet");
return NULL;
}
raw_packet = talloc_zero_array(packet, uint8_t, MAX_PACKET_SIZE);
if (!raw_packet) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
fr_radius_packet_free(&packet);
return NULL;
}
code = fr_dhcpv4_packet_get_option((dhcp_packet_t const *) packet->data,
packet->data_len, attr_dhcp_message_type);
if (!code) {
- fr_strerror_printf("No message-type option was found in the packet");
+ fr_strerror_const("No message-type option was found in the packet");
fr_radius_packet_free(&packet);
return NULL;
}
if ((code[1] < 1) || (code[2] == 0) || (code[2] > 8)) {
- fr_strerror_printf("Unknown value for message-type option");
+ fr_strerror_const("Unknown value for message-type option");
fr_radius_packet_free(&packet);
return NULL;
}
fr_ipaddr_to_sockaddr(&src, &sizeof_src, &packet->socket.inet.src_ipaddr, packet->socket.inet.src_port);
fr_ipaddr_to_sockaddr(&dst, &sizeof_dst, &packet->socket.inet.dst_ipaddr, packet->socket.inet.dst_port);
if (packet->data_len == 0) {
- fr_strerror_printf("No data to send");
+ fr_strerror_const("No data to send");
return -1;
}
data = talloc_zero_array(NULL, uint8_t, MAX_PACKET_SIZE);
if (!data) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return NULL;
}
transaction_id = fr_net_to_uint24(&packet[1]);
if (transaction_id != packet_ctx->transaction_id) {
fail_tid:
- fr_strerror_printf("Transaction ID does not match");
+ fr_strerror_const("Transaction ID does not match");
return false;
}
if (!fr_dhcpv6_option_find(options, end, FR_SERVER_ID)) {
fail_sid:
- fr_strerror_printf("Packet does not contain a Server-Id option");
+ fr_strerror_const("Packet does not contain a Server-Id option");
return false;
}
option = fr_dhcpv6_option_find(options, end, FR_CLIENT_ID);
if (!option) {
fail_cid:
- fr_strerror_printf("Packet does not contain a Client-Id option");
+ fr_strerror_const("Packet does not contain a Client-Id option");
return false;
}
*/
if (!packet_ctx->duid) {
fail_duid:
- fr_strerror_printf("Packet context does not contain a DUID");
+ fr_strerror_const("Packet context does not contain a DUID");
return false;
}
check_duid:
if (!duid_match(option, packet_ctx)) {
fail_match:
- fr_strerror_printf("DUID in packet does not match our DUID");
+ fr_strerror_const("DUID in packet does not match our DUID");
return false;
}
return true;
option = fr_dhcpv6_option_find(options, end, FR_RECONF_MSG);
if (!option) {
- fr_strerror_printf("Packet does not contain a Reconf-Msg option");
+ fr_strerror_const("Packet does not contain a Reconf-Msg option");
return false;
}
case FR_DHCPV6_RELAY_REPLY:
if (packet_len < DHCPV6_RELAY_HDR_LEN) {
- fr_strerror_printf("Relay-Reply message is too small");
+ fr_strerror_const("Relay-Reply message is too small");
return false;
}
options += (DHCPV6_RELAY_HDR_LEN - 4); /* we assumed it was a normal packet above */
option = fr_dhcpv6_option_find(options, end, FR_RELAY_MESSAGE);
if (!option) {
- fr_strerror_printf("Packet does not contain a Relay-Message option");
+ fr_strerror_const("Packet does not contain a Relay-Message option");
return false;
}
return verify_to_client(option + 4, DHCPV6_GET_OPTION_LEN(option), packet_ctx);
case FR_PACKET_TYPE_VALUE_DECLINE:
case FR_PACKET_TYPE_VALUE_INFORMATION_REQUEST:
default:
- fr_strerror_printf("Invalid message type sent to client");
+ fr_strerror_const("Invalid message type sent to client");
return false;
}
* Servers MUST have a DUID
*/
if (!packet_ctx->duid) {
- fr_strerror_printf("Packet context does not contain a DUID");
+ fr_strerror_const("Packet context does not contain a DUID");
return false;
}
case FR_PACKET_TYPE_VALUE_REBIND:
if (!fr_dhcpv6_option_find(options, end, FR_CLIENT_ID)) {
fail_cid:
- fr_strerror_printf("Packet does not contain a Client-Id option");
+ fr_strerror_const("Packet does not contain a Client-Id option");
return false;
}
if (!fr_dhcpv6_option_find(options, end, FR_SERVER_ID)) {
fail_sid:
- fr_strerror_printf("Packet does not contain a Server-Id option");
+ fr_strerror_const("Packet does not contain a Server-Id option");
return false;
}
break;
if (!duid_match(option, packet_ctx)) {
fail_match:
- fr_strerror_printf("DUID in packet does not match our DUID");
+ fr_strerror_const("DUID in packet does not match our DUID");
return false;
}
break;
* IA options are forbidden.
*/
if (fr_dhcpv6_option_find(options, end, FR_IA_NA)) {
- fr_strerror_printf("Packet contains an IA-NA option");
+ fr_strerror_const("Packet contains an IA-NA option");
return false;
}
if (fr_dhcpv6_option_find(options, end, FR_IA_TA)) {
- fr_strerror_printf("Packet contains an IA-TA option");
+ fr_strerror_const("Packet contains an IA-TA option");
return false;
}
if (fr_dhcpv6_option_find(options, end, FR_IA_ADDR)) {
- fr_strerror_printf("Packet contains an IA-Addr option");
+ fr_strerror_const("Packet contains an IA-Addr option");
return false;
}
break;
case FR_DHCPV6_RELAY_FORWARD:
if (packet_len < DHCPV6_RELAY_HDR_LEN) {
- fr_strerror_printf("Relay-Forward message is too small");
+ fr_strerror_const("Relay-Forward message is too small");
return false;
}
options += (DHCPV6_RELAY_HDR_LEN - 4); /* we assumed it was a normal packet above */
option = fr_dhcpv6_option_find(options, end, FR_RELAY_MESSAGE);
if (!option) {
- fr_strerror_printf("Packet does not contain a Relay-Message option");
+ fr_strerror_const("Packet does not contain a Relay-Message option");
return false;
}
option = fr_dhcpv6_option_find(options, end, FR_LEASE_QUERY);
if (!option) {
- fr_strerror_printf("Packet does not contain a Lease-Query option");
+ fr_strerror_const("Packet does not contain a Lease-Query option");
return false;
}
break;
case FR_PACKET_TYPE_VALUE_REPLY:
case FR_PACKET_TYPE_VALUE_RECONFIGURE:
default:
- fr_strerror_printf("Invalid message type sent to server");
+ fr_strerror_const("Invalid message type sent to server");
return false;
}
return true;
if (flags->extra || !flags->subtype) return true;
if (type != FR_TYPE_STRING) {
- fr_strerror_printf("The 'dns_label' flag can only be used with attributes of type 'string'");
+ fr_strerror_const("The 'dns_label' flag can only be used with attributes of type 'string'");
return false;
}
break;
default:
- fr_strerror_printf("Exceeded maximum level of VLAN tag nesting (2)");
+ fr_strerror_const("Exceeded maximum level of VLAN tag nesting (2)");
break;
}
p = ((uint8_t const *)vlan_hdr) + sizeof(ether_hdr->ether_type);
char const *p;
if (argc < 3) {
- fr_strerror_printf("Insufficient arguments to parse 'abinary' IPX network type");
+ fr_strerror_const("Insufficient arguments to parse 'abinary' IPX network type");
return -1;
}
* Can't be too little or too much.
*/
if (argc != 6) {
- fr_strerror_printf("Insufficient arguments to parse 'abinary' IPX network type");
+ fr_strerror_const("Insufficient arguments to parse 'abinary' IPX network type");
return -1;
}
* Must have "net N node M"
*/
if (argc < 4) {
- fr_strerror_printf("Insufficient arguments to parse 'abinary' IPX type");
+ fr_strerror_const("Insufficient arguments to parse 'abinary' IPX type");
return -1;
}
case FILTER_IPX_SRC_IPXNET:
if (flags & 0x01) {
duplicate:
- fr_strerror_printf("Duplicate field when parsing 'abinary' IPX type");
+ fr_strerror_const("Duplicate field when parsing 'abinary' IPX type");
return -1;
}
slen = ascend_parse_ipx_net(argc - 1, argv + 1,
* Arguments left over: die.
*/
if (argc != 0) {
- fr_strerror_printf("Too many arguments to 'abinary' IPX filter");
+ fr_strerror_const("Too many arguments to 'abinary' IPX filter");
return -1;
}
goto finalize;
default:
- fr_strerror_printf("Invalid character in IP address");
+ fr_strerror_const("Invalid character in IP address");
return -1;
}
} /* loop over one character */
* We need at least "offset mask value"
*/
if (argc < 3) {
- fr_strerror_printf("Insufficient arguments to parse 'abinary' generic type");
+ fr_strerror_const("Insufficient arguments to parse 'abinary' generic type");
return -1;
}
* No more than optional comparison and "more"
*/
if (argc > 5) {
- fr_strerror_printf("Too many arguments to parse 'abinary' generic type");
+ fr_strerror_const("Too many arguments to parse 'abinary' generic type");
return -1;
}
argc = fr_dict_str_to_argv(p, argv, 32);
if (argc < 3) {
- fr_strerror_printf("Insufficient arguments to parse 'abinary' type");
+ fr_strerror_const("Insufficient arguments to parse 'abinary' type");
fail:
talloc_free(p);
return 0;
}
if (packet_len < RADIUS_HEADER_LENGTH) {
- fr_strerror_printf("Packet must be encoded before calling fr_radius_sign()");
+ fr_strerror_const("Packet must be encoded before calling fr_radius_sign()");
return -1;
}
}
if (msg[1] < 18) {
- fr_strerror_printf("Message-Authenticator is too small");
+ fr_strerror_const("Message-Authenticator is too small");
return -1;
}
case FR_CODE_PROTOCOL_ERROR:
if (!original) {
need_original:
- fr_strerror_printf("Cannot sign response packet without a request packet");
+ fr_strerror_const("Cannot sign response packet without a request packet");
return -1;
}
memcpy(packet + 4, original + 4, RADIUS_AUTH_VECTOR_LENGTH);
}
if (msg[1] < 18) {
- fr_strerror_printf("too small Message-Authenticator");
+ fr_strerror_const("too small Message-Authenticator");
return -1;
}
*/
rcode = fr_radius_sign(packet, original, secret, secret_len);
if (rcode < 0) {
- fr_strerror_printf_push("Failed calculating correct authenticator");
+ fr_strerror_const_push("Failed calculating correct authenticator");
return -1;
}
memcpy(msg + 2, message_authenticator, sizeof(message_authenticator));
memcpy(packet + 4, request_authenticator, sizeof(request_authenticator));
- fr_strerror_printf("invalid Message-Authenticator (shared secret is incorrect)");
+ fr_strerror_const("invalid Message-Authenticator (shared secret is incorrect)");
return -1;
}
if (fr_digest_cmp(request_authenticator, packet + 4, sizeof(request_authenticator)) != 0) {
memcpy(packet + 4, request_authenticator, sizeof(request_authenticator));
if (original) {
- fr_strerror_printf("invalid Response Authenticator (shared secret is incorrect)");
+ fr_strerror_const("invalid Response Authenticator (shared secret is incorrect)");
} else {
- fr_strerror_printf("invalid Request Authenticator (shared secret is incorrect)");
+ fr_strerror_const("invalid Request Authenticator (shared secret is incorrect)");
}
return -1;
}
case FR_CODE_DISCONNECT_NAK:
case FR_CODE_PROTOCOL_ERROR:
if (!original) {
- fr_strerror_printf("Cannot encode response without request");
+ fr_strerror_const("Cannot encode response without request");
return -1;
}
memcpy(packet_ctx.vector, original + 4, sizeof(packet_ctx.vector));
UNUSED char const *name, UNUSED int attr, fr_type_t type, fr_dict_attr_flags_t *flags)
{
if (flags->array) {
- fr_strerror_printf("RADIUS does not support the 'array' flag.");
+ fr_strerror_const("RADIUS does not support the 'array' flag.");
return false;
}
if (parent->type == FR_TYPE_STRUCT) {
if (flag_extended(flags)) {
- fr_strerror_printf("Attributes of type 'extended' cannot be used inside of a 'struct'");
+ fr_strerror_const("Attributes of type 'extended' cannot be used inside of a 'struct'");
return false;
}
* All other flags are invalid inside of a struct.
*/
if (flags->subtype) {
- fr_strerror_printf("Attributes inside of a 'struct' MUST NOT have flags set");
+ fr_strerror_const("Attributes inside of a 'struct' MUST NOT have flags set");
return false;
}
*/
if (flags->extra) {
if (flags->subtype != FLAG_HAS_REF) {
- fr_strerror_printf("Unsupported extension.");
+ fr_strerror_const("Unsupported extension.");
return false;
}
if (flag_concat(flags)) {
if (!parent->flags.is_root) {
- fr_strerror_printf("Attributes with the 'concat' flag MUST be at the root of the dictionary");
+ fr_strerror_const("Attributes with the 'concat' flag MUST be at the root of the dictionary");
return false;
}
if (type != FR_TYPE_OCTETS) {
- fr_strerror_printf("Attributes with the 'concat' flag MUST be of data type 'octets'");
+ fr_strerror_const("Attributes with the 'concat' flag MUST be of data type 'octets'");
return false;
}
if (!(parent->flags.is_root ||
((parent->type == FR_TYPE_VENDOR) &&
(parent->parent && parent->parent->type == FR_TYPE_VSA)))) {
- fr_strerror_printf("The 'has_tag' flag can only be used with RFC and VSA attributes");
+ fr_strerror_const("The 'has_tag' flag can only be used with RFC and VSA attributes");
return false;
}
if (flag_extended(flags)) {
if (type != FR_TYPE_TLV) {
- fr_strerror_printf("The 'long' or 'extended' flag can only be used for attributes of type 'tlv'");
+ fr_strerror_const("The 'long' or 'extended' flag can only be used for attributes of type 'tlv'");
return false;
}
if (!parent->flags.is_root) {
- fr_strerror_printf("The 'long' flag can only be used for top-level RFC attributes");
+ fr_strerror_const("The 'long' flag can only be used for top-level RFC attributes");
return false;
}
* We need at least a salt.
*/
if (encrypted_len < 2) {
- fr_strerror_printf("Tunnel password is too short");
+ fr_strerror_const("Tunnel password is too short");
return -1;
}
size_t attrlen;
if ((data + dv_type + dv_length) > end) {
- fr_strerror_printf("Attribute header overflow");
+ fr_strerror_const("Attribute header overflow");
return -1;
}
if ((data[0] == 0) && (data[1] == 0) &&
(data[2] == 0) && (data[3] == 0)) {
zero:
- fr_strerror_printf("Invalid attribute 0");
+ fr_strerror_const("Invalid attribute 0");
return -1;
}
if (data[0] != 0) {
- fr_strerror_printf("Invalid attribute > 2^24");
+ fr_strerror_const("Invalid attribute > 2^24");
return -1;
}
break;
break;
default:
- fr_strerror_printf("Internal sanity check failed");
+ fr_strerror_const("Internal sanity check failed");
return -1;
}
case 2:
if (data[dv_type] != 0) {
- fr_strerror_printf("Attribute is longer than 256 octets");
+ fr_strerror_const("Attribute is longer than 256 octets");
return -1;
}
FALL_THROUGH;
default:
- fr_strerror_printf("Internal sanity check failed");
+ fr_strerror_const("Internal sanity check failed");
return -1;
}
if (attrlen < (dv_type + dv_length)) {
- fr_strerror_printf("Attribute header has invalid length");
+ fr_strerror_const("Attribute header has invalid length");
return -1;
}
if (attrlen > length) {
- fr_strerror_printf("Attribute overflows container");
+ fr_strerror_const("Attribute overflows container");
return -1;
}
*/
vp = fr_pair_afrom_da(ctx, attr_packet_type);
if (!vp) {
- fr_strerror_printf("Failed creating Packet-Type");
+ fr_strerror_const("Failed creating Packet-Type");
return -1;
}
vp->vp_uint32 = data[0];
vp = fr_pair_afrom_da(ctx, attr_packet_authentication_vector);
if (!vp) {
- fr_strerror_printf("Failed creating Packet-Authentication-Vector");
+ fr_strerror_const("Failed creating Packet-Authentication-Vector");
return -1;
}
(void) fr_pair_value_memdup(vp, data + 4, 16, true);
* Catch errors early on.
*/
if (flag_encrypted(&vp->da->flags) && !packet_ctx) {
- fr_strerror_printf("Asked to encrypt attribute, but no packet context provided");
+ fr_strerror_const("Asked to encrypt attribute, but no packet context provided");
return PAIR_ENCODE_FATAL_ERROR;
}
* Only 24bit integers are allowed here
*/
if (fr_dbuff_current(&value_start)[0] != 0) {
- fr_strerror_printf("Integer overflow for tagged uint32 attribute");
+ fr_strerror_const("Integer overflow for tagged uint32 attribute");
return PAIR_ENCODE_SKIPPED;
}
fr_dbuff_current(&value_start)[0] = packet_ctx->tag;
dv = da_stack->da[depth++];
if (dv->type != FR_TYPE_VENDOR) {
- fr_strerror_printf("Expected Vendor");
+ fr_strerror_const("Expected Vendor");
return PAIR_ENCODE_FATAL_ERROR;
}
((vp->da->attr != FR_CHARGEABLE_USER_IDENTITY) &&
(vp->da->attr != FR_MESSAGE_AUTHENTICATOR))) {
fr_cursor_next(cursor);
- fr_strerror_printf("Zero length string attributes not allowed");
+ fr_strerror_const("Zero length string attributes not allowed");
return PAIR_ENCODE_SKIPPED;
}
break;
fr_packet_socket_t *ps;
if (!pl) {
- fr_strerror_printf("Invalid argument");
+ fr_strerror_const("Invalid argument");
return false;
}
ps = fr_socket_find(pl, sockfd);
if (!ps) {
- fr_strerror_printf("No such socket");
+ fr_strerror_const("No such socket");
return false;
}
fr_packet_socket_t *ps;
if (!pl || !dst_ipaddr || (dst_ipaddr->af == AF_UNSPEC)) {
- fr_strerror_printf("Invalid argument");
+ fr_strerror_const("Invalid argument");
return false;
}
if (pl->num_sockets >= MAX_SOCKETS) {
- fr_strerror_printf("Too many open sockets");
+ fr_strerror_const("Too many open sockets");
return false;
}
} while (i != start);
if (!ps) {
- fr_strerror_printf("All socket entries are full");
+ fr_strerror_const("All socket entries are full");
return false;
}
}
if (fr_ipaddr_from_sockaddr(&ps->socket.inet.src_ipaddr, &ps->socket.inet.src_port, &src, sizeof_src) < 0) {
- fr_strerror_printf("Failed to get IP");
+ fr_strerror_const("Failed to get IP");
return false;
}
if ((request->socket.inet.dst_ipaddr.af == AF_UNSPEC) ||
(request->socket.inet.dst_port == 0)) {
- fr_strerror_printf("No destination address/port specified");
+ fr_strerror_const("No destination address/port specified");
return false;
}
src_any = fr_ipaddr_is_inaddr_any(&request->socket.inet.src_ipaddr);
if (src_any < 0) {
- fr_strerror_printf("Can't check src_ipaddr");
+ fr_strerror_const("Can't check src_ipaddr");
return false;
}
* MUST specify a destination address.
*/
if (fr_ipaddr_is_inaddr_any(&request->socket.inet.dst_ipaddr) != 0) {
- fr_strerror_printf("Must specify a dst_ipaddr");
+ fr_strerror_const("Must specify a dst_ipaddr");
return false;
}
* Ask the caller to allocate a new ID.
*/
if (fd < 0) {
- fr_strerror_printf("Failed finding socket, caller must allocate a new one");
+ fr_strerror_const("Failed finding socket, caller must allocate a new one");
return false;
}
packet->data_len = (size_t) slen;
packet->data = talloc_array(packet, uint8_t, packet->data_len);
if (!packet->data) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
*/
packet = fr_radius_alloc(ctx, false);
if (!packet) {
- fr_strerror_printf("out of memory");
+ fr_strerror_const("out of memory");
return NULL;
}
packet_len = (packet->vector[2] << 8) | packet->vector[3];
if (packet_len < RADIUS_HEADER_LENGTH) {
- fr_strerror_printf("Discarding packet: Smaller than RFC minimum of 20 bytes");
+ fr_strerror_const("Discarding packet: Smaller than RFC minimum of 20 bytes");
return -1;
}
* If the packet is too big, then the socket is bad.
*/
if (packet_len > MAX_PACKET_LEN) {
- fr_strerror_printf("Discarding packet: Larger than RFC limitation of 4096 bytes");
+ fr_strerror_const("Discarding packet: Larger than RFC limitation of 4096 bytes");
return -1;
}
packet->data = talloc_array(packet, uint8_t, packet_len);
if (!packet->data) {
- fr_strerror_printf("Out of memory");
+ fr_strerror_const("Out of memory");
return -1;
}
if (pkt->hdr.flags & FR_TAC_PLUS_UNENCRYPTED_FLAG)
return 0;
else {
- fr_strerror_printf("Packet is encrypted but no secret for the client is set");
+ fr_strerror_const("Packet is encrypted but no secret for the client is set");
return -1;
}
}
if (pkt->hdr.flags & FR_TAC_PLUS_UNENCRYPTED_FLAG) {
- fr_strerror_printf("Packet is unencrypted but a secret has been set for the client");
+ fr_strerror_const("Packet is unencrypted but a secret has been set for the client");
return -1;
}
* There's no reason to accept 64K TACACS+ packets.
*/
if ((buffer[8] != 0) || (buffer[9] != 0)) {
- fr_strerror_printf("Packet is too large. Our limit is 64K");
+ fr_strerror_const("Packet is too large. Our limit is 64K");
return -1;
}
vp = fr_pair_afrom_da(ctx, da);
if (!vp) {
- fr_strerror_printf("Out of Memory");
+ fr_strerror_const("Out of Memory");
return -1;
}
vp = fr_pair_afrom_da(ctx, da);
if (!vp) {
- fr_strerror_printf("Out of Memory");
+ fr_strerror_const("Out of Memory");
return -1;
}
* which is a bit under 2^18.
*/
if ((buffer[8] != 0) || (buffer[9] != 0)) {
- fr_strerror_printf("Packet is too large. Our limit is 64K");
+ fr_strerror_const("Packet is too large. Our limit is 64K");
return -1;
}
* exactly into however many bytes we read.
*/
if ((buffer + sizeof(pkt->hdr) + ntohl(pkt->hdr.length)) != end) {
- fr_strerror_printf("Packet does not exactly fill buffer");
+ fr_strerror_const("Packet does not exactly fill buffer");
return -1;
}
size_t length;
if (!secret || secret_len < 1) {
- fr_strerror_printf("Packet is encrypted, but no secret is set.");
+ fr_strerror_const("Packet is encrypted, but no secret is set.");
return -1;
}
*/
decrypted = talloc_memdup(ctx, buffer, buffer_len);
if (!decrypted) {
- fr_strerror_printf("Out of Memory");
+ fr_strerror_const("Out of Memory");
return -1;
}
if ((pkt->hdr.ver.minor == 0) &&
(pkt->authen.start.authen_type != FR_AUTHENTICATION_TYPE_VALUE_ASCII)) {
- fr_strerror_printf("TACACS+ minor version 1 MUST be used for non-ASCII authentication methods");
+ fr_strerror_const("TACACS+ minor version 1 MUST be used for non-ASCII authentication methods");
goto fail;
}
*/
if (pkt->hdr.ver.minor != 0) {
invalid_version:
- fr_strerror_printf("Invalid TACACS+ version");
+ fr_strerror_const("Invalid TACACS+ version");
goto fail;
}
PACKET_HEADER_CHECK("Authentication Continue");
if (pkt->authen.start.authen_type != FR_AUTHENTICATION_TYPE_VALUE_ASCII) {
- fr_strerror_printf("Authentication-Continue packets MUST NOT be used for PAP, CHAP, MS-CHAP");
+ fr_strerror_const("Authentication-Continue packets MUST NOT be used for PAP, CHAP, MS-CHAP");
goto fail;
}
} else {
unknown_packet:
- fr_strerror_printf("Unknown packet type");
+ fr_strerror_const("Unknown packet type");
goto fail;
}
break;
if (!vps) {
error:
- fr_strerror_printf("Cannot encode empty packet");
+ fr_strerror_const("Cannot encode empty packet");
return -1;
}
} else {
unknown_packet:
- fr_strerror_printf("decode: Unknown packet type");
+ fr_strerror_const("decode: Unknown packet type");
return -1;
}
fr_assert(secret_len > 0);
if (!secret || secret_len < 1) {
- fr_strerror_printf("decode: Packet is supposed to be encrypted, but no secret is set.");
+ fr_strerror_const("decode: Packet is supposed to be encrypted, but no secret is set.");
return -1;
}
}
if (fr_dict_autoload(libfreeradius_vmps) < 0) {
- fr_strerror_printf_push("Failed loading the 'vmps' dictionary");
+ fr_strerror_const_push("Failed loading the 'vmps' dictionary");
return -1;
}
if (fr_dict_attr_autoload(libfreeradius_vmps_dict_attr) < 0) {
- fr_strerror_printf("Failed loading the 'vmps' attributes");
+ fr_strerror_const("Failed loading the 'vmps' attributes");
fr_dict_autofree(libfreeradius_vmps);
return -1;
}
while (data_len > 0) {
if (data_len < 7) {
- fr_strerror_printf("Packet contains malformed attribute");
+ fr_strerror_const("Packet contains malformed attribute");
return false;
}
*/
if ((ptr[0] != 0) || (ptr[1] != 0) ||
(ptr[2] != 0x0c) || (ptr[3] < 1) || (ptr[3] > 8)) {
- fr_strerror_printf("Packet contains invalid attribute");
+ fr_strerror_const("Packet contains invalid attribute");
return false;
}
vp = fr_pair_afrom_da(ctx, attr_packet_type);
if (!vp) {
oom:
- fr_strerror_printf("Out of Memory");
+ fr_strerror_const("Out of Memory");
return -1;
}
vp->vp_uint32 = data[1];
* but it doesn't hurt to do it again.
*/
if (attr_len > (size_t) (end - ptr)) {
- fr_strerror_printf("Attribute length exceeds received data");
+ fr_strerror_const("Attribute length exceeds received data");
return -1;
}
*/
vp = fr_pair_afrom_child_num(ctx, fr_dict_root(dict_vmps), attr);
if (!vp) {
- fr_strerror_printf("No memory");
+ fr_strerror_const("No memory");
return -1;
}