__attribute__ ((format (printf, 1, 2)))
#endif
;
-extern char fr_strerror[];
+extern const char *fr_strerror(void);
extern int fr_dns_lookups; /* 0 = no dns lookups */
extern int fr_debug_flag; /* 0 = no debugging information */
extern int fr_max_attributes; /* per incoming packet */
for (i = 0; i < 14; i++) {
vp = pairmake(dhcp_header_names[i], NULL, T_OP_EQ);
if (!vp) {
- fprintf(stderr, "Parse error %s\n", fr_strerror);
+ fprintf(stderr, "Parse error %s\n", fr_strerror());
pairfree(&head);
return -1;
}
vp = pairmake(da->name, NULL, T_OP_EQ);
if (!vp) {
fprintf(stderr, "Cannot build attribute %s\n",
- fr_strerror);
+ fr_strerror());
pairfree(&head);
return -1;
}
raw:
vp = pairmake(da->name, NULL, T_OP_EQ);
if (!vp) {
- fprintf(stderr, "Cannot build attribute %s\n", fr_strerror);
+ fprintf(stderr, "Cannot build attribute %s\n", fr_strerror());
pairfree(&head);
return -1;
}
for (i = 0; i < 14; i++) {
vp = pairmake(dhcp_header_names[i], NULL, T_OP_EQ);
if (!vp) {
- fprintf(stderr, "Parse error %s\n", fr_strerror);
+ fprintf(stderr, "Parse error %s\n", fr_strerror());
return -1;
}
*/
if (dict_addattr(argv[0], vendor, type, value, flags) < 0) {
fr_strerror_printf("dict_init: %s[%d]: %s",
- fn, line, fr_strerror);
+ fn, line, fr_strerror());
return -1;
}
if (dict_addvalue(argv[1], argv[0], value) < 0) {
fr_strerror_printf("dict_init: %s[%d]: %s",
- fn, line, fr_strerror);
+ fn, line, fr_strerror());
return -1;
}
/* Create a new VENDOR entry for the list */
if (dict_addvendor(argv[0], value) < 0) {
fr_strerror_printf("dict_init: %s[%d]: %s",
- fn, line, fr_strerror);
+ fn, line, fr_strerror());
return -1;
}
/*
* log.c Functions in the library call radlib_log() which
- * sets a global error string "char *fr_strerror".
+ * does internal logging.
*
* Version: $Id$
*
#include <freeradius-devel/libradius.h>
-char fr_strerror[1024];
+
+#define FR_STRERROR_BUFSIZE (1024)
+
+static char fr_strerror_buffer[FR_STRERROR_BUFSIZE];
+
/*
* Do logging to a static buffer. Note that we MIGHT be asked
void fr_strerror_printf(const char *fmt, ...)
{
va_list ap;
- char my_errstr[sizeof(fr_strerror)];
-
va_start(ap, fmt);
- vsnprintf(my_errstr, sizeof(my_errstr), fmt, ap);
- strcpy(fr_strerror, my_errstr);
+ vsnprintf(fr_strerror_buffer, sizeof(fr_strerror_buffer), fmt, ap);
va_end(ap);
}
+const char *fr_strerror(void)
+{
+ return fr_strerror_buffer;
+}
+
void fr_perror(const char *fmt, ...)
{
va_list ap;
vfprintf(stderr, fmt, ap);
if (strchr(fmt, ':') == NULL)
fprintf(stderr, ": ");
- fprintf(stderr, "%s\n", fr_strerror);
+ fprintf(stderr, "%s\n", fr_strerror());
va_end(ap);
}
if (ascend_parse_filter(vp) < 0 ) {
fr_strerror_printf("failed to parse Ascend binary attribute: %s",
- fr_strerror);
+ fr_strerror());
return NULL;
}
break;
client_free(c);
cf_log_err(cf_sectiontoitem(cs),
"Failed to look up hostname %s: %s",
- name2, fr_strerror);
+ name2, fr_strerror());
return NULL;
}
packet = fr_dhcp_recv(listener->fd);
if (!packet) {
- radlog(L_ERR, "%s", fr_strerror);
+ radlog(L_ERR, "%s", fr_strerror());
return 0;
}
memcpy(&myvp, vp, sizeof(myvp));
if (!pairparsevalue(&myvp, pright)) {
RDEBUG2("Failed parsing \"%s\": %s",
- pright, fr_strerror);
+ pright, fr_strerror());
return FALSE;
}
if (!pairparsevalue(vp, value)) {
RDEBUG2("ERROR: Failed parsing value \"%s\" for attribute %s: %s",
- value, vp->name, fr_strerror);
+ value, vp->name, fr_strerror());
pairfree(&newlist);
return RLM_MODULE_FAIL;
}
}
if (rcode < 0) {
- radlog(L_ERR, "%s Dropping packet without response.", fr_strerror);
+ radlog(L_ERR, "%s Dropping packet without response.", fr_strerror());
request->child_state = REQUEST_DONE;
return 0;
}
pairlist_free(&pl);
radlog(L_ERR|L_CONS,
"%s[%d]: Parse error (check) for entry %s: %s",
- file, lineno, entry, fr_strerror);
+ file, lineno, entry, fr_strerror());
fclose(fp);
return -1;
} else if (parsecode == T_COMMA) {
pairlist_free(&pl);
radlog(L_ERR|L_CONS,
"%s[%d]: Parse error (reply) for entry %s: %s",
- file, lineno, entry, fr_strerror);
+ file, lineno, entry, fr_strerror());
fclose(fp);
return -1;
}
packet = rad_recv(listener->fd, 1); /* require message authenticator */
if (!packet) {
RAD_STATS_TYPE_INC(listener, total_malformed_requests);
- DEBUG("%s", fr_strerror);
+ DEBUG("%s", fr_strerror());
return 0;
}
packet = rad_recv(listener->fd, client->message_authenticator);
if (!packet) {
RAD_STATS_TYPE_INC(listener, total_malformed_requests);
- DEBUG("%s", fr_strerror);
+ DEBUG("%s", fr_strerror());
return 0;
}
packet = rad_recv(listener->fd, 0);
if (!packet) {
RAD_STATS_TYPE_INC(listener, total_malformed_requests);
- radlog(L_ERR, "%s", fr_strerror);
+ radlog(L_ERR, "%s", fr_strerror());
return 0;
}
packet = rad_recv(listener->fd, 0);
if (!packet) {
- radlog(L_ERR, "%s", fr_strerror);
+ radlog(L_ERR, "%s", fr_strerror());
return 0;
}
DEBUG2("including dictionary file %s/%s", p, RADIUS_DICTIONARY);
if (dict_init(p, RADIUS_DICTIONARY) != 0) {
radlog(L_ERR, "Errors reading dictionary: %s",
- fr_strerror);
+ fr_strerror());
return -1;
}
vp = cf_pairtovp(cp);
if (!vp) {
pairfree(&head);
- cf_log_err(ci, "ERROR: %s", fr_strerror);
+ cf_log_err(ci, "ERROR: %s", fr_strerror());
return NULL;
}
} while (dict_valbyattr(dattr->attr, value));
if (dict_addvalue(name, dattr->name, value) < 0) {
- radlog(L_ERR, "%s", fr_strerror);
+ radlog(L_ERR, "%s", fr_strerror());
return 0;
}
*/
if (rad_send(radclient->request, NULL, secret) < 0) {
fprintf(stderr, "radclient: Failed to send packet for ID %d: %s\n",
- radclient->request->id, fr_strerror);
+ radclient->request->id, fr_strerror());
}
if (fr_debug_flag > 2) print_hex(radclient->request);
reply = fr_packet_list_recv(pl, &set);
if (!reply) {
fprintf(stderr, "radclient: received bad packet: %s\n",
- fr_strerror);
+ fr_strerror());
return -1; /* bad packet */
}
}
sockfd = fr_socket(&client_ipaddr, client_port);
if (sockfd < 0) {
- fprintf(stderr, "radclient: socket: %s\n", fr_strerror);
+ fprintf(stderr, "radclient: socket: %s\n", fr_strerror());
exit(1);
}
if (radius_filter) {
parsecode = userparse(radius_filter, &filter_vps);
if (parsecode == T_OP_INVALID) {
- fprintf(stderr, "radsniff: Invalid RADIUS filter \"%s\": %s\n", radius_filter, fr_strerror);
+ fprintf(stderr, "radsniff: Invalid RADIUS filter \"%s\": %s\n", radius_filter, fr_strerror());
exit(1);
}
if (!filter_vps) {
packet = vqp_recv(listener->fd);
if (!packet) {
- radlog(L_ERR, "%s", fr_strerror);
+ radlog(L_ERR, "%s", fr_strerror());
return 0;
}
rad_assert(listener->send == vqp_socket_send);
if (vqp_encode(request->reply, request->packet) < 0) {
- DEBUG2("Failed encoding packet: %s\n", fr_strerror);
+ DEBUG2("Failed encoding packet: %s\n", fr_strerror());
return -1;
}
vp = pairmake("Acct-Unique-Session-Id", buffer, 0);
if (!vp) {
- radlog(L_ERR, "%s", fr_strerror);
+ radlog(L_ERR, "%s", fr_strerror());
return RLM_MODULE_FAIL;
}
DEBUG2("%s: Changed value for attribute %s from '%s' to '%s'", data->name,
data->attribute, attr_vp->vp_strvalue, new_str);
if (pairparsevalue(attr_vp, new_str) == NULL) {
- DEBUG2("%s: Could not write value '%s' into attribute %s: %s", data->name, new_str, data->attribute, fr_strerror);
+ DEBUG2("%s: Could not write value '%s' into attribute %s: %s", data->name, new_str, data->attribute, fr_strerror());
return ret;
}
if (!reply_attr) {
DEBUG("rlm_eap_tls: "
"add_reply failed to create attribute %s: %s\n",
- name, fr_strerror);
+ name, fr_strerror());
return;
}
VALUE_PAIR *reply_attr;
reply_attr = pairmake(name, "", T_OP_EQ);
if (!reply_attr) {
- radlog(L_INFO, IKEv2_LOG_PREFIX "add_reply failed to create attribute %s: %s", name, fr_strerror);
+ radlog(L_INFO, IKEv2_LOG_PREFIX "add_reply failed to create attribute %s: %s", name, fr_strerror());
return;
}
if (!reply_attr) {
DEBUG("rlm_eap_sim: "
"add_reply failed to create attribute %s: %s\n",
- name, fr_strerror);
+ name, fr_strerror());
return;
}
do_xlat ? NULL : value,
operator);
if (newpair == NULL) {
- radlog(L_ERR, "rlm_ldap: Failed to create the pair: %s", fr_strerror);
+ radlog(L_ERR, "rlm_ldap: Failed to create the pair: %s", fr_strerror());
continue;
}
VALUE_PAIR *reply_attr;
reply_attr = pairmake(name, "", T_OP_EQ);
if (!reply_attr) {
- RDEBUG("Failed to create attribute %s: %s\n", name, fr_strerror);
+ RDEBUG("Failed to create attribute %s: %s\n", name, fr_strerror());
return;
}
VALUE_PAIR *vp;
vp = radius_pairmake(request, &request->reply->vps, name, "", T_OP_EQ);
if (!vp) {
- RDEBUG("rlm_mschap: mppe_add_reply failed to create attribute %s: %s\n", name, fr_strerror);
+ RDEBUG("rlm_mschap: mppe_add_reply failed to create attribute %s: %s\n", name, fr_strerror());
return;
}
vp = pairmake(assign->lhs, value, operator);
if (!vp) {
- fprintf(stderr, "Failed creating pair: %s %s\n", value, fr_strerror);
+ fprintf(stderr, "Failed creating pair: %s %s\n", value, fr_strerror());
}
return vp;
if (ip_hton(row[1], AF_UNSPEC, &c->ipaddr) < 0) {
radlog(L_CONS|L_ERR, "rlm_sql (%s): Failed to look up hostname %s: %s",
inst->config->xlat_name,
- row[1], fr_strerror);
+ row[1], fr_strerror());
free(c);
continue;
} else {
vp = radius_pairmake(request, &request->packet->vps,
"SQL-User-Name", NULL, 0);
if (!vp) {
- radlog(L_ERR, "%s", fr_strerror);
+ radlog(L_ERR, "%s", fr_strerror());
return -1;
}
*/
pair = pairmake(row[2], value, operator);
if (pair == NULL) {
- radlog(L_ERR, "rlm_sql: Failed to create the pair: %s", fr_strerror);
+ radlog(L_ERR, "rlm_sql: Failed to create the pair: %s", fr_strerror());
return -1;
}
if (do_xlat) {
RDEBUG2("sql_set_user escaped user --> '%s'", sqlusername);
vp = pairmake("SQL-User-Name", sqlusername, 0);
if (vp == NULL) {
- radlog(L_ERR, "%s", fr_strerror);
+ radlog(L_ERR, "%s", fr_strerror());
return -1;
}