Replace all radlog/radlog_request calls with macros
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 25 Apr 2013 19:50:55 +0000 (15:50 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 25 Apr 2013 19:50:55 +0000 (15:50 -0400)
38 files changed:
src/main/auth.c
src/main/command.c
src/main/conffile.c
src/main/connection.c
src/main/detail.c
src/main/listen.c
src/main/log.c
src/main/mainconfig.c
src/main/modcall.c
src/main/modules.c
src/main/process.c
src/main/radiusd.c
src/main/tls.c
src/main/tls_listen.c
src/main/valuepair.c
src/main/version.c
src/modules/rlm_cram/rlm_cram.c
src/modules/rlm_detail/rlm_detail.c
src/modules/rlm_digest/rlm_digest.c
src/modules/rlm_eap/eap.c
src/modules/rlm_eap/libeap/eap_tls.c
src/modules/rlm_eap/rlm_eap.c
src/modules/rlm_eap/types/rlm_eap_ikev2/ike_conf.c
src/modules/rlm_eap/types/rlm_eap_ikev2/rlm_eap_ikev2.c
src/modules/rlm_eap2/rlm_eap2.c
src/modules/rlm_ldap/ldap.h
src/modules/rlm_ldap/rlm_ldap.c
src/modules/rlm_linelog/rlm_linelog.c
src/modules/rlm_mschap/rlm_mschap.c
src/modules/rlm_opendirectory/rlm_opendirectory.c
src/modules/rlm_otp/otp_pw_valid.c
src/modules/rlm_pam/rlm_pam.c
src/modules/rlm_radutmp/rlm_radutmp.c
src/modules/rlm_securid/rlm_securid.c
src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c
src/modules/rlm_sql/drivers/rlm_sql_unixodbc/rlm_sql_unixodbc.c
src/modules/rlm_sql/rlm_sql.c
src/modules/rlm_unix/rlm_unix.c

index 00a57b1..584ae98 100644 (file)
@@ -145,7 +145,7 @@ static int rad_authlog(char const *msg, REQUEST *request, int goodpass)
                *extra = '\0';
        }
 
-       radlog_request(L_AUTH, 0, request, "%s: [%s%s%s] (%s)%s",
+       RAUTH("%s: [%s%s%s] (%s)%s",
                       msg,
                       clean_username,
                       logit ? "/" : "",
@@ -200,7 +200,7 @@ static int rad_check_password(REQUEST *request)
         *      one found will actually be used.
         */
        if (( auth_type_count > 1) && (debug_flag)) {
-               radlog_request(L_ERR, 0, request, "Warning:  Found %d auth-types on request for user '%s'",
+               RERROR("Warning:  Found %d auth-types on request for user '%s'",
                        auth_type_count, request->username->vp_strvalue);
        }
 
index 811be12..cae8c65 100644 (file)
@@ -866,7 +866,7 @@ static int command_debug_condition(rad_listen_t *listener, int argc, char *argv[
        }
 
        if (fr_condition_tokenize(listener, argv[0], &debug_condition, &error) < 0) {
-               radlog(L_ERR, "Failed parsing condition '%s': %s", argv[0], error);
+               ERROR("Failed parsing condition '%s': %s", argv[0], error);
        }
 
        return 0;
index 7bc0a2b..4f8a6a5 100644 (file)
@@ -684,7 +684,7 @@ static char const *cf_expand_variables(char const *cf, int *lineno,
                        end = strchr(ptr, '}');
                        if (end == NULL) {
                                *p = '\0';
-                               radlog(L_INFO, "%s[%d]: Variable expansion missing }",
+                               INFO("%s[%d]: Variable expansion missing }",
                                       cf, *lineno);
                                return NULL;
                        }
@@ -744,7 +744,7 @@ static char const *cf_expand_variables(char const *cf, int *lineno,
                        end = strchr(ptr, '}');
                        if (end == NULL) {
                                *p = '\0';
-                               radlog(L_INFO, "%s[%d]: Environment variable expansion missing }",
+                               INFO("%s[%d]: Environment variable expansion missing }",
                                       cf, *lineno);
                                return NULL;
                        }
@@ -1795,7 +1795,7 @@ int cf_file_include(CONF_SECTION *cs, char const *filename)
        time_t          *mtime;
        CONF_DATA       *cd;
 
-       DEBUG2( "including configuration file %s", filename);
+       DEBUG2("including configuration file %s", filename);
 
        fp = fopen(filename, "r");
        if (!fp) {
index 297466e..2e6f105 100644 (file)
@@ -334,7 +334,7 @@ static fr_connection_t *fr_connection_spawn(fr_connection_pool_t *pool,
         */
        pthread_mutex_unlock(&pool->mutex);
 
-       radlog(L_INFO, "%s: Opening additional connection (%i)",
+       INFO("%s: Opening additional connection (%i)",
               pool->log_prefix, pool->count);
        
        this = rad_malloc(sizeof(*this));
@@ -407,7 +407,7 @@ int fr_connection_add(fr_connection_pool_t *pool, void *conn)
                        return 0;
                }
                
-               radlog(L_INFO, "%s: Opening connection successful (%i)",
+               INFO("%s: Opening connection successful (%i)",
                       pool->log_prefix, pool->count);
        }
 
@@ -527,7 +527,7 @@ int fr_connection_del(fr_connection_pool_t *pool, void *conn)
                pool->active--;
        }
 
-       radlog(L_INFO, "%s: Deleting connection (%i)", pool->log_prefix,
+       INFO("%s: Deleting connection (%i)", pool->log_prefix,
               this->number);
 
        fr_connection_close(pool, this);
@@ -558,7 +558,7 @@ void fr_connection_pool_delete(fr_connection_pool_t *pool)
        for (this = pool->head; this != NULL; this = next) {
                next = this->next;
                
-               radlog(L_INFO, "%s: Closing connection (%i)", pool->log_prefix,
+               INFO("%s: Closing connection (%i)", pool->log_prefix,
                       this->number);
                
                fr_connection_close(pool, this);
@@ -733,7 +733,7 @@ static int fr_connection_manage(fr_connection_pool_t *pool,
        do_delete:
                if ((pool->num <= pool->min) &&
                    (pool->last_complained < now)) {
-                       radlog(L_INFO, "%s: WARNING: You probably need to "
+                       INFO("%s: WARNING: You probably need to "
                               "lower \"min\"", pool->log_prefix);
                        
                        pool->last_complained = now;
@@ -751,7 +751,7 @@ static int fr_connection_manage(fr_connection_pool_t *pool,
 
        if ((pool->idle_timeout > 0) &&
            ((this->last_used + pool->idle_timeout) < now)) {
-               radlog(L_INFO, "%s: Closing connection (%i): Hit idle_timeout, "
+               INFO("%s: Closing connection (%i): Hit idle_timeout, "
                       "was idle for %u seconds", pool->log_prefix, this->number,
                       (int) (now - this->last_used));
                goto do_delete;
@@ -824,7 +824,7 @@ static int fr_connection_pool_check(fr_connection_pool_t *pool)
 
                rad_assert(idle != NULL);
                
-               radlog(L_INFO, "%s: Closing connection (%i): Too many "
+               INFO("%s: Closing connection (%i): Too many "
                       "free connections (%d > %d)", pool->log_prefix,
                       idle->number, spare, pool->spare);
                fr_connection_close(pool, idle);
index b9708c1..1da18f7 100644 (file)
@@ -410,7 +410,7 @@ int detail_recv(rad_listen_t *listener)
                                rad_assert(data->vps == NULL);
 
                                if (data->one_shot) {
-                                       radlog(L_INFO, "Finished reading \"one shot\" detail file - Exiting");
+                                       INFO("Finished reading \"one shot\" detail file - Exiting");
                                        radius_signal_self(RADIUS_SIGNAL_SELF_EXIT);
                                }
 
@@ -895,7 +895,7 @@ int detail_parse(CONF_SECTION *cs, rad_listen_t *this)
                char *p;
 
 #ifndef HAVE_GLOB_H
-               radlog(L_INFO, "WARNING: Detail file \"%s\" appears to use file globbing, but it is not supported on this system.", data->filename);
+               INFO("WARNING: Detail file \"%s\" appears to use file globbing, but it is not supported on this system.", data->filename);
 #endif
                strlcpy(buffer, data->filename, sizeof(buffer));
                p = strrchr(buffer, FR_DIR_SEP);
index 92a68e9..224ae21 100644 (file)
@@ -586,7 +586,7 @@ static int dual_tcp_accept(rad_listen_t *listener)
                /*
                 *      FIXME: Print client IP/port, and server IP/port.
                 */
-               radlog(L_INFO, "Ignoring new connection due to client max_connections (%d)", client->limit.max_connections);
+               INFO("Ignoring new connection due to client max_connections (%d)", client->limit.max_connections);
                close(newfd);
                return 0;
        }
@@ -597,7 +597,7 @@ static int dual_tcp_accept(rad_listen_t *listener)
                /*
                 *      FIXME: Print client IP/port, and server IP/port.
                 */
-               radlog(L_INFO, "Ignoring new connection due to socket max_connections");
+               INFO("Ignoring new connection due to socket max_connections");
                close(newfd);
                return 0;
        }
@@ -1183,7 +1183,7 @@ static int auth_socket_send(rad_listen_t *listener, REQUEST *request)
        
        if (rad_send(request->reply, request->packet,
                     request->client->secret) < 0) {
-               radlog_request(L_ERR, 0, request, "Failed sending reply: %s",
+               RERROR("Failed sending reply: %s",
                               fr_strerror());
                return -1;
        }
@@ -1223,7 +1223,7 @@ static int acct_socket_send(rad_listen_t *listener, REQUEST *request)
        
        if (rad_send(request->reply, request->packet,
                     request->client->secret) < 0) {
-               radlog_request(L_ERR, 0, request, "Failed sending reply: %s",
+               RERROR("Failed sending reply: %s",
                               fr_strerror());
                return -1;
        }
@@ -1245,7 +1245,7 @@ static int proxy_socket_send(rad_listen_t *listener, REQUEST *request)
 
        if (rad_send(request->proxy, NULL,
                     request->home_server->secret) < 0) {
-               radlog_request(L_ERR, 0, request, "Failed sending proxied request: %s",
+               RERROR("Failed sending proxied request: %s",
                               fr_strerror());
                return -1;
        }
@@ -1859,14 +1859,14 @@ static int client_socket_encode(UNUSED rad_listen_t *listener, REQUEST *request)
 
        if (rad_encode(request->reply, request->packet,
                       request->client->secret) < 0) {
-               radlog_request(L_ERR, 0, request, "Failed encoding packet: %s",
+               RERROR("Failed encoding packet: %s",
                               fr_strerror());
                return -1;
        }
 
        if (rad_sign(request->reply, request->packet,
                     request->client->secret) < 0) {
-               radlog_request(L_ERR, 0, request, "Failed signing packet: %s",
+               RERROR("Failed signing packet: %s",
                               fr_strerror());
                return -1;
        }
@@ -1890,13 +1890,13 @@ static int client_socket_decode(UNUSED rad_listen_t *listener, REQUEST *request)
 static int proxy_socket_encode(UNUSED rad_listen_t *listener, REQUEST *request)
 {
        if (rad_encode(request->proxy, NULL, request->home_server->secret) < 0) {
-               radlog_request(L_ERR, 0, request, "Failed encoding proxied packet: %s",
+               RERROR("Failed encoding proxied packet: %s",
                               fr_strerror());
                return -1;
        }
 
        if (rad_sign(request->proxy, NULL, request->home_server->secret) < 0) {
-               radlog_request(L_ERR, 0, request, "Failed signing proxied packet: %s",
+               RERROR("Failed signing proxied packet: %s",
                               fr_strerror());
                return -1;
        }
index 00dfe2e..49edd5a 100644 (file)
@@ -412,7 +412,7 @@ void radlog_request(int lvl, int priority, REQUEST *request, char const *msg, ..
 
 void log_talloc(char const *msg)
 {
-       radlog(L_INFO, "%s", msg);
+       INFO("%s", msg);
 }
 
 void log_talloc_report(TALLOC_CTX *ctx)
@@ -436,7 +436,7 @@ void log_talloc_report(TALLOC_CTX *ctx)
                talloc_report_full(NULL, fd);
        } else {
                do {
-                       radlog(L_INFO, "Context level %i", i++);
+                       INFO("Context level %i", i++);
                
                        talloc_report_full(ctx, fd);
                } while ((ctx = talloc_parent(ctx)) && (talloc_get_name(ctx) != null_ctx));  /* Stop before we hit NULL ctx */
index 88bebf9..94a24e2 100644 (file)
@@ -727,7 +727,7 @@ static int switch_users(CONF_SECTION *cs)
        fr_set_dumpable();
 
        if (allow_core_dumps) {
-               radlog(L_INFO, "Core dumps are enabled.");
+               INFO("Core dumps are enabled.");
        }
 
        return 1;
@@ -786,7 +786,7 @@ int read_mainconfig(int reload, bool strict)
 #endif
        cf_set_strict(strict);
 
-       radlog(L_INFO, "Starting - reading configuration files ...");
+       INFO("Starting - reading configuration files ...");
 
        /* Initialize the dictionary */
        if (!mainconfig.dictionary_dir) mainconfig.dictionary_dir = radius_dir;
@@ -1049,7 +1049,7 @@ void hup_mainconfig(void)
        CONF_SECTION *cs;
        char buffer[1024];
 
-       radlog(L_INFO, "HUP - Re-reading configuration files");
+       INFO("HUP - Re-reading configuration files");
 
        /* Read the configuration file */
        snprintf(buffer, sizeof(buffer), "%.200s/%.50s.conf",
@@ -1085,7 +1085,7 @@ void hup_mainconfig(void)
         */
        hup_logfile();
 
-       radlog(L_INFO, "HUP - loading modules");
+       INFO("HUP - loading modules");
 
        /*
         *      Prefer the new module configuration.
index 63b855c..c48cc26 100644 (file)
@@ -314,7 +314,7 @@ static int call_modsingle(int component, modsingle *sp, REQUEST *request)
         */
        blocked = (request->master_state == REQUEST_STOP_PROCESSING);
        if (blocked) {
-               radlog(L_INFO, "WARNING: Module %s became unblocked for request %u",
+               INFO("WARNING: Module %s became unblocked for request %u",
                       sp->modinst->entry->name, request->number);
        }
 
index ae5920b..5e5a22d 100644 (file)
@@ -1186,7 +1186,7 @@ static int load_byserver(CONF_SECTION *cs)
        }
 
        if (debug_flag == 0) {
-               radlog(L_INFO, "Loaded virtual server %s",
+               INFO("Loaded virtual server %s",
                       (name != NULL) ? name : "<default>");
        }
 
@@ -1311,7 +1311,7 @@ int module_hup_module(CONF_SECTION *cs, module_instance_t *node, time_t when)
                return 0;
        }
 
-       radlog(L_INFO, " Module: Reloaded module \"%s\"", node->name);
+       INFO(" Module: Reloaded module \"%s\"", node->name);
 
        module_instance_free_old(cs, node, when);
 
@@ -1418,7 +1418,7 @@ int setup_modules(int reload, CONF_SECTION *config)
         */
        modules = cf_section_sub_find(config, "modules");
        if (!modules) {
-               radlog(L_INFO, "WARNING: Cannot find a \"modules\" section in the configuration file!");
+               INFO("WARNING: Cannot find a \"modules\" section in the configuration file!");
        }
 
        DEBUG2("%s: #### Instantiating modules ####", mainconfig.name);
index 9559701..32ea293 100644 (file)
@@ -424,8 +424,7 @@ STATE_MACHINE_DECL(request_done)
                 */
                if (request->reply->data) break;
 
-               radlog_request(L_ERR, 0, request,
-                              "Received conflicting packet from "
+               RERROR("Received conflicting packet from "
                               "client %s port %d - ID: %d due to "
                               "unfinished request.  Giving up on old request.",
                               request->client->shortname,
@@ -1310,7 +1309,7 @@ int request_receive(rad_listen_t *listener, RADIUS_PACKET *packet,
                ERROR("Dropping request (%d is too many): from client %s port %d - ID: %d", count,
                       client->shortname,
                       packet->src_port, packet->id);
-               radlog(L_INFO, "WARNING: Please check the configuration file.\n"
+               INFO("WARNING: Please check the configuration file.\n"
                       "\tThe value for 'max_requests' is probably set too low.\n");
 
                exec_trigger(NULL, NULL, "server.max_requests", true);
@@ -1402,7 +1401,7 @@ int request_insert(rad_listen_t *listener, RADIUS_PACKET *packet,
         *      Remember the request in the list.
         */
        if (!fr_packet_list_insert(pl, &request->packet)) {
-               radlog_request(L_ERR, 0, request, "Failed to insert request in the list of live requests: discarding it");
+               RERROR("Failed to insert request in the list of live requests: discarding it");
                request_done(request, FR_ACTION_DONE);
                return 1;
        }
@@ -1741,7 +1740,7 @@ static int insert_into_proxy_hash(REQUEST *request)
        if (!fr_packet_list_insert(proxy_list, &request->proxy)) {
                fr_packet_list_id_free(proxy_list, request->proxy);
                PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
-               radlog_request(L_PROXY, 0, request, "Failed to insert entry into proxy list.");
+               RPROXY("Failed to insert entry into proxy list.");
                return 0;
        }
 
@@ -1883,7 +1882,7 @@ int request_proxy_reply(RADIUS_PACKET *packet)
 
        if (!proxy_p) {
                PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
-               radlog(L_PROXY, "No outstanding request was found for reply from host %s port %d - ID %d",
+               PROXY( "No outstanding request was found for reply from host %s port %d - ID %d",
                       inet_ntop(packet->src_ipaddr.af,
                                 &packet->src_ipaddr.ipaddr,
                                 buffer, sizeof(buffer)),
@@ -2352,7 +2351,7 @@ static int request_proxy(REQUEST *request, int retransmit)
         *      We're actually sending a proxied packet.  Do that now.
         */
        if (!request->in_proxy_hash && !insert_into_proxy_hash(request)) {
-               radlog_request(L_PROXY, 0, request, "Failed to insert initial packet into the proxy list.");
+               RPROXY("Failed to insert initial packet into the proxy list.");
                return -1;
        }
 
@@ -2426,7 +2425,7 @@ static int request_proxy_anew(REQUEST *request)
         *      Don't free the old Id (if any) on error.
         */
        if (!insert_into_proxy_hash(request)) {
-               radlog_request(L_PROXY, 0, request, "Failed to insert retransmission into the proxy list.");
+               RPROXY("Failed to insert retransmission into the proxy list.");
                goto post_proxy_fail;
        }
 
@@ -2499,7 +2498,7 @@ STATE_MACHINE_DECL(request_ping)
                rad_assert(request->in_proxy_hash);
 
                request->home_server->num_received_pings++;
-               radlog_request(L_PROXY, 0, request, "Received response to status check %d (%d in current sequence)",
+               RPROXY("Received response to status check %d (%d in current sequence)",
                       request->number, home->num_received_pings);
 
                /*
@@ -2537,7 +2536,7 @@ STATE_MACHINE_DECL(request_ping)
                
                fr_event_delete(el, &home->ev);
 
-               radlog_request(L_PROXY, 0, request, "Marking home server %s port %d alive",
+               RPROXY("Marking home server %s port %d alive",
                       inet_ntop(request->proxy->dst_ipaddr.af,
                                 &request->proxy->dst_ipaddr.ipaddr,
                                 buffer, sizeof(buffer)),
@@ -2658,7 +2657,7 @@ static void ping_home_server(void *ctx)
        rad_assert(request->proxy_listener == NULL);
 
        if (!insert_into_proxy_hash(request)) {
-               radlog_request(L_PROXY, 0, request, "Failed to insert status check %d into proxy list.  Discarding it.",
+               RPROXY("Failed to insert status check %d into proxy list.  Discarding it.",
                       request->number);
 
                rad_assert(!request->in_request_hash);
@@ -2745,7 +2744,7 @@ static void mark_home_server_zombie(home_server *home)
        home->num_sent_pings = 0;
        home->num_received_pings = 0;
        
-       radlog(L_PROXY, "Marking home server %s port %d as zombie (it has not responded in %d seconds).",
+       PROXY( "Marking home server %s port %d as zombie (it has not responded in %d seconds).",
               inet_ntop(home->ipaddr.af, &home->ipaddr.ipaddr,
                         buffer, sizeof(buffer)),
               home->port, home->response_window);
@@ -2773,7 +2772,7 @@ void revive_home_server(void *ctx)
         */
        if (home->ev) fr_event_delete(el, &home->ev);
 
-       radlog(L_PROXY, "Marking home server %s port %d alive again... we have no idea if it really is alive or not.",
+       PROXY( "Marking home server %s port %d alive again... we have no idea if it really is alive or not.",
               inet_ntop(home->ipaddr.af, &home->ipaddr.ipaddr,
                         buffer, sizeof(buffer)),
               home->port);
@@ -2791,7 +2790,7 @@ void mark_home_server_dead(home_server *home, struct timeval *when)
        }
 #endif
 
-       radlog(L_PROXY, "Marking home server %s port %d as dead.",
+       PROXY( "Marking home server %s port %d as dead.",
               inet_ntop(home->ipaddr.af, &home->ipaddr.ipaddr,
                         buffer, sizeof(buffer)),
               home->port);
@@ -2960,7 +2959,7 @@ STATE_MACHINE_DECL(proxy_wait_for_reply)
                 *      may have failed over to another home server.
                 *      But that one may be dead, too.
                 */
-               radlog_request(L_ERR, 0, request, "Failing request due to lack of any response from home server %s port %d",
+               RERROR("Failing request due to lack of any response from home server %s port %d",
                               inet_ntop(request->proxy->dst_ipaddr.af,
                                         &request->proxy->dst_ipaddr.ipaddr,
                                         buffer, sizeof(buffer)),
@@ -3491,14 +3490,14 @@ static void event_status(struct timeval *wake)
 
        if (debug_flag == 0) {
                if (just_started) {
-                       radlog(L_INFO, "Ready to process requests.");
+                       INFO("Ready to process requests.");
                        just_started = false;
                }
                return;
        }
 
        if (!wake) {
-               radlog(L_INFO, "Ready to process requests.");
+               INFO("Ready to process requests.");
 
        } else if ((wake->tv_sec != 0) ||
                   (wake->tv_usec >= 100000)) {
@@ -3541,7 +3540,7 @@ int event_new_fd(rad_listen_t *this)
                if (just_started) {
                        DEBUG("Listening on %s", buffer);
                } else {
-                       radlog(L_INFO, " ... adding new socket %s", buffer);
+                       INFO(" ... adding new socket %s", buffer);
                }
 
 #ifdef WITH_PROXY
@@ -3828,7 +3827,7 @@ finish:
                listen_socket_t *sock = this->data;
 
                rad_assert(this->count == 0);
-               radlog(L_INFO, " ... closing socket %s", buffer);
+               INFO(" ... closing socket %s", buffer);
 
                /*
                 *      Remove it from the list of live FD's.  Note
@@ -3885,10 +3884,10 @@ static void handle_signal_self(int flag)
 {
        if ((flag & (RADIUS_SIGNAL_SELF_EXIT | RADIUS_SIGNAL_SELF_TERM)) != 0) {
                if ((flag & RADIUS_SIGNAL_SELF_EXIT) != 0) {
-                       radlog(L_INFO, "Signalled to exit");
+                       INFO("Signalled to exit");
                        fr_event_loop_exit(el, 1);
                } else {
-                       radlog(L_INFO, "Signalled to terminate");
+                       INFO("Signalled to terminate");
                        exec_trigger(NULL, NULL, "server.signal.term", true);
                        fr_event_loop_exit(el, 2);
                }
@@ -3905,11 +3904,11 @@ static void handle_signal_self(int flag)
 
                when = time(NULL);
                if ((int) (when - last_hup) < 5) {
-                       radlog(L_INFO, "Ignoring HUP (less than 5s since last one)");
+                       INFO("Ignoring HUP (less than 5s since last one)");
                        return;
                }
 
-               radlog(L_INFO, "Received HUP signal.");
+               INFO("Received HUP signal.");
 
                last_hup = when;
 
index 73232bb..59c85f7 100644 (file)
@@ -477,7 +477,7 @@ int main(int argc, char *argv[])
                       fr_strerror());
                rcode = 2;
        } else {
-               radlog(L_INFO, "Exiting normally.");
+               INFO("Exiting normally.");
        }
 
        exec_trigger(NULL, NULL, "server.stop", false);
@@ -528,7 +528,7 @@ int main(int argc, char *argv[])
 #endif
 
        if (memory_report) {
-               radlog(L_INFO, "Allocated memory at time of report:");
+               INFO("Allocated memory at time of report:");
                log_talloc_report(NULL);
        }
 
index 8060e99..02e7a3e 100644 (file)
@@ -1671,7 +1671,7 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
                 */
                if (conf->check_cert_issuer &&
                    (strcmp(issuer, conf->check_cert_issuer) != 0)) {
-                       radlog(L_AUTH, "rlm_eap_tls: Certificate issuer (%s) does not match specified value (%s)!", issuer, conf->check_cert_issuer);
+                       AUTH("rlm_eap_tls: Certificate issuer (%s) does not match specified value (%s)!", issuer, conf->check_cert_issuer);
                        my_ok = 0;
                }
 
@@ -1687,7 +1687,7 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
                        } else {
                                RDEBUG2("checking certificate CN (%s) with xlat'ed value (%s)", common_name, cn_str);
                                if (strcmp(cn_str, common_name) != 0) {
-                                       radlog(L_AUTH, "rlm_eap_tls: Certificate CN (%s) does not match specified value (%s)!", common_name, cn_str);
+                                       AUTH("rlm_eap_tls: Certificate CN (%s) does not match specified value (%s)!", common_name, cn_str);
                                        my_ok = 0;
                                }
                        }
@@ -1744,7 +1744,7 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
                                                request, 1, NULL, 0,
                                                request->packet->vps,
                                                NULL, 1) != 0) {
-                               radlog(L_AUTH, "rlm_eap_tls: Certificate CN (%s) fails external verification!", common_name);
+                               AUTH("rlm_eap_tls: Certificate CN (%s) fails external verification!", common_name);
                                my_ok = 0;
                        } else {
                                RDEBUG("Client certificate CN %s passed external validation", common_name);
@@ -2660,7 +2660,7 @@ fr_tls_status_t tls_ack_handler(tls_session_t *ssn, REQUEST *request)
        RDEBUG2("Received TLS ACK");
 
        if (ssn == NULL){
-               radlog_request(L_ERR, 0, request, "FAIL: Unexpected ACK received.  Could not obtain session information.");
+               RERROR("FAIL: Unexpected ACK received.  Could not obtain session information.");
                return FR_TLS_INVALID;
        }
        if (ssn->info.initialized == 0) {
@@ -2669,7 +2669,7 @@ fr_tls_status_t tls_ack_handler(tls_session_t *ssn, REQUEST *request)
        }
        if ((ssn->info.content_type == handshake) &&
            (ssn->info.origin == 0)) {
-               radlog_request(L_ERR, 0, request, "FAIL: ACK without earlier message.");
+               RERROR("FAIL: ACK without earlier message.");
                return FR_TLS_INVALID;
        }
 
@@ -2706,7 +2706,7 @@ fr_tls_status_t tls_ack_handler(tls_session_t *ssn, REQUEST *request)
                 */
        default:
                RDEBUG2("ACK default");
-               radlog_request(L_ERR, 0, request, "Invalid ACK received: %d",
+               RERROR("Invalid ACK received: %d",
                       ssn->info.content_type);
                return FR_TLS_INVALID;
        }
index d01eb3c..e909565 100644 (file)
@@ -518,8 +518,7 @@ redo:
               (unsigned int) length);
 
        if (length > sock->ssn->offset) {
-               radlog(L_INFO,
-                      "Received packet will be too large! Set \"fragment_size=%u\"",
+               INFO("Received packet will be too large! Set \"fragment_size=%u\"",
                       (data[2] << 8) | data[3]);
                goto do_close;
        }
index 4507f17..2bf519b 100644 (file)
@@ -582,7 +582,7 @@ int paircompare(REQUEST *request, VALUE_PAIR *req_list, VALUE_PAIR *check,
                switch (check_item->op) {
                        case T_OP_EQ:
                        default:
-                               radlog(L_INFO, "Invalid operator for item %s: "
+                               INFO("Invalid operator for item %s: "
                                       "reverting to '=='", check_item->da->name);
                                /* FALL-THROUGH */
                        case T_OP_CMP_TRUE:
index 27a8dea..4312acc 100644 (file)
@@ -83,7 +83,7 @@ char const *ssl_version()
  */
 void version(void)
 {
-       radlog(L_INFO, "%s: %s", progname, radiusd_version);
+       INFO("%s: %s", progname, radiusd_version);
        
        DEBUG3("Server was built with: ");
                
@@ -152,12 +152,12 @@ void version(void)
        DEBUG3("  ssl    : %s", ssl_version());
 
 
-       radlog(L_INFO, "Copyright (C) 1999-2013 The FreeRADIUS server project and contributors.");
-       radlog(L_INFO, "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A");
-       radlog(L_INFO, "PARTICULAR PURPOSE.");
-       radlog(L_INFO, "You may redistribute copies of FreeRADIUS under the terms of the");
-       radlog(L_INFO, "GNU General Public License.");
-       radlog(L_INFO, "For more information about these matters, see the file named COPYRIGHT.");
+       INFO("Copyright (C) 1999-2013 The FreeRADIUS server project and contributors.");
+       INFO("There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A");
+       INFO("PARTICULAR PURPOSE.");
+       INFO("You may redistribute copies of FreeRADIUS under the terms of the");
+       INFO("GNU General Public License.");
+       INFO("For more information about these matters, see the file named COPYRIGHT.");
        
        fflush(NULL);
 }
index d0a86e9..e389bfb 100644 (file)
@@ -127,28 +127,28 @@ static rlm_rcode_t mod_authenticate(UNUSED void * instance, REQUEST *request)
 
        password = pairfind(request->config_items, PW_CLEARTEXT_PASSWORD, 0, TAG_ANY);
        if(!password) {
-               radlog(L_AUTH, "rlm_cram: Cleartext-Password is required for authentication.");
+               AUTH("rlm_cram: Cleartext-Password is required for authentication.");
                return RLM_MODULE_INVALID;
        }
        authtype = pairfind(request->packet->vps, SM_AUTHTYPE, VENDORPEC_SM, TAG_ANY);
        if(!authtype) {
-               radlog(L_AUTH, "rlm_cram: Required attribute Sandy-Mail-Authtype missed");
+               AUTH("rlm_cram: Required attribute Sandy-Mail-Authtype missed");
                return RLM_MODULE_INVALID;
        }
        challenge = pairfind(request->packet->vps, SM_CHALLENGE, VENDORPEC_SM, TAG_ANY);
        if(!challenge) {
-               radlog(L_AUTH, "rlm_cram: Required attribute Sandy-Mail-Challenge missed");
+               AUTH("rlm_cram: Required attribute Sandy-Mail-Challenge missed");
                return RLM_MODULE_INVALID;
        }
        response = pairfind(request->packet->vps, SM_RESPONSE, VENDORPEC_SM, TAG_ANY);
        if(!response) {
-               radlog(L_AUTH, "rlm_cram: Required attribute Sandy-Mail-Response missed");
+               AUTH("rlm_cram: Required attribute Sandy-Mail-Response missed");
                return RLM_MODULE_INVALID;
        }
        switch(authtype->vp_integer){
                case 2:                         /*      CRAM-MD5        */
                        if(challenge->length < 5 || response->length != 16) {
-                               radlog(L_AUTH, "rlm_cram: invalid MD5 challenge/response length");
+                               AUTH("rlm_cram: invalid MD5 challenge/response length");
                                return RLM_MODULE_INVALID;
                        }
                        calc_md5_digest(buffer, challenge->vp_octets, challenge->length, password->vp_strvalue);
@@ -156,7 +156,7 @@ static rlm_rcode_t mod_authenticate(UNUSED void * instance, REQUEST *request)
                        break;
                case 3:                         /*      APOP    */
                        if(challenge->length < 5 || response->length != 16) {
-                               radlog(L_AUTH, "rlm_cram: invalid APOP challenge/response length");
+                               AUTH("rlm_cram: invalid APOP challenge/response length");
                                return RLM_MODULE_INVALID;
                        }
                        calc_apop_digest(buffer, challenge->vp_octets, challenge->length, password->vp_strvalue);
@@ -164,7 +164,7 @@ static rlm_rcode_t mod_authenticate(UNUSED void * instance, REQUEST *request)
                        break;
                case 8:                         /*      CRAM-MD4        */
                        if(challenge->length < 5 || response->length != 16) {
-                               radlog(L_AUTH, "rlm_cram: invalid MD4 challenge/response length");
+                               AUTH("rlm_cram: invalid MD4 challenge/response length");
                                return RLM_MODULE_INVALID;
                        }
                        calc_md4_digest(buffer, challenge->vp_octets, challenge->length, password->vp_strvalue);
@@ -172,14 +172,14 @@ static rlm_rcode_t mod_authenticate(UNUSED void * instance, REQUEST *request)
                        break;
                case 9:                         /*      CRAM-SHA1       */
                        if(challenge->length < 5 || response->length != 20) {
-                               radlog(L_AUTH, "rlm_cram: invalid MD4 challenge/response length");
+                               AUTH("rlm_cram: invalid MD4 challenge/response length");
                                return RLM_MODULE_INVALID;
                        }
                        calc_sha1_digest(buffer, challenge->vp_octets, challenge->length, password->vp_strvalue);
                        if(!memcmp(buffer, response->vp_octets, 20)) return RLM_MODULE_OK;
                        break;
                default:
-                       radlog(L_AUTH, "rlm_cram: unsupported Sandy-Mail-Authtype");
+                       AUTH("rlm_cram: unsupported Sandy-Mail-Authtype");
                        return RLM_MODULE_INVALID;
        }
        return RLM_MODULE_NOTFOUND;
index b695384..c8ed893 100644 (file)
@@ -239,7 +239,7 @@ static rlm_rcode_t do_detail(void *instance, REQUEST *request, RADIUS_PACKET *pa
                 *      a directory that the server was using.
                 */
                if (rad_mkdir(buffer, inst->dirperm) < 0) {
-                       radlog_request(L_ERR, 0, request, "rlm_detail: Failed to create directory %s: %s", buffer, strerror(errno));
+                       RERROR("rlm_detail: Failed to create directory %s: %s", buffer, strerror(errno));
                        return RLM_MODULE_FAIL;
                }
                
@@ -255,7 +255,7 @@ static rlm_rcode_t do_detail(void *instance, REQUEST *request, RADIUS_PACKET *pa
                 */
                if ((outfd = open(buffer, O_WRONLY | O_APPEND | O_CREAT,
                                  inst->detailperm)) < 0) {
-                       radlog_request(L_ERR, 0, request, "rlm_detail: Couldn't open file %s: %s",
+                       RERROR("rlm_detail: Couldn't open file %s: %s",
                               buffer, strerror(errno));
                        return RLM_MODULE_FAIL;
                }
@@ -281,7 +281,7 @@ static rlm_rcode_t do_detail(void *instance, REQUEST *request, RADIUS_PACKET *pa
                         *      the lock (race condition)
                         */
                        if (fstat(outfd, &st) != 0) {
-                               radlog_request(L_ERR, 0, request, "rlm_detail: Couldn't stat file %s: %s",
+                               RERROR("rlm_detail: Couldn't stat file %s: %s",
                                       buffer, strerror(errno));
                                close(outfd);
                                return RLM_MODULE_FAIL;
@@ -302,7 +302,7 @@ static rlm_rcode_t do_detail(void *instance, REQUEST *request, RADIUS_PACKET *pa
 
        if (inst->locking && !locked) {
                close(outfd);
-               radlog_request(L_ERR, 0, request, "rlm_detail: Failed to acquire filelock for %s, giving up",
+               RERROR("rlm_detail: Failed to acquire filelock for %s, giving up",
                       buffer);
                return RLM_MODULE_FAIL;
        }
@@ -333,7 +333,7 @@ static rlm_rcode_t do_detail(void *instance, REQUEST *request, RADIUS_PACKET *pa
         */
        fsize = lseek(outfd, 0L, SEEK_END);
        if (fsize < 0) {
-               radlog_request(L_ERR, 0, request, "rlm_detail: Failed to seek to the end of detail file %s",
+               RERROR("rlm_detail: Failed to seek to the end of detail file %s",
                        buffer);
                close(outfd);
                return RLM_MODULE_FAIL;
@@ -348,7 +348,7 @@ static rlm_rcode_t do_detail(void *instance, REQUEST *request, RADIUS_PACKET *pa
         *      Open the FP for buffering.
         */
        if ((fp = fdopen(outfd, "a")) == NULL) {
-               radlog_request(L_ERR, 0, request, "rlm_detail: Couldn't open file %s: %s",
+               RERROR("rlm_detail: Couldn't open file %s: %s",
                               buffer, strerror(errno));
                close(outfd);
                return RLM_MODULE_FAIL;
index 6f93cf7..f6c282b 100644 (file)
@@ -223,14 +223,14 @@ static rlm_rcode_t mod_authenticate(UNUSED void *instance, REQUEST *request)
        passwd = pairfind(request->config_items, PW_DIGEST_HA1, 0, TAG_ANY);
        if (passwd) {
                if (passwd->length != 32) {
-                       radlog_request(L_AUTH, 0, request, "Digest-HA1 has invalid length, authentication failed.");
+                       RAUTH("Digest-HA1 has invalid length, authentication failed.");
                        return RLM_MODULE_INVALID;
                }
        } else {
                passwd = pairfind(request->config_items, PW_CLEARTEXT_PASSWORD, 0, TAG_ANY);
        }
        if (!passwd) {
-               radlog_request(L_AUTH, 0, request, "Cleartext-Password or Digest-HA1 is required for authentication.");
+               RAUTH("Cleartext-Password or Digest-HA1 is required for authentication.");
                return RLM_MODULE_INVALID;
        }
 
index 11d8e03..f13d1ae 100644 (file)
@@ -931,14 +931,13 @@ static int eap_validation(REQUEST *request, eap_packet_raw_t *eap_packet)
            (eap_packet->data[0] <= 0) ||
            (eap_packet->data[0] >= PW_EAP_MAX_TYPES)) {
 
-               radlog_request(L_AUTH, 0, request,
-                              "Badly formatted EAP Message: Ignoring the packet");
+               RAUTH("Badly formatted EAP Message: Ignoring the packet");
                return EAP_INVALID;
        }
 
        /* we don't expect notification, but we send it */
        if (eap_packet->data[0] == PW_EAP_NOTIFICATION) {
-               radlog_request(L_AUTH, 0, request, "Got NOTIFICATION, "
+               RAUTH("Got NOTIFICATION, "
                               "Ignoring the packet");
                return EAP_INVALID;
        }
index 8427d33..4697e58 100644 (file)
@@ -354,7 +354,7 @@ static fr_tls_status_t eaptls_verify(eap_handler_t *handler)
                        RDEBUG2("Received TLS ACK");
                        return tls_ack_handler(handler->opaque, request);
                } else {
-                       radlog_request(L_ERR, 0, request, "Received Invalid TLS ACK");
+                       RERROR("Received Invalid TLS ACK");
                        return FR_TLS_INVALID;
                }
        }
@@ -958,7 +958,7 @@ fr_tls_server_conf_t *eaptls_conf_parse(CONF_SECTION *cs, char const *attr)
                 *      We don't fall back if the 'attr' is specified, but we can't
                 *      find the section - that is just a config error.
                 */
-               radlog(L_INFO, "debug: '%s' option missing, trying to use legacy configuration", attr);
+               INFO("debug: '%s' option missing, trying to use legacy configuration", attr);
                tls_cs = cf_section_sub_find(parent, "tls");
        }
 
index 7f2ec9c..a8dbbcc 100644 (file)
@@ -280,7 +280,7 @@ static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request)
         */
        eap_packet = eap_vp2packet(request, request->packet->vps);
        if (!eap_packet) {
-               radlog_request(L_ERR, 0, request, "Malformed EAP Message");
+               RERROR("Malformed EAP Message");
                return RLM_MODULE_FAIL;
        }
 
@@ -569,7 +569,7 @@ static rlm_rcode_t mod_post_proxy(void *inst, REQUEST *request)
                                                              request->proxy,
                                                              REQUEST_DATA_EAP_TUNNEL_CALLBACK);
                if (!data) {
-                       radlog_request(L_ERR, 0, request, "Failed to retrieve callback for tunneled session!");
+                       RERROR("Failed to retrieve callback for tunneled session!");
                        eap_handler_free(inst, handler);
                        return RLM_MODULE_FAIL;
                }
@@ -725,7 +725,7 @@ static rlm_rcode_t mod_post_auth(void *instance, REQUEST *request)
        
        eap_packet = eap_vp2packet(request, request->packet->vps);
        if (!eap_packet) {
-               radlog_request(L_ERR, 0, request, "Malformed EAP Message");
+               RERROR("Malformed EAP Message");
                return RLM_MODULE_FAIL;
        }
 
index a715dea..5a0520e 100644 (file)
@@ -405,8 +405,8 @@ int rad_get_authtype(char* authtype_name)
        DEBUG(IKEv2_LOG_PREFIX "Using server auth type: secret");
        return IKEv2_AUTH_SK;
        }
-       radlog(L_AUTH,IKEv2_LOG_PREFIX "Unsupported server auth type: %s",authtype_name);
-       radlog(L_AUTH,IKEv2_LOG_PREFIX "Using server auth type: secret (default)");
+       AUTH(IKEv2_LOG_PREFIX "Unsupported server auth type: %s",authtype_name);
+       AUTH(IKEv2_LOG_PREFIX "Using server auth type: secret (default)");
        return IKEv2_AUTH_SK;
 }
 
index 3c70dc1..ed08aa7 100644 (file)
@@ -58,7 +58,7 @@ static int set_mppe_keys(eap_handler_t *handler)
        session = ((struct IKEv2Data*)handler->opaque)->session;
 
        if (session->eapKeyData==NULL){
-               radlog( L_INFO,IKEv2_LOG_PREFIX "Key session not available!!!");
+               INFO(IKEv2_LOG_PREFIX "Key session not available!!!");
                return 1;
        }
 
@@ -224,7 +224,7 @@ static int ikev2_attach(CONF_SECTION *conf, void **instance)
            break;
     }
     if(!i2->trusted) {
-       radlog(L_AUTH,IKEv2_LOG_PREFIX "'CA_file' item not set, client cert based authentication will fail");
+       AUTH(IKEv2_LOG_PREFIX "'CA_file' item not set, client cert based authentication will fail");
     } else {
        if(!file_exists(i2->trusted)) {
            ERROR(IKEv2_LOG_PREFIX "Can not open 'CA_file' %s",i2->trusted);
@@ -273,7 +273,7 @@ static int ikev2_attach(CONF_SECTION *conf, void **instance)
 
 static int ikev2_initiate(void *instance, eap_handler_t *handler)
 {
-    radlog( L_INFO,IKEv2_LOG_PREFIX "Initiate connection!");
+    INFO(IKEv2_LOG_PREFIX "Initiate connection!");
 // This is the way for silent discarding behavior
 //    handler->request->options|=RAD_REQUEST_OPTION_FAKE_REQUEST;
 //    handler->request->options|=RAD_REQUEST_OPTION_DONT_CACHE;
@@ -367,7 +367,7 @@ static int ikev2_authenticate(void *instance, eap_handler_t *handler)
 {
 
        struct ikev2_ctx *i2=(struct ikev2_ctx*)instance;
-       radlog( L_INFO, IKEv2_LOG_PREFIX "authenticate" );
+       INFO(IKEv2_LOG_PREFIX "authenticate" );
 
        rad_assert(handler->request != NULL);
        rad_assert(handler->stage == AUTHENTICATE);
@@ -430,7 +430,7 @@ static int ikev2_authenticate(void *instance, eap_handler_t *handler)
        {
                if(ikemsg!=NULL) free (ikemsg);
                handler->eap_ds->request->code=PW_EAP_FAILURE;
-               radlog(L_INFO,IKEv2_LOG_PREFIX "Discarded packet");
+               INFO(IKEv2_LOG_PREFIX "Discarded packet");
                return 1;
        }
 
@@ -455,7 +455,7 @@ static int ikev2_authenticate(void *instance, eap_handler_t *handler)
 
        if( IKEv2ProcessMsg( i2, ikemsg, &sikemsg, &slen, session) != IKEv2_RET_OK )
        {
-               radlog(L_INFO, IKEv2_LOG_PREFIX "EAP_STATE_DISCARD");
+               INFO(IKEv2_LOG_PREFIX "EAP_STATE_DISCARD");
                //session->State = EAP_STATE_DISCARD;
                free(out);
                return 1;
@@ -473,12 +473,12 @@ static int ikev2_authenticate(void *instance, eap_handler_t *handler)
 
                if( session->Status == IKEv2_SST_FAILED )
                {
-                       radlog(L_INFO,IKEv2_LOG_PREFIX "FAILED");
+                       INFO(IKEv2_LOG_PREFIX "FAILED");
                        olen = CreateResultMessage( false, session, &out );
                }
                if( session->Status == IKEv2_SST_ESTABLISHED )
                {
-                       radlog(L_INFO,IKEv2_LOG_PREFIX "SUCCESS");
+                       INFO(IKEv2_LOG_PREFIX "SUCCESS");
                        olen = CreateResultMessage( true, session, &out );
                        session->fFastReconnect=i2->enableFastReconnect;
 
index ba96d17..a43251b 100644 (file)
@@ -567,7 +567,7 @@ static int mod_instantiate(CONF_SECTION *cs, void *instance)
                if (!auth_type)  continue;
 
                if (num_types >= EAP_MAX_METHODS) {
-                       radlog(L_INFO, "WARNING: Ignoring EAP type %s: too many types defined", auth_type);
+                       INFO("WARNING: Ignoring EAP type %s: too many types defined", auth_type);
                        continue;
                }
 
index 5bfcd78..f0dfcf6 100644 (file)
@@ -246,7 +246,7 @@ typedef enum {
  *     simplifies switching certain messages from the request log to
  *     the main log.
  */
-#define LDAP_INFO(fmt, ...) radlog(L_INFO, "rlm_ldap (%s): " fmt, inst->xlat_name, ##__VA_ARGS__)
+#define LDAP_INFO(fmt, ...) INFO("rlm_ldap (%s): " fmt, inst->xlat_name, ##__VA_ARGS__)
  
 #define LDAP_DBGW(fmt, ...) radlog(L_DBG_WARN, "rlm_ldap (%s): " fmt, inst->xlat_name, ##__VA_ARGS__)
 #define LDAP_DBGW_REQ(fmt, ...) do { if (request) {RWDEBUG(fmt, ##__VA_ARGS__);} else {LDAP_DBGW(fmt, ##__VA_ARGS__);}} while (0)
index a2bd079..8a42776 100644 (file)
@@ -426,7 +426,7 @@ static int parse_sub_section(ldap_instance_t *inst, CONF_SECTION *parent, ldap_a
        
        cs = cf_section_sub_find(parent, name);
        if (!cs) {
-               radlog(L_INFO, "rlm_ldap (%s): Couldn't find configuration for %s, will return NOOP for calls "
+               INFO("rlm_ldap (%s): Couldn't find configuration for %s, will return NOOP for calls "
                       "from this section", inst->xlat_name, name);
                
                return 0;
index cae29cf..4c6d670 100644 (file)
@@ -265,7 +265,7 @@ static rlm_rcode_t do_linelog(void *instance, REQUEST *request)
                if (p) {
                        *p = '\0';
                        if (rad_mkdir(buffer, 0700) < 0) {
-                               radlog_request(L_ERR, 0, request, "rlm_linelog: Failed to create directory %s: %s", buffer, strerror(errno));
+                               RERROR("rlm_linelog: Failed to create directory %s: %s", buffer, strerror(errno));
                                return RLM_MODULE_FAIL;
                        }
                        *p = '/';
index 54637d8..e0c9980 100644 (file)
@@ -220,7 +220,7 @@ static size_t mschap_xlat(void *instance, REQUEST *request,
                         *      Responses are 50 octets.
                         */
                        if (response->length < 50) {
-                               radlog_request(L_AUTH, 0, request, "MS-CHAP-Response has the wrong format.");
+                               RAUTH("MS-CHAP-Response has the wrong format.");
                                return 0;
                        }
 
@@ -1364,7 +1364,7 @@ static rlm_rcode_t mod_authenticate(void * instance, REQUEST *request)
                        lm_password->length = 16;
 
                } else {
-                       radlog_request(L_ERR, 0, request, "Invalid LM-Password");
+                       RERROR("Invalid LM-Password");
                        lm_password = NULL;
                }
 
@@ -1374,7 +1374,7 @@ static rlm_rcode_t mod_authenticate(void * instance, REQUEST *request)
        } else {                /* there is a configured Cleartext-Password */
                lm_password = pairmake_config("LM-Password", "", T_OP_EQ);
                if (!lm_password) {
-                       radlog_request(L_ERR, 0, request, "No memory");
+                       RERROR("No memory");
                } else {
                        smbdes_lmpwdhash(password->vp_strvalue,
                                         lm_password->vp_octets);
@@ -1395,7 +1395,7 @@ static rlm_rcode_t mod_authenticate(void * instance, REQUEST *request)
                        nt_password->length = 16;
 
                } else {
-                       radlog_request(L_ERR, 0, request, "Invalid NT-Password");
+                       RERROR("Invalid NT-Password");
                        nt_password = NULL;
                }
        } else if (!password) {
@@ -1404,7 +1404,7 @@ static rlm_rcode_t mod_authenticate(void * instance, REQUEST *request)
        } else {                /* there is a configured Cleartext-Password */
                nt_password = pairmake_config("NT-Password", "", T_OP_EQ);
                if (!nt_password) {
-                       radlog_request(L_ERR, 0, request, "No memory");
+                       RERROR("No memory");
                        return RLM_MODULE_FAIL;
                } else {
                        mschap_ntpwdhash(nt_password->vp_octets,
@@ -1560,7 +1560,7 @@ static rlm_rcode_t mod_authenticate(void * instance, REQUEST *request)
                 *      MS-CHAPv1 challenges are 8 octets.
                 */
                if (challenge->length < 8) {
-                       radlog_request(L_AUTH, 0, request, "MS-CHAP-Challenge has the wrong format.");
+                       RAUTH("MS-CHAP-Challenge has the wrong format.");
                        return RLM_MODULE_INVALID;
                }
 
@@ -1568,7 +1568,7 @@ static rlm_rcode_t mod_authenticate(void * instance, REQUEST *request)
                 *      Responses are 50 octets.
                 */
                if (response->length < 50) {
-                       radlog_request(L_AUTH, 0, request, "MS-CHAP-Response has the wrong format.");
+                       RAUTH("MS-CHAP-Response has the wrong format.");
                        return RLM_MODULE_INVALID;
                }
 
@@ -1607,7 +1607,7 @@ static rlm_rcode_t mod_authenticate(void * instance, REQUEST *request)
                 *      MS-CHAPv2 challenges are 16 octets.
                 */
                if (challenge->length < 16) {
-                       radlog_request(L_AUTH, 0, request, "MS-CHAP-Challenge has the wrong format.");
+                       RAUTH("MS-CHAP-Challenge has the wrong format.");
                        return RLM_MODULE_INVALID;
                }
 
@@ -1615,7 +1615,7 @@ static rlm_rcode_t mod_authenticate(void * instance, REQUEST *request)
                 *      Responses are 50 octets.
                 */
                if (response->length < 50) {
-                       radlog_request(L_AUTH, 0, request, "MS-CHAP-Response has the wrong format.");
+                       RAUTH("MS-CHAP-Response has the wrong format.");
                        return RLM_MODULE_INVALID;
                }
 
@@ -1624,7 +1624,7 @@ static rlm_rcode_t mod_authenticate(void * instance, REQUEST *request)
                 */
                username = pairfind(request->packet->vps, PW_USER_NAME, 0, TAG_ANY);
                if (!username) {
-                       radlog_request(L_AUTH, 0, request, "We require a User-Name for MS-CHAPv2");
+                       RAUTH("We require a User-Name for MS-CHAPv2");
                        return RLM_MODULE_INVALID;
                }
 
index bbf7c9a..a5ba500 100644 (file)
@@ -382,12 +382,12 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, REQUEST *request)
                        /* attempt to resolve the name */
                        groupdata = getgrnam(rad_client->community);
                        if (!groupdata) {
-                               radlog(L_AUTH, "rlm_opendirectory: The group \"%s\" does not exist on this system.", rad_client->community);
+                               AUTH("rlm_opendirectory: The group \"%s\" does not exist on this system.", rad_client->community);
                                return RLM_MODULE_FAIL;
                        }
                        err = mbr_gid_to_uuid(groupdata->gr_gid, guid_nasgroup);
                        if (err != 0) {
-                               radlog(L_AUTH, "rlm_opendirectory: The group \"%s\" does not have a GUID.", rad_client->community);
+                               AUTH("rlm_opendirectory: The group \"%s\" does not have a GUID.", rad_client->community);
                                return RLM_MODULE_FAIL;
                        }
                }
index 3b10626..76f97a7 100644 (file)
@@ -79,7 +79,7 @@ int otp_pw_valid(REQUEST *request, int pwe, char const *challenge,
        int             rc;
 
        if (request->username->length > OTP_MAX_USERNAME_LEN) {
-               radlog(L_AUTH, "rlm_otp: username [%s] too long", username);
+               AUTH("rlm_otp: username [%s] too long", username);
                return RLM_MODULE_REJECT;
        }
        
@@ -113,7 +113,7 @@ int otp_pw_valid(REQUEST *request, int pwe, char const *challenge,
        switch (otp_request.pwe.pwe) {
        case PWE_PAP:
                if (rvp->length >= sizeof(otp_request.pwe.u.pap.passcode)) {
-                       radlog(L_AUTH, "rlm_otp: passcode for [%s] too long",
+                       AUTH("rlm_otp: passcode for [%s] too long",
                               username);
                        
                        return RLM_MODULE_REJECT;
@@ -124,14 +124,14 @@ int otp_pw_valid(REQUEST *request, int pwe, char const *challenge,
 
        case PWE_CHAP:
                if (cvp->length > 16) {
-                       radlog(L_AUTH, "rlm_otp: CHAP challenge for [%s] "
+                       AUTH("rlm_otp: CHAP challenge for [%s] "
                               "too long", username);
                        
                        return RLM_MODULE_INVALID;
                }
                
                if (rvp->length != 17) {
-                       radlog(L_AUTH, "rlm_otp: CHAP response for [%s] "
+                       AUTH("rlm_otp: CHAP response for [%s] "
                              "wrong size", username);
                        
                        return RLM_MODULE_INVALID;
@@ -149,14 +149,14 @@ int otp_pw_valid(REQUEST *request, int pwe, char const *challenge,
 
        case PWE_MSCHAP:
                if (cvp->length != 8) {
-                       radlog(L_AUTH, "rlm_otp: MS-CHAP challenge for "
+                       AUTH("rlm_otp: MS-CHAP challenge for "
                               "[%s] wrong size", username);
                        
                        return RLM_MODULE_INVALID;
                }
                
                if (rvp->length != 50) {
-                       radlog(L_AUTH, "rlm_otp: MS-CHAP response for [%s] "
+                       AUTH("rlm_otp: MS-CHAP response for [%s] "
                               "wrong size", username);
                        
                        return RLM_MODULE_INVALID;
@@ -174,14 +174,14 @@ int otp_pw_valid(REQUEST *request, int pwe, char const *challenge,
 
        case PWE_MSCHAP2:
                if (cvp->length != 16) {
-                       (void) radlog(L_AUTH, "rlm_otp: MS-CHAP2 challenge for "
+                       AUTH("rlm_otp: MS-CHAP2 challenge for "
                                      "[%s] wrong size", username);
                                
                        return RLM_MODULE_INVALID;
                }
                
                if (rvp->length != 50) {
-                       radlog(L_AUTH, "rlm_otp: MS-CHAP2 response for [%s] "
+                       AUTH("rlm_otp: MS-CHAP2 response for [%s] "
                               "wrong size", username);
                        
                        return RLM_MODULE_INVALID;
@@ -265,7 +265,7 @@ static int otp_verify(rlm_otp_t const *opt,
 
        /* validate the reply */
        if (reply->version != 1) {
-               radlog(L_AUTH, "rlm_otp: otpd reply for [%s] invalid "
+               AUTH("rlm_otp: otpd reply for [%s] invalid "
                       "(version %d != 1)", request->username, reply->version);
        
                otp_putfd(fdp, 1);
@@ -273,7 +273,7 @@ static int otp_verify(rlm_otp_t const *opt,
        }
 
        if (reply->passcode[OTP_MAX_PASSCODE_LEN] != '\0') {
-               radlog(L_AUTH, "rlm_otp: otpd reply for [%s] invalid "
+               AUTH("rlm_otp: otpd reply for [%s] invalid "
                       "(passcode)", request->username);
        
                otp_putfd(fdp, 1);
index 940b9a1..f68f040 100644 (file)
@@ -202,7 +202,7 @@ static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request)
         *      a User-Name attribute.
         */
        if (!request->username) {
-               radlog(L_AUTH, "rlm_pam: Attribute \"User-Name\" is required for authentication.");
+               AUTH("rlm_pam: Attribute \"User-Name\" is required for authentication.");
                return RLM_MODULE_INVALID;
        }
 
@@ -211,7 +211,7 @@ static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request)
         *      a User-Password attribute.
         */
        if (!request->password) {
-               radlog(L_AUTH, "rlm_pam: Attribute \"User-Password\" is required for authentication.");
+               AUTH("rlm_pam: Attribute \"User-Password\" is required for authentication.");
                return RLM_MODULE_INVALID;
        }
 
@@ -220,7 +220,7 @@ static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request)
         *  and not anything else.
         */
        if (request->password->da->attr != PW_USER_PASSWORD) {
-               radlog(L_AUTH, "rlm_pam: Attribute \"User-Password\" is required for authentication.  Cannot use \"%s\".", request->password->da->name);
+               AUTH("rlm_pam: Attribute \"User-Password\" is required for authentication.  Cannot use \"%s\".", request->password->da->name);
                return RLM_MODULE_INVALID;
        }
 
index a9f11e2..f192df9 100644 (file)
@@ -207,7 +207,7 @@ static rlm_rcode_t mod_accounting(void *instance, REQUEST *request)
                if (check1 == 0 || check2 == 0) {
                        break;
                }
-               radlog(L_INFO, "rlm_radutmp: converting reboot records.");
+               INFO("rlm_radutmp: converting reboot records.");
                if (status == PW_STATUS_STOP)
                        status = PW_STATUS_ACCOUNTING_OFF;
                if (status == PW_STATUS_START)
@@ -429,7 +429,7 @@ static rlm_rcode_t mod_accounting(void *instance, REQUEST *request)
                if ((status == PW_STATUS_START) && strncmp(ut.session_id, u.session_id, sizeof(u.session_id)) == 0  &&
                    u.time >= ut.time) {
                        if (u.type == P_LOGIN) {
-                               radlog(L_INFO, "rlm_radutmp: Login entry for NAS %s port %u duplicate",
+                               INFO("rlm_radutmp: Login entry for NAS %s port %u duplicate",
                                       nas, u.nas_port);
                                r = -1;
                                break;
index eee7488..c39dd81 100644 (file)
@@ -209,11 +209,11 @@ static SECURID_AUTH_RC securidAuth(void *instance, REQUEST *request,
 
                        acm_ret = SD_Next(securid_session->sdiHandle, securid_pass);
                        if (acm_ret == ACM_OK) {
-                               radlog(L_INFO, "Next SecurID token accepted for [%s].", securid_session->identity);
+                               INFO("Next SecurID token accepted for [%s].", securid_session->identity);
                                rc = RC_SECURID_AUTH_SUCCESS;
 
                        } else {
-                               radlog(L_INFO, "SecurID: Next token rejected for [%s].", securid_session->identity);
+                               INFO("SecurID: Next token rejected for [%s].", securid_session->identity);
                                rc = RC_SECURID_AUTH_FAILURE;
                        }
 
@@ -300,7 +300,7 @@ static SECURID_AUTH_RC securidAuth(void *instance, REQUEST *request,
                                rc = RC_SECURID_AUTH_SUCCESS;
 
                        } else {
-                               radlog(L_INFO, "SecurID: New passcode rejected for [%s].", securid_session->identity);
+                               INFO("SecurID: New passcode rejected for [%s].", securid_session->identity);
                                rc = RC_SECURID_AUTH_FAILURE;
                        }
 
@@ -465,12 +465,12 @@ static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request)
         *      a User-Name attribute.
         */
        if (!request->username) {
-               radlog(L_AUTH, "rlm_securid: Attribute \"User-Name\" is required for authentication.");
+               AUTH("rlm_securid: Attribute \"User-Name\" is required for authentication.");
                return RLM_MODULE_INVALID;
        }
 
        if (!request->password) {
-               radlog_request(L_AUTH, 0, request, "Attribute \"Password\" is required for authentication.");
+               RAUTH("Attribute \"Password\" is required for authentication.");
                return RLM_MODULE_INVALID;
        }
 
@@ -478,7 +478,7 @@ static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request)
         *      Clear-text passwords are the only ones we support.
         */
        if (request->password->da->attr != PW_USER_PASSWORD) {
-               radlog_request(L_AUTH, 0, request, "Attribute \"User-Password\" is required for authentication. Cannot use \"%s\".", request->password->da->name);
+               RAUTH("Attribute \"User-Password\" is required for authentication. Cannot use \"%s\".", request->password->da->name);
                return RLM_MODULE_INVALID;
        }
 
index d5d39cd..ad88df2 100644 (file)
@@ -110,7 +110,7 @@ static int sql_loadfile(TALLOC_CTX *ctx, sqlite3 *db, char const *filename)
        sqlite3_stmt *statement;
        char const *z_tail;
 
-       radlog(L_INFO, "rlm_sql_sqlite: Executing SQL statements from file \"%s\"", filename);
+       INFO("rlm_sql_sqlite: Executing SQL statements from file \"%s\"", filename);
 
        f = fopen(filename, "r");
        if (!f) {
@@ -156,7 +156,7 @@ static int sql_loadfile(TALLOC_CTX *ctx, sqlite3 *db, char const *filename)
                        return -1;
                }
                
-               radlog(L_DBG, "rlm_sql_sqlite: Ignoring empty SQL file");
+               DEBUG("rlm_sql_sqlite: Ignoring empty SQL file");
                
                fclose(f);
                talloc_free(buffer);
@@ -238,7 +238,7 @@ static int mod_instantiate(CONF_SECTION *conf, rlm_sql_config_t *config)
                return -1;
        }
        
-       radlog(L_INFO, "rlm_sql_sqlite: SQLite library version: %s", sqlite3_libversion());
+       INFO("rlm_sql_sqlite: SQLite library version: %s", sqlite3_libversion());
        if (!driver->filename) {
                MEM(driver->filename = talloc_asprintf(driver, "%s/%s", radius_dir, config->sql_db));
        }
@@ -258,7 +258,7 @@ static int mod_instantiate(CONF_SECTION *conf, rlm_sql_config_t *config)
                char *buff;
                sqlite3 *db = NULL;
                
-               radlog(L_INFO, "rlm_sql_sqlite: Database doesn't exist, creating it and loading schema");
+               INFO("rlm_sql_sqlite: Database doesn't exist, creating it and loading schema");
                
                p = strrchr(driver->filename, '/');
                if (p) {
@@ -346,7 +346,7 @@ static sql_rcode_t sql_socket_init(rlm_sql_handle_t *handle, rlm_sql_config_t *c
        MEM(conn = handle->conn = talloc_zero(handle, rlm_sql_sqlite_conn_t));
        talloc_set_destructor((void *) conn, sql_socket_destructor);
 
-       radlog(L_INFO, "rlm_sql_sqlite: Opening SQLite database \"%s\"", driver->filename);
+       INFO("rlm_sql_sqlite: Opening SQLite database \"%s\"", driver->filename);
 
 #ifdef HAVE_SQLITE_V2_API      
        status = sqlite3_open_v2(driver->filename, &(conn->db), SQLITE_OPEN_READWRITE | SQLITE_OPEN_NOMUTEX, NULL);
index 8114042..8d6fb48 100644 (file)
@@ -396,7 +396,7 @@ static sql_rcode_t sql_state(long err_handle, rlm_sql_handle_t *handle, UNUSED r
                switch(state[1]) {
                /* SQLSTATE 01 class contains info and warning messages */
                case '1':
-                       radlog(L_INFO, "rlm_sql_unixodbc: %s %s\n", state, error);
+                       INFO("rlm_sql_unixodbc: %s %s\n", state, error);
                        /* FALL-THROUGH */
                case '0':               /* SQLSTATE 00 class means success */
                        res = 0;
index 3128577..9ee23aa 100644 (file)
@@ -733,7 +733,7 @@ static int parse_sub_section(CONF_SECTION *parent,
        
        cs = cf_section_sub_find(parent, name);
        if (!cs) {
-               radlog(L_INFO, "rlm_sql (%s): Couldn't find configuration for "
+               INFO("rlm_sql (%s): Couldn't find configuration for "
                       "%s, will return NOOP for calls from this section",
                       inst->config->xlat_name, name);
                
@@ -902,14 +902,14 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
                }
        }
 
-       radlog(L_INFO, "rlm_sql (%s): Driver %s (module %s) loaded and linked",
+       INFO("rlm_sql (%s): Driver %s (module %s) loaded and linked",
               inst->config->xlat_name, inst->config->sql_driver_name,
               inst->module->name);
 
        /*
         *      Initialise the connection pool for this instance
         */
-       radlog(L_INFO, "rlm_sql (%s): Attempting to connect to database \"%s\"",
+       INFO("rlm_sql (%s): Attempting to connect to database \"%s\"",
               inst->config->xlat_name, inst->config->sql_db);
        
        if (sql_socket_pool_init(inst) < 0) return -1;
index 4a6cd23..15aeac2 100644 (file)
@@ -166,7 +166,7 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, REQUEST *request)
         *      Check if account is locked.
         */
        if (pr_pw->uflg.fg_lock!=1) {
-               radlog(L_AUTH, "rlm_unix: [%s]: account locked", name);
+               AUTH("rlm_unix: [%s]: account locked", name);
                return RLM_MODULE_USERLOCK;
        }
 #else /* OSFC2 */
@@ -203,8 +203,7 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, REQUEST *request)
         *      Users with a particular shell are denied access
         */
        if (strcmp(pwd->pw_shell, DENY_SHELL) == 0) {
-               radlog_request(L_AUTH, 0, request,
-                              "rlm_unix: [%s]: invalid shell", name);
+               RAUTH("rlm_unix: [%s]: invalid shell", name);
                return RLM_MODULE_REJECT;
        }
 #endif
@@ -222,7 +221,7 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, REQUEST *request)
        }
        endusershell();
        if (!shell) {
-               radlog_request(L_AUTH, 0, request, "[%s]: invalid shell [%s]",
+               RAUTH("[%s]: invalid shell [%s]",
                       name, pwd->pw_shell);
                return RLM_MODULE_REJECT;
        }
@@ -235,7 +234,7 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, REQUEST *request)
         */
        if (spwd && spwd->sp_lstchg > 0 && spwd->sp_max >= 0 &&
            (request->timestamp / 86400) > (spwd->sp_lstchg + spwd->sp_max)) {
-               radlog_request(L_AUTH, 0, request, "[%s]: password has expired", name);
+               RAUTH("[%s]: password has expired", name);
                return RLM_MODULE_REJECT;
        }
        /*
@@ -243,7 +242,7 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, REQUEST *request)
         */
        if (spwd && spwd->sp_expire > 0 &&
            (request->timestamp / 86400) > spwd->sp_expire) {
-               radlog_request(L_AUTH, 0, request, "[%s]: account has expired", name);
+               RAUTH("[%s]: account has expired", name);
                return RLM_MODULE_REJECT;
        }
 #endif
@@ -254,7 +253,7 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, REQUEST *request)
         */
        if ((pwd->pw_expire > 0) &&
            (request->timestamp > pwd->pw_expire)) {
-               radlog_request(L_AUTH, 0, request, "[%s]: password has expired", name);
+               RAUTH("[%s]: password has expired", name);
                return RLM_MODULE_REJECT;
        }
 #endif