#define L_ERR 4
#define L_PROXY 5
#define L_ACCT 6
-#define L_CONS 128
/* for paircompare_register */
typedef int (*RAD_COMPARE_FUNC)(void *instance, REQUEST *,VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR **);
}
if ((stat_buf.st_mode & S_IWOTH) != 0) {
- radlog(L_ERR|L_CONS, "%s[%d]: Directory %s is globally writable. Refusing to start due to insecure configuration.",
+ radlog(L_ERR, "%s[%d]: Directory %s is globally writable. Refusing to start due to insecure configuration.",
filename, *lineno, value);
return -1;
}
fp = fopen(filename, "r");
if (!fp) {
- radlog(L_ERR|L_CONS, "Unable to open file \"%s\": %s",
+ radlog(L_ERR, "Unable to open file \"%s\": %s",
filename, strerror(errno));
return -1;
}
#ifdef S_IWOTH
if ((statbuf.st_mode & S_IWOTH) != 0) {
fclose(fp);
- radlog(L_ERR|L_CONS, "Configuration file %s is globally writable. Refusing to start due to insecure configuration.",
+ radlog(L_ERR, "Configuration file %s is globally writable. Refusing to start due to insecure configuration.",
filename);
return -1;
}
#ifdef S_IROTH
if (0 && (statbuf.st_mode & S_IROTH) != 0) {
fclose(fp);
- radlog(L_ERR|L_CONS, "Configuration file %s is globally readable. Refusing to start due to insecure configuration.",
+ radlog(L_ERR, "Configuration file %s is globally readable. Refusing to start due to insecure configuration.",
filename);
return -1;
}
if (cf_data_add_internal(cs, filename, mtime, free,
PW_TYPE_FILENAME) < 0) {
fclose(fp);
- radlog(L_ERR|L_CONS, "Internal error opening file \"%s\"",
+ radlog(L_ERR, "Internal error opening file \"%s\"",
filename);
return -1;
}
cd = cf_data_find_internal(cs, filename, PW_TYPE_FILENAME);
if (!cd) {
fclose(fp);
- radlog(L_ERR|L_CONS, "Internal error opening file \"%s\"",
+ radlog(L_ERR, "Internal error opening file \"%s\"",
filename);
return -1;
}
char mycmd[1024];
if (strlen(cmd) > (sizeof(mycmd) - 1)) {
- radlog(L_ERR|L_CONS, "Command line is too long");
+ radlog(L_ERR, "Command line is too long");
return -1;
}
* Check for bad escapes.
*/
if (cmd[strlen(cmd) - 1] == '\\') {
- radlog(L_ERR|L_CONS, "Command line has final backslash, without a following character");
+ radlog(L_ERR, "Command line has final backslash, without a following character");
return -1;
}
case '\'':
length = rad_copy_string(to, from);
if (length < 0) {
- radlog(L_ERR|L_CONS, "Invalid string passed as argument for external program");
+ radlog(L_ERR, "Invalid string passed as argument for external program");
return -1;
}
from += length;
length = rad_copy_variable(to, from);
if (length < 0) {
- radlog(L_ERR|L_CONS, "Invalid variable expansion passed as argument for external program");
+ radlog(L_ERR, "Invalid variable expansion passed as argument for external program");
return -1;
}
from += length;
if (exec_wait) {
if (input_fd) {
if (pipe(to_child) != 0) {
- radlog(L_ERR|L_CONS, "Couldn't open pipe to child: %s",
+ radlog(L_ERR, "Couldn't open pipe to child: %s",
strerror(errno));
return -1;
}
}
if (output_fd) {
if (pipe(from_child) != 0) {
- radlog(L_ERR|L_CONS, "Couldn't open pipe from child: %s",
+ radlog(L_ERR, "Couldn't open pipe from child: %s",
strerror(errno));
/* safe because these either need closing or are == -1 */
close(to_child[0]);
*/
devnull = open("/dev/null", O_RDWR);
if (devnull < 0) {
- radlog(L_ERR|L_CONS, "Failed opening /dev/null: %s\n",
+ radlog(L_ERR, "Failed opening /dev/null: %s\n",
strerror(errno));
exit(1);
}
* Parent process.
*/
if (pid < 0) {
- radlog(L_ERR|L_CONS, "Couldn't fork %s: %s",
+ radlog(L_ERR, "Couldn't fork %s: %s",
argv[0], strerror(errno));
if (exec_wait) {
/* safe because these either need closing or are == -1 */
}
}
- radlog(L_ERR|L_CONS, "Exec-Program: Abnormal child exit: %s",
+ radlog(L_ERR, "Exec-Program: Abnormal child exit: %s",
strerror(errno));
#endif /* __MINGW32__ */
if ((fp = fopen(file, "r")) == NULL) {
if (!complain)
return -1;
- radlog(L_CONS|L_ERR, "Couldn't open %s for reading: %s",
+ radlog(L_ERR, "Couldn't open %s for reading: %s",
file, strerror(errno));
return -1;
}
*/
if (isspace((int) buffer[0])) {
if (parsecode != T_EOL) {
- radlog(L_ERR|L_CONS,
+ radlog(L_ERR,
"%s[%d]: Unexpected trailing comma for entry %s",
file, lineno, entry);
fclose(fp);
if (pairlist_read(newfile, &t, 0) != 0) {
pairlist_free(&pl);
- radlog(L_ERR|L_CONS,
+ radlog(L_ERR,
"%s[%d]: Could not open included file %s: %s",
file, lineno, newfile, strerror(errno));
fclose(fp);
parsecode = userparse(ptr, &check_tmp);
if (parsecode == T_OP_INVALID) {
pairlist_free(&pl);
- radlog(L_ERR|L_CONS,
+ radlog(L_ERR,
"%s[%d]: Parse error (check) for entry %s: %s",
file, lineno, entry, fr_strerror());
fclose(fp);
return -1;
} else if (parsecode == T_COMMA) {
- radlog(L_ERR|L_CONS,
+ radlog(L_ERR,
"%s[%d]: Unexpected trailing comma in check item list for entry %s",
file, lineno, entry);
fclose(fp);
else {
if(*buffer == ' ' || *buffer == '\t') {
if (parsecode != T_COMMA) {
- radlog(L_ERR|L_CONS,
+ radlog(L_ERR,
"%s[%d]: Syntax error: Previous line is missing a trailing comma for entry %s",
file, lineno, entry);
fclose(fp);
/* valid tokens are 1 or greater */
if (parsecode < 1) {
pairlist_free(&pl);
- radlog(L_ERR|L_CONS,
+ radlog(L_ERR,
"%s[%d]: Parse error (reply) for entry %s: %s",
file, lineno, entry, fr_strerror());
fclose(fp);
len = strlen(buffer);
len += strlcpy(buffer + len,
- fr_int2str(levels, (lvl & ~L_CONS), ": "),
+ fr_int2str(levels, lvl, ": "),
sizeof(buffer) - len);
}
#ifdef HAVE_SYSLOG_H
case RADLOG_SYSLOG:
- switch(lvl & ~L_CONS) {
+ switch(lvl) {
case L_DBG:
lvl = LOG_DEBUG;
break;
}
len += strlcpy(buffer + len,
- fr_int2str(levels, (lvl & ~L_CONS), ": "),
+ fr_int2str(levels, lvl, ": "),
sizeof(buffer) - len);
if (len >= sizeof(buffer)) goto finish;
{
modcallable *c, *loop, *next;
c = *pc;
+
+ DEBUG3("Freeing module %s", c->name);
+
if (c->type != MOD_SINGLE) {
modgroup *g = mod_callabletogroup(c);
devnull = open("/dev/null", O_RDWR);
if (devnull < 0) {
- radlog(L_ERR|L_CONS, "Failed opening /dev/null: %s\n",
+ radlog(L_ERR, "Failed opening /dev/null: %s\n",
strerror(errno));
exit(1);
}
fprintf(fp, "%d\n", (int) radius_pid);
fclose(fp);
} else {
- radlog(L_ERR|L_CONS, "Failed creating PID file %s: %s\n",
+ radlog(L_ERR, "Failed creating PID file %s: %s\n",
mainconfig.pid_file, strerror(errno));
exit(1);
}
*/
if (!request->proxy) {
if ((request->proxy = rad_alloc(TRUE)) == NULL) {
- radlog(L_ERR|L_CONS, "no memory");
+ radlog(L_ERR, "no memory");
exit(1);
}
#define PAIR(n,v,e) do { \
if(!(vp = paircreate(n, 0))) { \
request_free(&stopreq); \
- radlog(L_ERR|L_CONS, "no memory"); \
+ radlog(L_ERR, "no memory"); \
pairfree(&(stopreq->packet->vps)); \
return 0; \
} \
#define STRINGPAIR(n,v) do { \
if(!(vp = paircreate(n, 0))) { \
request_free(&stopreq); \
- radlog(L_ERR|L_CONS, "no memory"); \
+ radlog(L_ERR, "no memory"); \
pairfree(&(stopreq->packet->vps)); \
return 0; \
} \
else if(!strcasecmp(s, "updated"))
return RLM_MODULE_UPDATED;
else {
- radlog(L_ERR|L_CONS,
+ radlog(L_ERR,
"rlm_always: Unknown module rcode '%s'.\n", s);
return RLM_MODULE_UNKNOWN;
}
rcode = attr_filter_getfile(inst->file, &inst->attrs);
if (rcode != 0) {
- radlog(L_ERR|L_CONS, "Errors reading %s", inst->file);
+ radlog(L_ERR, "Errors reading %s", inst->file);
attr_filter_detach(inst);
return -1;
}
}
if (num_types == 0) {
- radlog(L_ERR|L_CONS, "rlm_eap: No EAP type configured, module cannot do anything.");
+ radlog(L_ERR, "rlm_eap: No EAP type configured, module cannot do anything.");
eap_detach(inst);
return -1;
}
*/
eap_type = eaptype_name2type(inst->default_eap_type_name);
if (eap_type < 0) {
- radlog(L_ERR|L_CONS, "rlm_eap: Unknown default EAP type %s",
+ radlog(L_ERR, "rlm_eap: Unknown default EAP type %s",
inst->default_eap_type_name);
eap_detach(inst);
return -1;
}
if (inst->types[eap_type] == NULL) {
- radlog(L_ERR|L_CONS, "rlm_eap: No such sub-type for default EAP type %s",
+ radlog(L_ERR, "rlm_eap: No such sub-type for default EAP type %s",
inst->default_eap_type_name);
eap_detach(inst);
return -1;
*/
inst->session_tree = rbtree_create(eap_handler_cmp, NULL, 0);
if (!inst->session_tree) {
- radlog(L_ERR|L_CONS, "rlm_eap: Cannot initialize tree");
+ radlog(L_ERR, "rlm_eap: Cannot initialize tree");
eap_detach(inst);
return -1;
}
if (fr_debug_flag) {
inst->handler_tree = rbtree_create(eap_handler_ptr_cmp, NULL, 0);
if (!inst->handler_tree) {
- radlog(L_ERR|L_CONS, "rlm_eap: Cannot initialize tree");
+ radlog(L_ERR, "rlm_eap: Cannot initialize tree");
eap_detach(inst);
return -1;
}
#ifdef HAVE_PTHREAD_H
if (pthread_mutex_init(&(inst->handler_mutex), NULL) < 0) {
- radlog(L_ERR|L_CONS, "rlm_eap: Failed initializing mutex: %s", strerror(errno));
+ radlog(L_ERR, "rlm_eap: Failed initializing mutex: %s", strerror(errno));
eap_detach(inst);
return -1;
}
#ifdef HAVE_PTHREAD_H
if (pthread_mutex_init(&(inst->session_mutex), NULL) < 0) {
- radlog(L_ERR|L_CONS, "rlm_eap: Failed initializing mutex: %s", strerror(errno));
+ radlog(L_ERR, "rlm_eap: Failed initializing mutex: %s", strerror(errno));
eap_detach(inst);
return -1;
}
*/
inst->session_tree = rbtree_create(eap_handler_cmp, NULL, 0);
if (!inst->session_tree) {
- radlog(L_ERR|L_CONS, "rlm_eap2: Cannot initialize tree");
+ radlog(L_ERR, "rlm_eap2: Cannot initialize tree");
eap_detach(inst);
return -1;
}
inst->methods[num_types] = eap_server_get_type(buffer,
&inst->vendors[num_types]);
if (inst->methods[num_types] == EAP_TYPE_NONE) {
- radlog(L_ERR|L_CONS, "rlm_eap2: Unknown EAP type %s",
+ radlog(L_ERR, "rlm_eap2: Unknown EAP type %s",
auth_type);
eap_detach(inst);
return -1;
inst->num_types = num_types;
if (do_tls && !has_tls) {
- radlog(L_ERR|L_CONS, "rlm_eap2: TLS has not been configured. Cannot do methods that need TLS.");
+ radlog(L_ERR, "rlm_eap2: TLS has not been configured. Cannot do methods that need TLS.");
eap_detach(inst);
return -1;
}
* Initialize TLS.
*/
if (eap_example_server_init_tls(inst) < 0) {
- radlog(L_ERR|L_CONS, "rlm_eap2: Cannot initialize TLS");
+ radlog(L_ERR, "rlm_eap2: Cannot initialize TLS");
eap_detach(inst);
return -1;
}
rcode = getusersfile(inst->usersfile, &inst->users, inst->compat_mode);
if (rcode != 0) {
- radlog(L_ERR|L_CONS, "Errors reading %s", inst->usersfile);
+ radlog(L_ERR, "Errors reading %s", inst->usersfile);
file_detach(inst);
return -1;
}
rcode = getusersfile(inst->acctusersfile, &inst->acctusers, inst->compat_mode);
if (rcode != 0) {
- radlog(L_ERR|L_CONS, "Errors reading %s", inst->acctusersfile);
+ radlog(L_ERR, "Errors reading %s", inst->acctusersfile);
file_detach(inst);
return -1;
}
*/
rcode = getusersfile(inst->preproxy_usersfile, &inst->preproxy_users, inst->compat_mode);
if (rcode != 0) {
- radlog(L_ERR|L_CONS, "Errors reading %s", inst->preproxy_usersfile);
+ radlog(L_ERR, "Errors reading %s", inst->preproxy_usersfile);
file_detach(inst);
return -1;
}
rcode = getusersfile(inst->postproxy_usersfile, &inst->postproxy_users, inst->compat_mode);
if (rcode != 0) {
- radlog(L_ERR|L_CONS, "Errors reading %s", inst->postproxy_usersfile);
+ radlog(L_ERR, "Errors reading %s", inst->postproxy_usersfile);
file_detach(inst);
return -1;
}
rcode = getusersfile(inst->auth_usersfile, &inst->auth_users, inst->compat_mode);
if (rcode != 0) {
- radlog(L_ERR|L_CONS, "Errors reading %s", inst->auth_usersfile);
+ radlog(L_ERR, "Errors reading %s", inst->auth_usersfile);
file_detach(inst);
return -1;
}
rcode = getusersfile(inst->postauth_usersfile, &inst->postauth_users, inst->compat_mode);
if (rcode != 0) {
- radlog(L_ERR|L_CONS, "Errors reading %s", inst->postauth_usersfile);
+ radlog(L_ERR, "Errors reading %s", inst->postauth_usersfile);
file_detach(inst);
return -1;
}
rc = pthread_mutex_init(mutexp, attr);
if (rc) {
- radlog(L_ERR|L_CONS, "rlm_otp: %s: pthread_mutex_init: %s",
+ radlog(L_ERR, "rlm_otp: %s: pthread_mutex_init: %s",
caller, strerror(rc));
exit(1);
rc = pthread_mutex_lock(mutexp);
if (rc) {
- radlog(L_ERR|L_CONS, "rlm_otp: %s: pthread_mutex_lock: %s",
+ radlog(L_ERR, "rlm_otp: %s: pthread_mutex_lock: %s",
caller, strerror(rc));
exit(1);
rc = pthread_mutex_trylock(mutexp);
if (rc && rc != EBUSY) {
- radlog(L_ERR|L_CONS, "rlm_otp: %s: pthread_mutex_trylock: %s",
+ radlog(L_ERR, "rlm_otp: %s: pthread_mutex_trylock: %s",
caller, strerror(rc));
exit(1);
rc = pthread_mutex_unlock(mutexp);
if (rc) {
- radlog(L_ERR|L_CONS, "rlm_otp: %s: pthread_mutex_unlock: %s",
+ radlog(L_ERR, "rlm_otp: %s: pthread_mutex_unlock: %s",
caller, strerror(rc));
exit(1);
}
if (!opt->name) {
- radlog(L_ERR|L_CONS, "rlm_otp: %s: no instance name "
+ radlog(L_ERR, "rlm_otp: %s: no instance name "
"(this can't happen)", __func__);
free(opt);
return -1;
rcode = pairlist_read(data->huntgroup_file,
&(data->huntgroups), 0);
if (rcode < 0) {
- radlog(L_ERR|L_CONS, "rlm_preprocess: Error reading %s",
+ radlog(L_ERR, "rlm_preprocess: Error reading %s",
data->huntgroup_file);
return -1;
}
if (data->hints_file) {
rcode = pairlist_read(data->hints_file, &(data->hints), 0);
if (rcode < 0) {
- radlog(L_ERR|L_CONS, "rlm_preprocess: Error reading %s",
+ radlog(L_ERR, "rlm_preprocess: Error reading %s",
data->hints_file);
return -1;
}
A(L_INFO)
A(L_ERR)
A(L_PROXY)
- A(L_CONS)
A(RLM_MODULE_REJECT)
A(RLM_MODULE_FAIL)
A(RLM_MODULE_OK)
{ "radlog", &python_radlog, METH_VARARGS,
"radiusd.radlog(level, msg)\n\n" \
"Print a message using radiusd logging system. level should be one of the\n" \
- "constants L_DBG, L_AUTH, L_INFO, L_ERR, L_PROXY, L_CONS\n"
+ "constants L_DBG, L_AUTH, L_INFO, L_ERR, L_PROXY\n"
},
{ NULL, NULL, 0, NULL },
};
*/
vp = pairmake("Proxy-To-Realm", realm->name, T_OP_EQ);
if (!vp) {
- radlog(L_ERR|L_CONS, "no memory");
+ radlog(L_ERR, "no memory");
exit(1);
}
{ "L_INFO", L_INFO},
{ "L_ERR", L_ERR},
{ "L_PROXY", L_PROXY},
- { "L_CONS", L_CONS},
{ "RLM_MODULE_REJECT", RLM_MODULE_REJECT},
{ "RLM_MODULE_FAIL", RLM_MODULE_FAIL},
{ "RLM_MODULE_OK", RLM_MODULE_OK},
return rc;
default:
- radlog(L_ERR|L_CONS, "rlm_securid: Invalid session state %d for user [%s]",
+ radlog(L_ERR, "rlm_securid: Invalid session state %d for user [%s]",
pSecurid_session->securidSessionState,
username);
break;
/* If the configuration parameters can't be parsed, then fail. */
if (cf_section_parse(conf, inst, module_config) < 0) {
- radlog(L_ERR|L_CONS, "rlm_securid: Unable to parse configuration section.");
+ radlog(L_ERR, "rlm_securid: Unable to parse configuration section.");
securid_detach(inst);
return -1;
}
*/
inst->session_tree = rbtree_create(securid_session_cmp, NULL, 0);
if (!inst->session_tree) {
- radlog(L_ERR|L_CONS, "rlm_securid: Cannot initialize session tree.");
+ radlog(L_ERR, "rlm_securid: Cannot initialize session tree.");
securid_detach(inst);
return -1;
}
int rc;
if ((rc = pthread_mutex_init(mutexp, attr))) {
- (void) radlog(L_ERR|L_CONS, "rlm_smsotp: %s: pthread_mutex_init: %s", caller, strerror(rc));
+ (void) radlog(L_ERR, "rlm_smsotp: %s: pthread_mutex_init: %s", caller, strerror(rc));
exit(1);
}
}
int rc;
if ((rc = pthread_mutex_lock(mutexp))) {
- (void) radlog(L_ERR|L_CONS, "rlm_smsotp: %s: pthread_mutex_lock: %s", caller, strerror(rc));
+ (void) radlog(L_ERR, "rlm_smsotp: %s: pthread_mutex_lock: %s", caller, strerror(rc));
exit(1);
}
}
rc = pthread_mutex_trylock(mutexp);
if (rc && rc != EBUSY) {
- (void) radlog(L_ERR|L_CONS, "rlm_smsotp: %s: pthread_mutex_trylock: %s", caller, strerror(rc));
+ (void) radlog(L_ERR, "rlm_smsotp: %s: pthread_mutex_trylock: %s", caller, strerror(rc));
exit(1);
}
int rc;
if ((rc = pthread_mutex_unlock(mutexp))) {
- (void) radlog(L_ERR|L_CONS, "rlm_smsotp: %s: pthread_mutex_unlock: %s", caller, strerror(rc));
+ (void) radlog(L_ERR, "rlm_smsotp: %s: pthread_mutex_unlock: %s", caller, strerror(rc));
exit(1);
}
}
else if(!strcasecmp(s, "updated"))
return RLM_MODULE_UPDATED;
else {
- radlog(L_ERR|L_CONS,
+ radlog(L_ERR,
"rlm_sometimes: Unknown module rcode '%s'.\n", s);
return -1;
}
rcode = SQLAllocEnv(&iodbc_sock->env_handle);
if (!SQL_SUCCEEDED(rcode)) {
- radlog(L_CONS|L_ERR, "sql_create_socket: SQLAllocEnv failed: %s",
+ radlog(L_ERR, "sql_create_socket: SQLAllocEnv failed: %s",
sql_error(sqlsocket, config));
return -1;
}
rcode = SQLAllocConnect(iodbc_sock->env_handle,
&iodbc_sock->dbc_handle);
if (!SQL_SUCCEEDED(rcode)) {
- radlog(L_CONS|L_ERR, "sql_create_socket: SQLAllocConnect failed: %s",
+ radlog(L_ERR, "sql_create_socket: SQLAllocConnect failed: %s",
sql_error(sqlsocket, config));
return -1;
}
SQL_NTS, config->sql_login, SQL_NTS,
config->sql_password, SQL_NTS);
if (!SQL_SUCCEEDED(rcode)) {
- radlog(L_CONS|L_ERR, "sql_create_socket: SQLConnectfailed: %s",
+ radlog(L_ERR, "sql_create_socket: SQLConnectfailed: %s",
sql_error(sqlsocket, config));
return -1;
}
rcode = SQLAllocStmt(iodbc_sock->dbc_handle,
&iodbc_sock->stmt_handle);
if (!SQL_SUCCEEDED(rcode)) {
- radlog(L_CONS|L_ERR, "sql_create_socket: SQLAllocStmt failed: %s",
+ radlog(L_ERR, "sql_create_socket: SQLAllocStmt failed: %s",
sql_error(sqlsocket, config));
return -1;
}
rcode = SQLExecDirect(iodbc_sock->stmt_handle, querystr, SQL_NTS);
if (!SQL_SUCCEEDED(rcode)) {
- radlog(L_CONS|L_ERR, "sql_query: failed: %s",
+ radlog(L_ERR, "sql_query: failed: %s",
sql_error(sqlsocket, config));
return -1;
}
* Always get the numeric representation of IP
*/
if (ip_hton(row[1], AF_UNSPEC, &c->ipaddr) < 0) {
- radlog(L_CONS|L_ERR, "rlm_sql (%s): Failed to look up hostname %s: %s",
+ radlog(L_ERR, "rlm_sql (%s): Failed to look up hostname %s: %s",
inst->config->xlat_name,
row[1], fr_strerror());
free(c);
if (!row)
break;
if (sql_userparse(pair, row) != 0) {
- radlog(L_ERR | L_CONS, "rlm_sql (%s): Error getting data from database", inst->config->xlat_name);
+ radlog(L_ERR, "rlm_sql (%s): Error getting data from database", inst->config->xlat_name);
(inst->module->sql_finish_select_query)(*sqlsocket, inst->config);