Use cf_log_err_cs/cp everywhere
authorAlan T. DeKok <aland@freeradius.org>
Fri, 29 Mar 2013 16:08:25 +0000 (12:08 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 29 Mar 2013 16:08:41 +0000 (12:08 -0400)
via a Perl script

src/main/client.c
src/main/command.c
src/main/detail.c
src/main/listen.c
src/main/modcall.c
src/main/modules.c
src/main/realms.c
src/modules/rlm_cache/rlm_cache.c
src/modules/rlm_smsotp/rlm_smsotp.c
src/modules/rlm_sqlcounter/rlm_sqlcounter.c
src/modules/rlm_sqlippool/rlm_sqlippool.c

index 9b71887..9a17c14 100644 (file)
@@ -571,7 +571,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
 
        name2 = cf_section_name2(cs);
        if (!name2) {
-               cf_log_err(cf_sectiontoitem(cs),
+               cf_log_err_cs(cs,
                           "Missing client name");
                return NULL;
        }
@@ -587,7 +587,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
        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);
@@ -604,7 +604,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
         *      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;
        }
@@ -625,7 +625,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
                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;
@@ -638,7 +638,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
                 *      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;
@@ -660,7 +660,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
                        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;
                        }
@@ -670,12 +670,12 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
                        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;
                }
@@ -703,7 +703,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
                                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;
                        }
@@ -719,7 +719,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
        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
@@ -748,7 +748,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
                     (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;
                }
@@ -770,7 +770,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
                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;
        }
@@ -788,7 +788,7 @@ static RADCLIENT *client_parse(CONF_SECTION *cs, int in_server)
                                                           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;
                }
        }
@@ -839,7 +839,7 @@ RADCLIENT_LIST *clients_parse_section(CONF_SECTION *section)
         *      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);
@@ -878,7 +878,7 @@ RADCLIENT_LIST *clients_parse_section(CONF_SECTION *section)
                        
                        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;
@@ -888,7 +888,7 @@ RADCLIENT_LIST *clients_parse_section(CONF_SECTION *section)
                        
                        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;
                        }
@@ -922,7 +922,7 @@ RADCLIENT_LIST *clients_parse_section(CONF_SECTION *section)
 
                                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);
@@ -946,7 +946,7 @@ RADCLIENT_LIST *clients_parse_section(CONF_SECTION *section)
 
        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);
index 7f9071a..66ffc15 100644 (file)
@@ -2224,7 +2224,7 @@ static int command_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
 
 #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;
        }
@@ -2232,7 +2232,7 @@ static int command_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
 
        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;
        }
index c149e3a..cf2d7a1 100644 (file)
@@ -872,22 +872,22 @@ int detail_parse(CONF_SECTION *cs, rad_listen_t *this)
 
        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;
        }
 
index 8b2d981..d6026af 100644 (file)
@@ -929,7 +929,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
                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;
                }
@@ -941,7 +941,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
        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;
        }
@@ -951,7 +951,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
        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;
        }
@@ -960,7 +960,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
 
        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
@@ -998,7 +998,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
                        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;
                }
@@ -1010,7 +1010,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
 #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;
                }
@@ -1023,7 +1023,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
                 *      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;
                }
@@ -1053,7 +1053,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
                 *      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;
                }
@@ -1065,7 +1065,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
                 *      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;
        }
@@ -1100,7 +1100,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
                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;
                }
@@ -1113,7 +1113,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
         */
        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
@@ -1121,7 +1121,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
                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;
                }
@@ -1129,7 +1129,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
                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;
                }
@@ -1147,7 +1147,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
         */
        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);
@@ -1181,7 +1181,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
                        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;
@@ -1211,7 +1211,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
 
        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;
        }
@@ -2702,14 +2702,14 @@ static rad_listen_t *listen_parse(CONF_SECTION *cs, const char *server)
                              &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;
@@ -2856,7 +2856,7 @@ int listen_init(CONF_SECTION *config, rad_listen_t **head, int spawn_flag)
 
                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;
@@ -2906,7 +2906,7 @@ int listen_init(CONF_SECTION *config, rad_listen_t **head, int spawn_flag)
 
                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;
                }
@@ -3025,8 +3025,8 @@ add_sockets:
 
 #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
index 299f592..c5f93c2 100644 (file)
@@ -202,7 +202,7 @@ static int compile_action(modcallable *c, CONF_PAIR *cp)
                 */
                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;
        }
@@ -212,7 +212,7 @@ static int compile_action(modcallable *c, CONF_PAIR *cp)
 
                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;
@@ -1445,7 +1445,7 @@ static modcallable *do_compile_modupdate(modcallable *parent,
        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;
        }
@@ -1463,7 +1463,7 @@ static modcallable *do_compile_modupdate(modcallable *parent,
        }
 
        if (!ok) {
-               cf_log_err(cf_sectiontoitem(cs),
+               cf_log_err_cs(cs,
                           "Unknown attribute list \"%s\"",
                           name2);
                return NULL;
@@ -1535,7 +1535,7 @@ static modcallable *do_compile_modupdate(modcallable *parent,
        }
 
        if (!head) {
-               cf_log_err(cf_sectiontoitem(cs),
+               cf_log_err_cs(cs,
                           "ERROR: update %s section cannot be empty",
                           name2);
                return NULL;
@@ -1570,13 +1570,13 @@ static modcallable *do_compile_modswitch(modcallable *parent,
        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;
        }
 
@@ -1633,13 +1633,13 @@ static modcallable *do_compile_modforeach(modcallable *parent,
        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;
        }
 
index b9c3a92..27b4abb 100644 (file)
@@ -391,7 +391,7 @@ static module_entry_t *linkto_module(const char *module_name,
        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;
@@ -417,7 +417,7 @@ static module_entry_t *linkto_module(const char *module_name,
         */
        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;
@@ -431,7 +431,7 @@ static module_entry_t *linkto_module(const char *module_name,
         */
        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);
@@ -446,7 +446,7 @@ static module_entry_t *linkto_module(const char *module_name,
         */
        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;
@@ -566,7 +566,7 @@ module_instance_t *find_module_instance(CONF_SECTION *modules,
        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) {
@@ -737,7 +737,7 @@ static int load_subcomponent_section(modcallable *parent, CONF_SECTION *cs,
         *      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;
@@ -759,7 +759,7 @@ static int load_subcomponent_section(modcallable *parent, CONF_SECTION *cs,
         */
        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);
@@ -824,7 +824,7 @@ static int load_component_section(CONF_SECTION *cs,
         */
        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;
@@ -880,7 +880,7 @@ static int load_component_section(CONF_SECTION *cs,
                }
 
                if (!this) {
-                       cf_log_err(cf_sectiontoitem(cs),
+                       cf_log_err_cs(cs,
                                   "Errors parsing %s section.\n",
                                   cf_section_name1(cs));
                        return -1;
@@ -903,7 +903,7 @@ static int load_component_section(CONF_SECTION *cs,
                                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;
@@ -917,7 +917,7 @@ static int load_component_section(CONF_SECTION *cs,
                                 *      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;
@@ -995,7 +995,7 @@ static int load_byserver(CONF_SECTION *cs)
                 */
                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:
@@ -1280,7 +1280,7 @@ int module_hup_module(CONF_SECTION *cs, module_instance_t *node, time_t when)
        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;
index 5418b46..b4270fb 100644 (file)
@@ -425,7 +425,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
 
        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;
        }
@@ -462,14 +462,14 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                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;
                }
@@ -483,7 +483,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                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:
@@ -498,21 +498,21 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
        }
 
        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;
@@ -540,14 +540,14 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                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;
@@ -566,19 +566,19 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
 
                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;
@@ -588,13 +588,13 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
        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;
                }
        }
@@ -610,13 +610,13 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                        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;
                }
@@ -625,7 +625,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
 
        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;
        }
 
@@ -646,7 +646,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                 */
                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;
                        }
                        
@@ -660,14 +660,14 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                }
 
                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
@@ -683,7 +683,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
 #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;
        }
 
@@ -697,20 +697,20 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
        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;
@@ -719,7 +719,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
        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;
@@ -732,7 +732,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                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;
@@ -812,7 +812,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                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);
@@ -822,7 +822,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                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);
@@ -836,7 +836,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                        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);
@@ -882,7 +882,7 @@ static int pool_check_home_server(realm_config_t *rc, CONF_PAIR *cp,
        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;
        }
@@ -897,14 +897,14 @@ static int pool_check_home_server(realm_config_t *rc, CONF_PAIR *cp,
        
        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;
@@ -928,14 +928,14 @@ static int server_pool_add(realm_config_t *rc,
        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;
        }
@@ -956,7 +956,7 @@ static int server_pool_add(realm_config_t *rc,
        }
 
        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;
@@ -975,7 +975,7 @@ static int server_pool_add(realm_config_t *rc,
        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
@@ -987,7 +987,7 @@ static int server_pool_add(realm_config_t *rc,
                }
 
                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;
                }
        }
@@ -1009,14 +1009,14 @@ static int server_pool_add(realm_config_t *rc,
 
                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;
@@ -1029,7 +1029,7 @@ static int server_pool_add(realm_config_t *rc,
        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;
                }
 
@@ -1039,7 +1039,7 @@ static int server_pool_add(realm_config_t *rc,
 
                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;
                }
@@ -1122,7 +1122,7 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
         */
        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;
@@ -1137,12 +1137,12 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
        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;
                }
        }
@@ -1152,12 +1152,12 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
        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;
                }
 
@@ -1192,7 +1192,7 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
                }
 
                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;
                }
        }
@@ -1226,7 +1226,7 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
                        q = NULL;
 
                } else if (p == name) {
-                               cf_log_err(cf_sectiontoitem(cs),
+                               cf_log_err_cs(cs,
                                           "Invalid hostname %s.",
                                           name);
                                free(home);
@@ -1235,7 +1235,7 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
                } 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);
@@ -1250,7 +1250,7 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
 
                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);
@@ -1277,20 +1277,20 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
                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;
                }
@@ -1302,7 +1302,7 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
                        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);
@@ -1338,7 +1338,7 @@ static int old_server_add(realm_config_t *rc, CONF_SECTION *cs,
        }
 
        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;
        }
@@ -1371,7 +1371,7 @@ static int old_realm_config(realm_config_t *rc, CONF_SECTION *cs, REALM *r)
        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;
                }
 
@@ -1383,7 +1383,7 @@ static int old_realm_config(realm_config_t *rc, CONF_SECTION *cs, REALM *r)
                        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. */
@@ -1396,20 +1396,20 @@ static int old_realm_config(realm_config_t *rc, CONF_SECTION *cs, REALM *r)
        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;
                        }
                }
@@ -1426,7 +1426,7 @@ static int old_realm_config(realm_config_t *rc, CONF_SECTION *cs, REALM *r)
        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;
                }
 
@@ -1437,13 +1437,13 @@ static int old_realm_config(realm_config_t *rc, CONF_SECTION *cs, REALM *r)
                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;
                        }
                }
@@ -1460,7 +1460,7 @@ static int old_realm_config(realm_config_t *rc, CONF_SECTION *cs, REALM *r)
        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;
                }
 
@@ -1506,7 +1506,7 @@ static int add_pool_to_realm(realm_config_t *rc, CONF_SECTION *cs,
                                                            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;
                }
 
@@ -1522,7 +1522,7 @@ static int add_pool_to_realm(realm_config_t *rc, CONF_SECTION *cs,
        }
 
        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;
        }
 
@@ -1549,13 +1549,13 @@ static int realm_add(realm_config_t *rc, CONF_SECTION *cs)
 
        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;
        }
 
@@ -1591,7 +1591,7 @@ static int realm_add(realm_config_t *rc, CONF_SECTION *cs)
        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,
@@ -1607,7 +1607,7 @@ static int realm_add(realm_config_t *rc, CONF_SECTION *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;
                }
 
@@ -1650,7 +1650,7 @@ static int realm_add(realm_config_t *rc, CONF_SECTION *cs)
        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;
                }
 
@@ -1678,7 +1678,7 @@ static int realm_add(realm_config_t *rc, CONF_SECTION *cs)
 
                        regerror(rcode, &reg, buffer, sizeof(buffer));
 
-                       cf_log_err(cf_sectiontoitem(cs),
+                       cf_log_err_cs(cs,
                                   "Invalid regex \"%s\": %s",
                                   name2 + 1, buffer);
                        goto error;
@@ -1795,37 +1795,37 @@ static int pool_peek_type(CONF_SECTION *config, CONF_SECTION *cs)
 
        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;
        }
 
index 4b52fc9..fe40f1c 100644 (file)
@@ -548,7 +548,7 @@ static int cache_verify(rlm_cache_t *inst, value_pair_map_t **head)
        }
        
        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");
 
@@ -741,17 +741,17 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
        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;
        }
 
index aa66b85..b345fd0 100644 (file)
@@ -190,7 +190,7 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
        }
 
        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;
        }
 
index 1b38e9b..a8dd263 100644 (file)
@@ -375,7 +375,7 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
         *      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;
        }
 
@@ -383,7 +383,7 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
         *      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;
        }
 
@@ -391,12 +391,12 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
         *      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;
        }
@@ -404,7 +404,7 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
 
        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;
        }
@@ -416,7 +416,7 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
         *      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;
        }
 
@@ -424,7 +424,7 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
         *  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;
        }
 
@@ -432,12 +432,12 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
        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;
@@ -446,13 +446,13 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
         * 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;
        }
@@ -463,14 +463,14 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
         *  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;
        }
 
@@ -480,7 +480,7 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
        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;
        }
 
index 0cfbcf3..3552007 100644 (file)
@@ -375,7 +375,7 @@ static int sqlippool_query1(char *out, int outlen, const char *fmt,
        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
@@ -425,13 +425,13 @@ static int mod_instantiate(CONF_SECTION *conf, void **instance)
        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;