name2 = cf_section_name2(cs);
if (!name2) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Missing client name");
return NULL;
}
c->prefix = -1;
if (cf_section_parse(cs, c, client_config) < 0) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Error parsing client section.");
error:
client_free(c);
* per-server clients cannot.
*/
if (in_server && c->server) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Clients inside of an server section cannot point to a server.");
goto error;
}
if (prefix_ptr) {
c->prefix = atoi(prefix_ptr + 1);
if ((c->prefix < 0) || (c->prefix > 128)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid Prefix value '%s' for IP.",
prefix_ptr + 1);
goto error;
* Always get the numeric representation of IP
*/
if (ip_hton(name2, AF_UNSPEC, &c->ipaddr) < 0) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Failed to look up hostname %s: %s",
name2, fr_strerror());
goto error;
c->ipaddr.ipaddr.ip4addr = cl_ip4addr;
if ((c->prefix < -1) || (c->prefix > 32)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Netmask must be between 0 and 32");
goto error;
}
c->ipaddr.ipaddr.ip6addr = cl_ip6addr;
if ((c->prefix < -1) || (c->prefix > 128)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Netmask must be between 0 and 128");
goto error;
}
} else {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No IP address defined for the client");
goto error;
}
c->proto = IPPROTO_IP; /* fake for dual */
} else {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Unknown proto \"%s\".", hs_proto);
goto error;
}
if (cl_srcipaddr) {
#ifdef WITH_UDPFROMTO
if (ip_hton(cl_srcipaddr, c->ipaddr.af, &c->src_ipaddr) < 0) {
- cf_log_err(cf_sectiontoitem(cs), "Failed parsing src_ipaddr");
+ cf_log_err_cs(cs, "Failed parsing src_ipaddr");
goto error;
}
#else
(c->prefix == 32)) ||
((c->ipaddr.af == AF_INET6) &&
(c->prefix == 128))) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Dynamic clients MUST be a network, not a single IP address.");
goto error;
}
if (value && (strcmp(value, "yes") == 0)) return c;
#endif
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"secret must be at least 1 character long");
goto error;
}
HOME_TYPE_COA);
}
if (!c->coa_pool && !c->coa_server) {
- cf_log_err(cf_sectiontoitem(cs), "No such home_server or home_server_pool \"%s\"", c->coa_name);
+ cf_log_err_cs(cs, "No such home_server or home_server_pool \"%s\"", c->coa_name);
goto error;
}
}
* Associate the clients structure with the section.
*/
if (cf_data_add(section, "clients", clients, NULL) < 0) {
- cf_log_err(cf_sectiontoitem(section),
+ cf_log_err_cs(section,
"Failed to associate clients with section %s",
cf_section_name1(section));
clients_free(clients);
value = cf_pair_value(cp);
if (!value) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"The \"directory\" entry must not be empty");
client_free(c);
return NULL;
dir = opendir(value);
if (!dir) {
- cf_log_err(cf_sectiontoitem(cs), "Error reading directory %s: %s", value, strerror(errno));
+ cf_log_err_cs(cs, "Error reading directory %s: %s", value, strerror(errno));
client_free(c);
return NULL;
}
dc = client_read(buf2, in_server, TRUE);
if (!dc) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Failed reading client file \"%s\"", buf2);
client_free(c);
closedir(dir);
add_client:
if (!client_add(clients, c)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Failed to add client %s",
cf_section_name2(cs));
client_free(c);
#ifdef WITH_TLS
if (this->tls) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"TLS is not supported for control sockets");
return -1;
}
sock = this->data;
if (sock->proto != IPPROTO_TCP) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"UDP is not supported for control sockets");
return -1;
}
rcode = cf_section_parse(cs, data, detail_config);
if (rcode < 0) {
- cf_log_err(cf_sectiontoitem(cs), "Failed parsing listen section");
+ cf_log_err_cs(cs, "Failed parsing listen section");
return -1;
}
if (!data->filename) {
- cf_log_err(cf_sectiontoitem(cs), "No detail file specified in listen section");
+ cf_log_err_cs(cs, "No detail file specified in listen section");
return -1;
}
if ((data->load_factor < 1) || (data->load_factor > 100)) {
- cf_log_err(cf_sectiontoitem(cs), "Load factor must be between 1 and 100");
+ cf_log_err_cs(cs, "Load factor must be between 1 and 100");
return -1;
}
if ((data->poll_interval < 1) || (data->poll_interval > 20)) {
- cf_log_err(cf_sectiontoitem(cs), "poll_interval must be between 1 and 20");
+ cf_log_err_cs(cs, "poll_interval must be between 1 and 20");
return -1;
}
if (rcode < 0) return -1;
if (rcode == 1) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No address specified in listen section");
return -1;
}
if (rcode < 0) return -1;
if ((listen_port < 0) || (listen_port > 65535)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid value for \"port\"");
return -1;
}
if (rcode < 0) return -1;
if (max_pps && ((max_pps < 10) || (max_pps > 1000000))) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid value for \"max_pps\"");
return -1;
}
if (cf_pair_find(cs, "proto")) {
#ifndef WITH_TCP
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"System does not support the TCP protocol. Delete this line from the configuration file.");
return -1;
#else
if ((sock->limit.lifetime > 0) && (sock->limit.idle_timeout > sock->limit.lifetime))
sock->limit.idle_timeout = 0;
} else {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Unknown proto name \"%s\"", proto);
return -1;
}
#ifdef WITH_PROXY
if ((this->type == RAD_LISTEN_PROXY) &&
(sock->proto != IPPROTO_UDP)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Proxy listeners can only listen on proto = udp");
return -1;
}
* Don't allow TLS configurations for UDP sockets.
*/
if (sock->proto != IPPROTO_TCP) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"TLS transport is not available for UDP sockets.");
return -1;
}
* Built without TLS. Disallow it.
*/
if (cf_section_sub_find(cs, "tls")) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"TLS transport is not available in this executable.");
return -1;
}
* No "proto" field. Disallow TLS.
*/
} else if (cf_section_sub_find(cs, "tls")) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"TLS transport is not available in this \"listen\" section.");
return -1;
}
rad_assert(cp != NULL);
value = cf_pair_value(cp);
if (!value) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No interface name given");
return -1;
}
*/
if (cf_pair_find(cs, "broadcast")) {
#ifndef SO_BROADCAST
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"System does not support broadcast sockets. Delete this line from the configuration file.");
return -1;
#else
CONF_PAIR *cp = cf_pair_find(cs, "broadcast");
if (this->type != RAD_LISTEN_DHCP) {
- cf_log_err(cf_pairtoitem(cp),
+ cf_log_err_cp(cp,
"Broadcast can only be set for DHCP listeners. Delete this line from the configuration file.");
return -1;
}
rad_assert(cp != NULL);
value = cf_pair_value(cp);
if (!value) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No broadcast value given");
return -1;
}
*/
if (listen_bind(this) < 0) {
char buffer[128];
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Error binding to port for %s port %d",
ip_ntoh(&sock->my_ipaddr, buffer, sizeof(buffer)),
sock->my_port);
client_cs = cf_section_find(section_name);
}
if (!client_cs) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Failed to find clients %s {...}",
section_name);
return -1;
sock->clients = clients_parse_section(client_cs);
if (!sock->clients) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Failed to load clients for this listen section");
return -1;
}
&listen_type, "");
if (rcode < 0) return NULL;
if (rcode == 1) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No type specified in listen section");
return NULL;
}
type = fr_str2int(listen_compare, listen_type, -1);
if (type < 0) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid type \"%s\" in listen section.",
listen_type);
return NULL;
sock->clients = clients_parse_section(config);
if (!sock->clients) {
- cf_log_err(cf_sectiontoitem(config),
+ cf_log_err_cs(config,
"Failed to find any clients for this listen section");
listen_free(&this);
return -1;
sock->clients = clients_parse_section(config);
if (!sock->clients) {
- cf_log_err(cf_sectiontoitem(config),
+ cf_log_err_cs(config,
"Failed to find any clients for this listen section");
return -1;
}
#ifdef WITH_TLS
if (!spawn_flag && this->tls) {
- cf_log_err(cf_sectiontoitem(this->cs), "Threading must be enabled for TLS sockets to function properly.");
- cf_log_err(cf_sectiontoitem(this->cs), "You probably need to do 'radiusd -fxx -l stdout' for debugging");
+ cf_log_err_cs(this->cs, "Threading must be enabled for TLS sockets to function properly.");
+ cf_log_err_cs(this->cs, "You probably need to do 'radiusd -fxx -l stdout' for debugging");
return -1;
}
#endif
*/
if (action == 0) return 0;
} else {
- cf_log_err(cf_pairtoitem(cp), "Unknown action '%s'.\n",
+ cf_log_err_cp(cp, "Unknown action '%s'.\n",
value);
return 0;
}
rcode = fr_str2int(rcode_table, attr, -1);
if (rcode < 0) {
- cf_log_err(cf_pairtoitem(cp),
+ cf_log_err_cp(cp,
"Unknown module rcode '%s'.\n",
attr);
return 0;
component = component; /* -Wunused */
if (!cf_section_name2(cs)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Require list name for 'update'.\n");
return NULL;
}
}
if (!ok) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Unknown attribute list \"%s\"",
name2);
return NULL;
}
if (!head) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"ERROR: update %s section cannot be empty",
name2);
return NULL;
component = component; /* -Wunused */
if (!cf_section_name2(cs)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"You must specify a variable to switch over for 'switch'.");
return NULL;
}
if (!cf_item_find_next(cs, NULL)) {
- cf_log_err(cf_sectiontoitem(cs), "'switch' statements cannot be empty.");
+ cf_log_err_cs(cs, "'switch' statements cannot be empty.");
return NULL;
}
component = component; /* -Wunused */
if (!cf_section_name2(cs)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"You must specify an attribute to loop over in 'foreach'.");
return NULL;
}
if (!cf_item_find_next(cs, NULL)) {
- cf_log_err(cf_sectiontoitem(cs), "'foreach' blocks cannot be empty.");
+ cf_log_err_cs(cs, "'foreach' blocks cannot be empty.");
return NULL;
}
node = rbtree_finddata(module_tree, &myentry);
if (node) return node;
if (strlen(module_name) >= sizeof(module_struct)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Failed to link to module '%s': Name is too long\n",
module_name);
return NULL;
*/
handle = lt_dlopenext(module_name);
if (!handle) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Failed to link to module '%s': %s\n",
module_name, dlerror());
return NULL;
*/
module = dlsym(handle, module_struct);
if (!module) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Failed linking to %s structure: %s\n",
module_name, dlerror());
dlclose(handle);
*/
if (module->magic != RLM_MODULE_MAGIC_NUMBER) {
dlclose(handle);
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid version in module '%s'",
module_name);
return NULL;
if ((node->entry->module->instantiate) &&
(!check_config || check_config_safe) &&
((node->entry->module->instantiate)(cs, &node->insthandle) < 0)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Instantiation failed for module \"%s\"",
instname);
if (node->entry->module->detach) {
* Sanity check.
*/
if (!name2) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No name specified for %s block",
section_type_value[comp].typename);
return 1;
*/
dval = dict_valbyname(dattr->attr, dattr->vendor, name2);
if (!dval) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"%s %s Not previously configured",
section_type_value[comp].typename, name2);
modcallable_free(&ml);
*/
dattr = dict_attrbyvalue(section_type_value[comp].attr, 0);
if (!dattr) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No such attribute %s",
section_type_value[comp].typename);
return -1;
}
if (!this) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Errors parsing %s section.\n",
cf_section_name1(cs));
return -1;
modrefname = cf_section_name2(scs);
if (!modrefname) {
modcallable_free(&this);
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Errors parsing %s sub-section.\n",
cf_section_name1(scs));
return -1;
* recognize. Die!
*/
modcallable_free(&this);
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Unknown Auth-Type \"%s\" in %s sub-section.",
modrefname, section_type_value[comp].section);
return -1;
*/
dattr = dict_attrbyvalue(section_type_value[comp].attr, 0);
if (!dattr) {
- cf_log_err(cf_sectiontoitem(subcs),
+ cf_log_err_cs(subcs,
"No such attribute %s",
section_type_value[comp].typename);
error:
cf_log_module(cs, "Trying to reload module \"%s\"", node->name);
if ((node->entry->module->instantiate)(cs, &insthandle) < 0) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"HUP failed for module \"%s\". Using old configuration.",
node->name);
return 0;
name2 = cf_section_name2(cs);
if (!name2) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Home server section is missing a name.");
return 0;
}
home->ipaddr.af = AF_UNSPEC;
home->server = cf_pair_value(cp);
if (!home->server) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid value for virtual_server");
goto error;
}
if (!cf_section_sub_find_name2(rc->cs, "server", home->server)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No such server %s", home->server);
goto error;
}
goto skip_port;
} else {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No ipaddr, ipv6addr, or virtual_server defined for home server \"%s\".",
name2);
error:
}
if (!home->port || (home->port > 65535)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No port, or invalid port defined for home server %s.",
name2);
goto error;
}
if (0) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Fatal error! Home server %s is ourselves!",
name2);
goto error;
}
if (!home->secret) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No shared secret defined for home server %s.",
name2);
goto error;
dual = FALSE;
if (home->server != NULL) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Home servers of type \"coa\" cannot point to a virtual server");
goto error;
}
#endif
} else {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid type \"%s\" for home server %s.",
hs_type, name2);
goto error;
if (!home->ping_user_name ||
!*home->ping_user_name) {
- cf_log_err(cf_sectiontoitem(cs), "You must supply a 'username' to enable status_check=request");
+ cf_log_err_cs(cs, "You must supply a 'username' to enable status_check=request");
goto error;
}
if ((home->type == HOME_TYPE_AUTH) &&
(!home->ping_user_password ||
!*home->ping_user_password)) {
- cf_log_err(cf_sectiontoitem(cs), "You must supply a password to enable status_check=request");
+ cf_log_err_cs(cs, "You must supply a password to enable status_check=request");
goto error;
}
} else {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid status__check \"%s\" for home server %s.",
hs_check, name2);
goto error;
if ((home->ping_check != HOME_PING_CHECK_NONE) &&
(home->ping_check != HOME_PING_CHECK_STATUS_SERVER)) {
if (!home->ping_user_name) {
- cf_log_err(cf_sectiontoitem(cs), "You must supply a user name to enable status_check=request");
+ cf_log_err_cs(cs, "You must supply a user name to enable status_check=request");
goto error;
}
if ((home->type == HOME_TYPE_AUTH) &&
!home->ping_user_password) {
- cf_log_err(cf_sectiontoitem(cs), "You must supply a password to enable status_check=request");
+ cf_log_err_cs(cs, "You must supply a password to enable status_check=request");
goto error;
}
}
home->proto = IPPROTO_TCP;
if (home->ping_check != HOME_PING_CHECK_NONE) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Only 'status_check = none' is allowed for home servers with 'proto = tcp'");
goto error;
}
} else {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Unknown proto \"%s\".", hs_proto);
goto error;
}
if (!home->server &&
rbtree_finddata(home_servers_byaddr, home)) {
- cf_log_err(cf_sectiontoitem(cs), "Duplicate home server");
+ cf_log_err_cs(cs, "Duplicate home server");
goto error;
}
*/
if (hs_srcipaddr) {
if (ip_hton(hs_srcipaddr, home->ipaddr.af, &home->src_ipaddr) < 0) {
- cf_log_err(cf_sectiontoitem(cs), "Failed parsing src_ipaddr");
+ cf_log_err_cs(cs, "Failed parsing src_ipaddr");
goto error;
}
}
if (tls && (home->proto != IPPROTO_TCP)) {
- cf_log_err(cf_sectiontoitem(cs), "TLS transport is not available for UDP sockets.");
+ cf_log_err_cs(cs, "TLS transport is not available for UDP sockets.");
goto error;
}
#ifndef WITH_TLS
if (tls) {
- cf_log_err(cf_sectiontoitem(cs), "TLS transport is not available in this executable.");
+ cf_log_err_cs(cs, "TLS transport is not available in this executable.");
goto error;
}
#else
#endif
} else if (tls) {
- cf_log_err(cf_sectiontoitem(cs), "Virtual home_servers cannot have a \"tls\" subsection");
+ cf_log_err_cs(cs, "Virtual home_servers cannot have a \"tls\" subsection");
goto error;
}
hs_srcipaddr = NULL;
if (rbtree_finddata(home_servers_byname, home) != NULL) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Duplicate home server name %s.", name2);
goto error;
}
if (!home->server &&
(rbtree_finddata(home_servers_byaddr, home) != NULL)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Duplicate home server IP %s.", name2);
goto error;
}
if (!rbtree_insert(home_servers_byname, home)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Internal error %d adding home server %s.",
__LINE__, name2);
goto error;
if (!home->server &&
!rbtree_insert(home_servers_byaddr, home)) {
rbtree_deletebydata(home_servers_byname, home);
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Internal error %d adding home server %s.",
__LINE__, name2);
goto error;
if (home->ipaddr.af != AF_UNSPEC) {
rbtree_deletebydata(home_servers_byname, home);
}
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Internal error %d adding home server %s.",
__LINE__, name2);
goto error;
home2->parent_server = home->parent_server;
if (!rbtree_insert(home_servers_byname, home2)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Internal error %d adding home server %s.",
__LINE__, name2);
free(home2);
if (!home->server &&
!rbtree_insert(home_servers_byaddr, home2)) {
rbtree_deletebydata(home_servers_byname, home2);
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Internal error %d adding home server %s.",
__LINE__, name2);
free(home2);
if (!home2->server) {
rbtree_deletebydata(home_servers_byname, home2);
}
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Internal error %d adding home server %s.",
__LINE__, name2);
free(home2);
CONF_SECTION *server_cs;
if (!name) {
- cf_log_err(cf_pairtoitem(cp),
+ cf_log_err_cp(cp,
"No value given for home_server.");
return 0;
}
server_cs = cf_section_sub_find_name2(rc->cs, "home_server", name);
if (!server_cs) {
- cf_log_err(cf_pairtoitem(cp),
+ cf_log_err_cp(cp,
"Unknown home_server \"%s\".", name);
return 0;
}
home = rbtree_finddata(home_servers_byname, &myhome);
if (!home) {
- cf_log_err(cf_pairtoitem(cp),
+ cf_log_err_cp(cp,
"Internal error %d adding home server \"%s\".",
__LINE__, name);
return 0;
name2 = cf_section_name1(cs);
if (!name2 || ((strcasecmp(name2, "server_pool") != 0) &&
(strcasecmp(name2, "home_server_pool") != 0))) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Section is not a home_server_pool.");
return 0;
}
name2 = cf_section_name2(cs);
if (!name2) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Server pool section is missing a name.");
return 0;
}
}
if (num_home_servers == 0) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"No home servers defined in pool %s",
name2);
goto error;
if (cp) {
#ifdef WITH_COA
if (server_type == HOME_TYPE_COA) {
- cf_log_err(cf_sectiontoitem(cs), "Home server pools of type \"coa\" cannot have a fallback virtual server.");
+ cf_log_err_cs(cs, "Home server pools of type \"coa\" cannot have a fallback virtual server.");
goto error;
}
#endif
}
if (!pool->fallback->server) {
- cf_log_err(cf_sectiontoitem(cs), "Fallback home_server %s does NOT contain a virtual_server directive.", pool->fallback->name);
+ cf_log_err_cs(cs, "Fallback home_server %s does NOT contain a virtual_server directive.", pool->fallback->name);
goto error;
}
}
value = cf_pair_value(cp);
if (!value) {
- cf_log_err(cf_pairtoitem(cp),
+ cf_log_err_cp(cp,
"No value given for type.");
goto error;
}
pool->type = fr_str2int(pool_types, value, 0);
if (!pool->type) {
- cf_log_err(cf_pairtoitem(cp),
+ cf_log_err_cp(cp,
"Unknown type \"%s\".",
value);
goto error;
if (cp) {
pool->virtual_server = cf_pair_value(cp);
if (!pool->virtual_server) {
- cf_log_err(cf_pairtoitem(cp), "No value given for virtual_server");
+ cf_log_err_cp(cp, "No value given for virtual_server");
goto error;
}
if (!cf_section_sub_find_name2(rc->cs, "server",
pool->virtual_server)) {
- cf_log_err(cf_pairtoitem(cp), "No such server %s",
+ cf_log_err_cp(cp, "No such server %s",
pool->virtual_server);
goto error;
}
*/
if (strcmp(name, "LOCAL") == 0) {
if (*pool_p) {
- cf_log_err(cf_sectiontoitem(cs), "Realm \"%s\" cannot be both LOCAL and remote", name);
+ cf_log_err_cs(cs, "Realm \"%s\" cannot be both LOCAL and remote", name);
return 0;
}
return 1;
pool = rbtree_finddata(home_pools_byname, &mypool);
if (pool) {
if (pool->type != ldflag) {
- cf_log_err(cf_sectiontoitem(cs), "Inconsistent ldflag for server pool \"%s\"", name);
+ cf_log_err_cs(cs, "Inconsistent ldflag for server pool \"%s\"", name);
return 0;
}
if (pool->server_type != type) {
- cf_log_err(cf_sectiontoitem(cs), "Inconsistent home server type for server pool \"%s\"", name);
+ cf_log_err_cs(cs, "Inconsistent home server type for server pool \"%s\"", name);
return 0;
}
}
home = rbtree_finddata(home_servers_byname, &myhome);
if (home) {
if (secret && (strcmp(home->secret, secret) != 0)) {
- cf_log_err(cf_sectiontoitem(cs), "Inconsistent shared secret for home server \"%s\"", name);
+ cf_log_err_cs(cs, "Inconsistent shared secret for home server \"%s\"", name);
return 0;
}
if (home->type != type) {
- cf_log_err(cf_sectiontoitem(cs), "Inconsistent type for home server \"%s\"", name);
+ cf_log_err_cs(cs, "Inconsistent type for home server \"%s\"", name);
return 0;
}
}
if (insert_point < 0) {
- cf_log_err(cf_sectiontoitem(cs), "No room in pool to add home server \"%s\". Please update the realm configuration to use the new-style home servers and server pools.", name);
+ cf_log_err_cs(cs, "No room in pool to add home server \"%s\". Please update the realm configuration to use the new-style home servers and server pools.", name);
return 0;
}
}
q = NULL;
} else if (p == name) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid hostname %s.",
name);
free(home);
} else {
home->port = atoi(p + 1);
if ((home->port == 0) || (home->port > 65535)) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid port %s.",
p + 1);
free(home);
if (!server) {
if (ip_hton(p, AF_UNSPEC, &home->ipaddr) < 0) {
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Failed looking up hostname %s.",
p);
free(home);
home->revive_interval = rc->dead_time;
if (rbtree_finddata(home_servers_byaddr, home)) {
- cf_log_err(cf_sectiontoitem(cs), "Home server %s has the same IP address and/or port as another home server.", name);
+ cf_log_err_cs(cs, "Home server %s has the same IP address and/or port as another home server.", name);
free(home);
return 0;
}
if (!rbtree_insert(home_servers_byname, home)) {
- cf_log_err(cf_sectiontoitem(cs), "Internal error %d adding home server %s.", __LINE__, name);
+ cf_log_err_cs(cs, "Internal error %d adding home server %s.", __LINE__, name);
free(home);
return 0;
}
if (!rbtree_insert(home_servers_byaddr, home)) {
rbtree_deletebydata(home_servers_byname, home);
- cf_log_err(cf_sectiontoitem(cs), "Internal error %d adding home server %s.", __LINE__, name);
+ cf_log_err_cs(cs, "Internal error %d adding home server %s.", __LINE__, name);
free(home);
return 0;
}
if (home->ipaddr.af != AF_UNSPEC) {
rbtree_deletebydata(home_servers_byname, home);
}
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Internal error %d adding home server %s.",
__LINE__, name);
free(home);
}
if (num_home_servers == 0) {
- cf_log_err(cf_sectiontoitem(cs), "Internal error counting pools for home server %s.", name);
+ cf_log_err_cs(cs, "Internal error counting pools for home server %s.", name);
free(home);
return 0;
}
if (cp) {
host = cf_pair_value(cp);
if (!host) {
- cf_log_err(cf_pairtoitem(cp), "No value specified for ldflag");
+ cf_log_err_cp(cp, "No value specified for ldflag");
return 0;
}
cf_log_info(cs, "\tldflag = round_robin");
} else {
- cf_log_err(cf_sectiontoitem(cs), "Unknown value \"%s\" for ldflag", host);
+ cf_log_err_cs(cs, "Unknown value \"%s\" for ldflag", host);
return 0;
}
} /* else don't print it. */
if (cp) {
host = cf_pair_value(cp);
if (!host) {
- cf_log_err(cf_pairtoitem(cp), "No value specified for authhost");
+ cf_log_err_cp(cp, "No value specified for authhost");
return 0;
}
if (strcmp(host, "LOCAL") != 0) {
cp = cf_pair_find(cs, "secret");
if (!cp) {
- cf_log_err(cf_sectiontoitem(cs), "No shared secret supplied for realm: %s", r->name);
+ cf_log_err_cs(cs, "No shared secret supplied for realm: %s", r->name);
return 0;
}
secret = cf_pair_value(cp);
if (!secret) {
- cf_log_err(cf_pairtoitem(cp), "No value specified for secret");
+ cf_log_err_cp(cp, "No value specified for secret");
return 0;
}
}
if (cp) {
host = cf_pair_value(cp);
if (!host) {
- cf_log_err(cf_pairtoitem(cp), "No value specified for accthost");
+ cf_log_err_cp(cp, "No value specified for accthost");
return 0;
}
if ((strcmp(host, "LOCAL") != 0) && !secret) {
cp = cf_pair_find(cs, "secret");
if (!cp) {
- cf_log_err(cf_sectiontoitem(cs), "No shared secret supplied for realm: %s", r->name);
+ cf_log_err_cs(cs, "No shared secret supplied for realm: %s", r->name);
return 0;
}
secret = cf_pair_value(cp);
if (!secret) {
- cf_log_err(cf_pairtoitem(cp), "No value specified for secret");
+ cf_log_err_cp(cp, "No value specified for secret");
return 0;
}
}
if (cp) {
host = cf_pair_value(cp);
if (!host) {
- cf_log_err(cf_pairtoitem(cp), "No value specified for virtual_server");
+ cf_log_err_cp(cp, "No value specified for virtual_server");
return 0;
}
name);
}
if (!pool_cs) {
- cf_log_err(cf_sectiontoitem(cs), "Failed to find home_server_pool \"%s\"", name);
+ cf_log_err_cs(cs, "Failed to find home_server_pool \"%s\"", name);
return 0;
}
}
if (pool->server_type != server_type) {
- cf_log_err(cf_sectiontoitem(cs), "Incompatible home_server_pool \"%s\" (mixed auth_pool / acct_pool)", name);
+ cf_log_err_cs(cs, "Incompatible home_server_pool \"%s\" (mixed auth_pool / acct_pool)", name);
return 0;
}
name2 = cf_section_name1(cs);
if (!name2 || (strcasecmp(name2, "realm") != 0)) {
- cf_log_err(cf_sectiontoitem(cs), "Section is not a realm.");
+ cf_log_err_cs(cs, "Section is not a realm.");
return 0;
}
name2 = cf_section_name2(cs);
if (!name2) {
- cf_log_err(cf_sectiontoitem(cs), "Realm section is missing the realm name.");
+ cf_log_err_cs(cs, "Realm section is missing the realm name.");
return 0;
}
if (cp) auth_pool_name = cf_pair_value(cp);
if (cp && auth_pool_name) {
if (auth_pool) {
- cf_log_err(cf_sectiontoitem(cs), "Cannot use \"pool\" and \"auth_pool\" at the same time.");
+ cf_log_err_cs(cs, "Cannot use \"pool\" and \"auth_pool\" at the same time.");
return 0;
}
if (!add_pool_to_realm(rc, cs,
int do_print = TRUE;
if (acct_pool) {
- cf_log_err(cf_sectiontoitem(cs), "Cannot use \"pool\" and \"acct_pool\" at the same time.");
+ cf_log_err_cs(cs, "Cannot use \"pool\" and \"acct_pool\" at the same time.");
return 0;
}
if (r && (strcmp(r->name, name2) == 0)) {
if (cf_pair_find(cs, "auth_pool") ||
cf_pair_find(cs, "acct_pool")) {
- cf_log_err(cf_sectiontoitem(cs), "Duplicate realm \"%s\"", name2);
+ cf_log_err_cs(cs, "Duplicate realm \"%s\"", name2);
goto error;
}
regerror(rcode, ®, buffer, sizeof(buffer));
- cf_log_err(cf_sectiontoitem(cs),
+ cf_log_err_cs(cs,
"Invalid regex \"%s\": %s",
name2 + 1, buffer);
goto error;
cp = cf_pair_find(cs, "home_server");
if (!cp) {
- cf_log_err(cf_sectiontoitem(cs), "Pool does not contain a \"home_server\" entry");
+ cf_log_err_cs(cs, "Pool does not contain a \"home_server\" entry");
return HOME_TYPE_INVALID;
}
name = cf_pair_value(cp);
if (!name) {
- cf_log_err(cf_pairtoitem(cp), "home_server entry does not reference a home server");
+ cf_log_err_cp(cp, "home_server entry does not reference a home server");
return HOME_TYPE_INVALID;
}
server_cs = cf_section_sub_find_name2(config, "home_server", name);
if (!server_cs) {
- cf_log_err(cf_pairtoitem(cp), "home_server \"%s\" does not exist", name);
+ cf_log_err_cp(cp, "home_server \"%s\" does not exist", name);
return HOME_TYPE_INVALID;
}
cp = cf_pair_find(server_cs, "type");
if (!cp) {
- cf_log_err(cf_sectiontoitem(server_cs), "home_server %s does not contain a \"type\" entry", name);
+ cf_log_err_cs(server_cs, "home_server %s does not contain a \"type\" entry", name);
return HOME_TYPE_INVALID;
}
type = cf_pair_value(cp);
if (!type) {
- cf_log_err(cf_sectiontoitem(server_cs), "home_server %s contains an empty \"type\" entry", name);
+ cf_log_err_cs(server_cs, "home_server %s contains an empty \"type\" entry", name);
return HOME_TYPE_INVALID;
}
home = fr_str2int(home_server_types, type, HOME_TYPE_INVALID);
if (home == HOME_TYPE_INVALID) {
- cf_log_err(cf_sectiontoitem(server_cs), "home_server %s contains an invalid \"type\" entry of value \"%s\"", name, type);
+ cf_log_err_cs(server_cs, "home_server %s contains an invalid \"type\" entry of value \"%s\"", name, type);
return HOME_TYPE_INVALID;
}
}
if (!*head) {
- cf_log_err(cf_sectiontoitem(inst->cs),
+ cf_log_err_cs(inst->cs,
"Cache config must contain an update section, and "
"that section must not be empty");
xlat_register(inst->xlat_name, cache_xlat, inst);
if (!inst->key || !*inst->key) {
- cf_log_err(cf_sectiontoitem(conf), "You must specify a key");
+ cf_log_err_cs(conf, "You must specify a key");
return -1;
}
if (inst->ttl == 0) {
- cf_log_err(cf_sectiontoitem(conf), "TTL must be greater than zero");
+ cf_log_err_cs(conf, "TTL must be greater than zero");
return -1;
}
if (inst->epoch != 0){
- cf_log_err(cf_sectiontoitem(conf), "Epoch should only be set dynamically");
+ cf_log_err_cs(conf, "Epoch should only be set dynamically");
return -1;
}
}
if (strlen(inst->socket) > (sizeof(sa.sun_path) - 1)){
- cf_log_err(cf_sectiontoitem(conf), "Socket filename is too long");
+ cf_log_err_cs(conf, "Socket filename is too long");
return -1;
}
* fail.
*/
if (cf_section_parse(conf, data, module_config) < 0) {
- cf_log_err(cf_sectiontoitem(conf), "Unable to parse parameters.");
+ cf_log_err_cs(conf, "Unable to parse parameters.");
return -1;
}
* No query, die.
*/
if (!data->query) {
- cf_log_err(cf_sectiontoitem(conf), "'query' must be set.");
+ cf_log_err_cs(conf, "'query' must be set.");
return -1;
}
* Discover the attribute number of the key.
*/
if (!data->key_name) {
- cf_log_err(cf_sectiontoitem(conf), "'key' must be set.");
+ cf_log_err_cs(conf, "'key' must be set.");
return -1;
}
dattr = dict_attrbyname(data->key_name);
if (!dattr) {
- cf_log_err(cf_sectiontoitem(conf), "No such attribute %s",
+ cf_log_err_cs(conf, "No such attribute %s",
data->key_name);
return -1;
}
dattr = dict_attrbyname(data->reply_name);
if (!dattr) {
- cf_log_err(cf_sectiontoitem(conf), "No such attribute %s",
+ cf_log_err_cs(conf, "No such attribute %s",
data->reply_name);
return -1;
}
* Check the "sqlmod-inst" option.
*/
if (!data->sqlmod_inst) {
- cf_log_err(cf_sectiontoitem(conf), "'sqlmod-inst' must be set.");
+ cf_log_err_cs(conf, "'sqlmod-inst' must be set.");
return -1;
}
* Create a new attribute for the counter.
*/
if (!data->counter_name) {
- cf_log_err(cf_sectiontoitem(conf), "'counter-name' must be set.");
+ cf_log_err_cs(conf, "'counter-name' must be set.");
return -1;
}
dict_addattr(data->counter_name, -1, 0, PW_TYPE_INTEGER, flags);
dattr = dict_attrbyname(data->counter_name);
if (!dattr) {
- cf_log_err(cf_sectiontoitem(conf), "Failed to create counter attribute %s",
+ cf_log_err_cs(conf, "Failed to create counter attribute %s",
data->counter_name);
return -1;
}
if (dattr->vendor != 0) {
- cf_log_err(cf_sectiontoitem(conf), "Counter attribute must not be a VSA");
+ cf_log_err_cs(conf, "Counter attribute must not be a VSA");
return -1;
}
data->dict_attr = dattr;
* Create a new attribute for the check item.
*/
if (!data->check_name) {
- cf_log_err(cf_sectiontoitem(conf), "'check-name' must be set.");
+ cf_log_err_cs(conf, "'check-name' must be set.");
return -1;
}
dict_addattr(data->check_name, 0, PW_TYPE_INTEGER, -1, flags);
dattr = dict_attrbyname(data->check_name);
if (!dattr) {
- cf_log_err(cf_sectiontoitem(conf), "Failed to create check attribute %s",
+ cf_log_err_cs(conf, "Failed to create check attribute %s",
data->check_name);
return -1;
}
* Discover the end of the current time period.
*/
if (!data->reset) {
- cf_log_err(cf_sectiontoitem(conf), "'reset' must be set.");
+ cf_log_err_cs(conf, "'reset' must be set.");
return -1;
}
now = time(NULL);
data->reset_time = 0;
if (find_next_reset(data,now) == -1) {
- cf_log_err(cf_sectiontoitem(conf), "Invalid reset '%s'", data->reset);
+ cf_log_err_cs(conf, "Invalid reset '%s'", data->reset);
return -1;
}
data->last_reset = 0;
if (find_prev_reset(data, now) < 0) {
- cf_log_err(cf_sectiontoitem(conf), "Invalid reset '%s'", data->reset);
+ cf_log_err_cs(conf, "Invalid reset '%s'", data->reset);
return -1;
}
return retval;
}
-#define NOT_EMPTY(_x, _y) do { if (!inst->_x || !*inst->_x) { cf_log_err(cf_sectiontoitem(conf), "the '" _y "' variable must be set"); return -1;}} while (0)
+#define NOT_EMPTY(_x, _y) do { if (!inst->_x || !*inst->_x) { cf_log_err_cs(conf, "the '" _y "' variable must be set"); return -1;}} while (0)
/*
* Do any per-module initialization that is separate to each
sqlinst = find_module_instance(cf_section_find("modules"),
inst->sql_instance_name, 1);
if (!sqlinst) {
- cf_log_err(cf_sectiontoitem(conf), "failed to find sql instance named %s",
+ cf_log_err_cs(conf, "failed to find sql instance named %s",
inst->sql_instance_name);
return -1;
}
if (strcmp(sqlinst->entry->name, "rlm_sql") != 0) {
- cf_log_err(cf_sectiontoitem(conf), "Module \"%s\""
+ cf_log_err_cs(conf, "Module \"%s\""
" is not an instance of the rlm_sql module",
inst->sql_instance_name);
return -1;