Skip to content

Commit

Permalink
Use correct macros for log messages with WARNING: ERROR: DEBUG: embed…
Browse files Browse the repository at this point in the history
…ded in the format string
  • Loading branch information
arr2036 committed Apr 25, 2013
1 parent 40f3558 commit 1df671c
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 59 deletions.
4 changes: 2 additions & 2 deletions src/lib/radius.c
Expand Up @@ -1786,9 +1786,9 @@ int rad_encode(RADIUS_PACKET *packet, RADIUS_PACKET const *original,
*/
if (len == 0) {
if (last_len != 0) {
DEBUG("WARNING: Failed encoding attribute %s\n", last_name);
fr_strerror_printf("WARNING: Failed encoding attribute %s\n", last_name);
} else {
DEBUG("WARNING: Skipping zero-length attribute %s\n", last_name);
fr_strerror_printf("WARNING: Skipping zero-length attribute %s\n", last_name);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/auth.c
Expand Up @@ -550,7 +550,7 @@ int rad_authenticate(REQUEST *request)

size = fr_utf8_char(p);
if (!size) {
log_debug(" WARNING: Unprintable characters in the password. Double-check the shared secret on the server and the NAS!");
RWDEBUG("Unprintable characters in the password. Double-check the shared secret on the server and the NAS!");
break;
}
p += size;
Expand Down
3 changes: 1 addition & 2 deletions src/main/command.c
Expand Up @@ -1129,8 +1129,7 @@ static int null_socket_send(UNUSED rad_listen_t *listener, REQUEST *request)

output_file = request_data_reference(request, null_socket_send, 0);
if (!output_file) {
ERROR("WARNING: No output file for injected packet %d",
request->number);
ERROR("No output file for injected packet %d", request->number);
return 0;
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/connection.c
Expand Up @@ -733,8 +733,7 @@ static int fr_connection_manage(fr_connection_pool_t *pool,
do_delete:
if ((pool->num <= pool->min) &&
(pool->last_complained < now)) {
INFO("%s: WARNING: You probably need to "
"lower \"min\"", pool->log_prefix);
WARN("%s: You probably need to lower \"min\"", pool->log_prefix);

pool->last_complained = now;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/detail.c
Expand Up @@ -895,7 +895,8 @@ int detail_parse(CONF_SECTION *cs, rad_listen_t *this)
char *p;

#ifndef HAVE_GLOB_H
INFO("WARNING: Detail file \"%s\" appears to use file globbing, but it is not supported on this system.", data->filename);
WARN("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);
Expand Down
3 changes: 1 addition & 2 deletions src/main/modcall.c
Expand Up @@ -314,8 +314,7 @@ static int call_modsingle(int component, modsingle *sp, REQUEST *request)
*/
blocked = (request->master_state == REQUEST_STOP_PROCESSING);
if (blocked) {
INFO("WARNING: Module %s became unblocked for request %u",
sp->modinst->entry->name, request->number);
RWARN("Module %s became unblocked for request %u", sp->modinst->entry->name, request->number);
}

fail:
Expand Down
4 changes: 2 additions & 2 deletions src/main/modules.c
Expand Up @@ -502,7 +502,7 @@ module_instance_t *find_module_instance(CONF_SECTION *modules,
*/
cs = cf_section_sub_find_name2(modules, NULL, instname);
if (cs == NULL) {
ERROR("ERROR: Cannot find a configuration entry for module \"%s\".\n", instname);
ERROR("Cannot find a configuration entry for module \"%s\".\n", instname);
return NULL;
}

Expand Down Expand Up @@ -1418,7 +1418,7 @@ int setup_modules(int reload, CONF_SECTION *config)
*/
modules = cf_section_sub_find(config, "modules");
if (!modules) {
INFO("WARNING: Cannot find a \"modules\" section in the configuration file!");
WARN("Cannot find a \"modules\" section in the configuration file!");
}

DEBUG2("%s: #### Instantiating modules ####", mainconfig.name);
Expand Down
6 changes: 3 additions & 3 deletions src/main/process.c
Expand Up @@ -681,7 +681,7 @@ static void request_process_timer(REQUEST *request)
*/
if (spawn_flag &&
(pthread_equal(request->child_pid, NO_SUCH_CHILD_PID) == 0)) {
ERROR("WARNING: Unresponsive child for request %u, in component %s module %s",
ERROR("Unresponsive child for request %u, in component %s module %s",
request->number,
request->component ? request->component : "<server core>",
request->module ? request->module : "<server core>");
Expand Down Expand Up @@ -1309,8 +1309,8 @@ 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);
INFO("WARNING: Please check the configuration file.\n"
"\tThe value for 'max_requests' is probably set too low.\n");
WARN("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);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/main/realms.c
Expand Up @@ -1064,7 +1064,7 @@ static int server_pool_add(realm_config_t *rc,
}

if (0) {
DEBUG2("Warning: Duplicate home server %s in server pool %s", home->name, pool->name);
WDEBUG2("Duplicate home server %s in server pool %s", home->name, pool->name);
continue;
}

Expand Down
24 changes: 12 additions & 12 deletions src/main/tls.c
Expand Up @@ -1283,7 +1283,7 @@ static int ocsp_check(X509_STORE *store, X509 *issuer_cert, X509 *client_cert,
/* Send OCSP request and wait for response */
resp = OCSP_sendreq_bio(cbio, path, req);
if (!resp) {
ERROR("Error: Couldn't get OCSP response");
ERROR("Couldn't get OCSP response");
ocsp_ok = 2;
goto ocsp_end;
}
Expand All @@ -1293,14 +1293,14 @@ static int ocsp_check(X509_STORE *store, X509 *issuer_cert, X509 *client_cert,

rc = BIO_do_connect(cbio);
if ((rc <= 0) && ((!conf->ocsp_timeout) || !BIO_should_retry(cbio))) {
ERROR("Error: Couldn't connect to OCSP responder");
ERROR("Couldn't connect to OCSP responder");
ocsp_ok = 2;
goto ocsp_end;
}

ctx = OCSP_sendreq_new(cbio, path, req, -1);
if (!ctx) {
ERROR("Error: Couldn't send OCSP request");
ERROR("Couldn't send OCSP request");
ocsp_ok = 2;
goto ocsp_end;
}
Expand All @@ -1318,15 +1318,15 @@ static int ocsp_check(X509_STORE *store, X509 *issuer_cert, X509 *client_cert,
} while ((rc == -1) && BIO_should_retry(cbio));

if (conf->ocsp_timeout && (rc == -1) && BIO_should_retry(cbio)) {
ERROR("Error: OCSP response timed out");
ERROR("OCSP response timed out");
ocsp_ok = 2;
goto ocsp_end;
}

OCSP_REQ_CTX_free(ctx);

if (rc == 0) {
ERROR("Error: Couldn't get OCSP response");
ERROR("Couldn't get OCSP response");
ocsp_ok = 2;
goto ocsp_end;
}
Expand All @@ -1336,23 +1336,23 @@ static int ocsp_check(X509_STORE *store, X509 *issuer_cert, X509 *client_cert,
status = OCSP_response_status(resp);
DEBUG2("[ocsp] --> Response status: %s",OCSP_response_status_str(status));
if(status != OCSP_RESPONSE_STATUS_SUCCESSFUL) {
ERROR("Error: OCSP response status: %s", OCSP_response_status_str(status));
ERROR("OCSP response status: %s", OCSP_response_status_str(status));
goto ocsp_end;
}
bresp = OCSP_response_get1_basic(resp);
if(conf->ocsp_use_nonce && OCSP_check_nonce(req, bresp)!=1) {
ERROR("Error: OCSP response has wrong nonce value");
ERROR("OCSP response has wrong nonce value");
goto ocsp_end;
}
if(OCSP_basic_verify(bresp, NULL, store, 0)!=1){
ERROR("Error: Couldn't verify OCSP basic response");
ERROR("Couldn't verify OCSP basic response");
goto ocsp_end;
}

/* Verify OCSP cert status */
if(!OCSP_resp_find_status(bresp, certid, &status, &reason,
&rev, &thisupd, &nextupd)) {
ERROR("ERROR: No Status found.\n");
ERROR("No Status found.\n");
goto ocsp_end;
}

Expand Down Expand Up @@ -1697,7 +1697,7 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
if (my_ok && conf->ocsp_enable){
RDEBUG2("--> Starting OCSP Request");
if(X509_STORE_CTX_get1_issuer(&issuer_cert, ctx, client_cert)!=1) {
ERROR("Error: Couldn't get issuer_cert for %s", common_name);
ERROR("Couldn't get issuer_cert for %s", common_name);
}
my_ok = ocsp_check(ocsp_store, issuer_cert, client_cert, conf);
}
Expand Down Expand Up @@ -2258,7 +2258,7 @@ fr_tls_server_conf_t *tls_server_conf_parse(CONF_SECTION *cs)
*/
conf = cf_data_find(cs, "tls-conf");
if (conf) {
DEBUG(" debug: Using cached TLS configuration from previous invocation");
DEBUG("Using cached TLS configuration from previous invocation");
return conf;
}

Expand Down Expand Up @@ -2361,7 +2361,7 @@ fr_tls_server_conf_t *tls_client_conf_parse(CONF_SECTION *cs)

conf = cf_data_find(cs, "tls-conf");
if (conf) {
DEBUG(" debug: Using cached TLS configuration from previous invocation");
DEBUG("Using cached TLS configuration from previous invocation");
return conf;
}

Expand Down
6 changes: 3 additions & 3 deletions src/modules/proto_dhcp/dhcpd.c
Expand Up @@ -247,13 +247,13 @@ static int dhcprelay_process_server_reply(REQUEST *request)
#else /* WITH_UDPFROMTO */
static int dhcprelay_process_server_reply(UNUSED REQUEST *request)
{
DEBUG("WARNING: DHCP Relaying requires the server to be configured with UDPFROMTO");
WDEBUG("DHCP Relaying requires the server to be configured with UDPFROMTO");
return -1;
}

static int dhcprelay_process_client_request(UNUSED REQUEST *request)
{
DEBUG("WARNING: DHCP Relaying requires the server to be configured with UDPFROMTO");
WDEBUG("DHCP Relaying requires the server to be configured with UDPFROMTO");
return -1;
}

Expand Down Expand Up @@ -528,7 +528,7 @@ static int dhcp_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
sock = this->data;

if (!sock->interface) {
DEBUG("WARNING: No \"interface\" setting is defined. Only unicast DHCP will work.");
WDEBUG("No \"interface\" setting is defined. Only unicast DHCP will work.");
}

/*
Expand Down
6 changes: 3 additions & 3 deletions src/modules/rlm_eap/libeap/eap_tls.c
Expand Up @@ -946,7 +946,7 @@ fr_tls_server_conf_t *eaptls_conf_parse(CONF_SECTION *cs, char const *attr)
tls_cs = cf_section_sub_find_name2(parent, TLS_CONFIG_SECTION, tls_conf_name);

if (!tls_cs) {
ERROR("error: cannot find tls config '%s'", tls_conf_name);
ERROR("Cannot find tls config '%s'", tls_conf_name);
return NULL;
}
} else {
Expand Down Expand Up @@ -974,7 +974,7 @@ fr_tls_server_conf_t *eaptls_conf_parse(CONF_SECTION *cs, char const *attr)
* The EAP RFC's say 1020, but we're less picky.
*/
if (tls_conf->fragment_size < 100) {
ERROR("error: Fragment size is too small.");
ERROR("Fragment size is too small.");
return NULL;
}

Expand All @@ -985,7 +985,7 @@ fr_tls_server_conf_t *eaptls_conf_parse(CONF_SECTION *cs, char const *attr)
* that can be devoted *solely* to EAP.
*/
if (tls_conf->fragment_size > 4000) {
ERROR("error: Fragment size is too large.");
ERROR("Fragment size is too large.");
return NULL;
}

Expand Down
6 changes: 3 additions & 3 deletions src/modules/rlm_eap/libeap/mppe_keys.c
Expand Up @@ -113,7 +113,7 @@ void eaptls_gen_mppe_keys(REQUEST *request, SSL *s,
size_t prf_size;

if (!s->s3) {
RDEBUG("ERROR: No SSLv3 information");
EDEBUG("No SSLv3 information");
return;
}

Expand Down Expand Up @@ -157,7 +157,7 @@ void eapttls_gen_challenge(SSL *s, uint8_t *buffer, size_t size)
uint8_t *p = seed;

if (!s->s3) {
DEBUG("ERROR: No SSLv3 information");
EDEBUG("No SSLv3 information");
return;
}

Expand All @@ -182,7 +182,7 @@ void eaptls_gen_eap_key(RADIUS_PACKET *packet, SSL *s, uint32_t header)
VALUE_PAIR *vp;

if (!s->s3) {
DEBUG("ERROR: No SSLv3 information");
EDEBUG("No SSLv3 information");
return;
}

Expand Down
18 changes: 6 additions & 12 deletions src/modules/rlm_eap/mem.c
Expand Up @@ -451,24 +451,18 @@ int eaplist_add(rlm_eap_t *inst, eap_handler_t *handler)

if (last_logged < handler->timestamp) {
last_logged = handler->timestamp;
ERROR("rlm_eap (%s): Too many open "
"sessions. Try increasing "
"\"max_sessions\" in the EAP module "
"configuration", inst->xlat_name);
ERROR("rlm_eap (%s): Too many open sessions. Try increasing \"max_sessions\" "
"in the EAP module configuration", inst->xlat_name);
}
} else {
ERROR("rlm_eap (%s): Internal error: "
"failed to store handler", inst->xlat_name);
ERROR("rlm_eap (%s): Failed to store handler", inst->xlat_name);
}
return 0;
}

RDEBUG("New EAP session, adding 'State' attribute to reply "
"0x%02x%02x%02x%02x%02x%02x%02x%02x",
state->vp_octets[0], state->vp_octets[1],
state->vp_octets[2], state->vp_octets[3],
state->vp_octets[4], state->vp_octets[5],
state->vp_octets[6], state->vp_octets[7]);
RDEBUG("New EAP session, adding 'State' attribute to reply 0x%02x%02x%02x%02x%02x%02x%02x%02x",
state->vp_octets[0], state->vp_octets[1], state->vp_octets[2], state->vp_octets[3],
state->vp_octets[4], state->vp_octets[5], state->vp_octets[6], state->vp_octets[7]);

return 1;
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rlm_eap/types/rlm_eap_ikev2/rlm_eap_ikev2.c
Expand Up @@ -292,7 +292,7 @@ static int ikev2_initiate(void *instance, eap_handler_t *handler)
session = FindSessionByFastid(i2, (char const *)eap_username);
if(!session) {
if(IKEv2BeginSession( i2, &session, IKEv2_STY_INITIATOR ) != IKEv2_RET_OK) {
ERROR(IKEv2_LOG_PREFIX "Error: Can't initialize IKEv2 session.");
ERROR(IKEv2_LOG_PREFIX "Can't initialize IKEv2 session.");
return 1;
}
} else {
Expand All @@ -315,7 +315,7 @@ static int ikev2_initiate(void *instance, eap_handler_t *handler)
//ERROR("XXX scounter -> fastid=[%s]",ss->fastID);
ss=ss->pNext;
}
ERROR("XXX: session list contains:%d",session_count);
ERROR("Session list contains: %d",session_count);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/modules/rlm_eap2/rlm_eap2.c
Expand Up @@ -567,7 +567,7 @@ static int mod_instantiate(CONF_SECTION *cs, void *instance)
if (!auth_type) continue;

if (num_types >= EAP_MAX_METHODS) {
INFO("WARNING: Ignoring EAP type %s: too many types defined", auth_type);
WARN("Ignoring EAP type %s: too many types defined", auth_type);
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/rlm_perl/rlm_perl.c
Expand Up @@ -559,7 +559,7 @@ static int pairadd_sv(TALLOC_CTX *ctx, VALUE_PAIR **vps, char *key, SV *sv, FR_T
DEBUG("rlm_perl: Added pair %s = %s", key, val);
return 1;
} else {
DEBUG("rlm_perl: ERROR: Failed to create pair %s = %s", key, val);
EDEBUG("rlm_perl: Failed to create pair %s = %s", key, val);
}
}
return 0;
Expand Down
9 changes: 3 additions & 6 deletions src/modules/rlm_redis/rlm_redis.c
Expand Up @@ -232,8 +232,7 @@ int rlm_redis_query(REDISSOCK **dissocket_p, REDIS_INST *inst,
dissocket->reply = redisCommandArgv(dissocket->conn, argc, argv, NULL);

if (!dissocket->reply) {
ERROR("rlm_redis: (%s) REDIS error: %s",
inst->xlat_name, dissocket->conn->errstr);
RERROR("%s", dissocket->conn->errstr);

dissocket = fr_connection_reconnect(inst->pool, dissocket);
if (!dissocket) {
Expand All @@ -244,8 +243,7 @@ int rlm_redis_query(REDISSOCK **dissocket_p, REDIS_INST *inst,

dissocket->reply = redisCommand(dissocket->conn, query);
if (!dissocket->reply) {
ERROR("rlm_redis (%s): failed after re-connect",
inst->xlat_name);
RERROR("Failed after re-connect", inst->xlat_name);
fr_connection_del(inst->pool, dissocket);
goto error;
}
Expand All @@ -254,8 +252,7 @@ int rlm_redis_query(REDISSOCK **dissocket_p, REDIS_INST *inst,
}

if (dissocket->reply->type == REDIS_REPLY_ERROR) {
ERROR("rlm_redis (%s): query failed, %s",
inst->xlat_name, query);
RERROR("Query failed, %s", inst->xlat_name, query);
return -1;
}

Expand Down

0 comments on commit 1df671c

Please sign in to comment.