Commits (2)
......@@ -147,6 +147,8 @@ typedef struct {
int GCES_level; \
get_crypt_error_string(status, sess, &GCES_estr, action, &GCES_level); \
if (GCES_estr) { \
if(GCES_level < startup->tls_error_level) \
GCES_level = startup->tls_error_level; \
lprintf(GCES_level, "%04d %s %s", sock, server, GCES_estr); \
free_crypt_attrstr(GCES_estr); \
} \
......@@ -157,6 +159,8 @@ typedef struct {
int GCES_level; \
get_crypt_error_string(status, sess, &GCES_estr, action, &GCES_level); \
if (GCES_estr) { \
if(GCES_level < startup->tls_error_level) \
GCES_level = startup->tls_error_level; \
lprintf(GCES_level, "%04d %s [%s] %s", sock, server, host, GCES_estr); \
free_crypt_attrstr(GCES_estr); \
} \
......@@ -167,6 +171,8 @@ typedef struct {
int GCES_level; \
get_crypt_error_string(status, sess, &GCES_estr, action, &GCES_level); \
if (GCES_estr) { \
if(log_level < startup->tls_error_level) \
log_level = startup->tls_error_level; \
lprintf(log_level, "%04d %s [%s] %s", sock, server, host, GCES_estr); \
free_crypt_attrstr(GCES_estr); \
} \
......
......@@ -95,6 +95,7 @@ typedef struct {
BOOL recycle_now;
BOOL shutdown_now;
int log_level;
int tls_error_level; /* Cap the severity of TLS error log messages */
uint bind_retry_count; /* Number of times to retry bind() calls */
uint bind_retry_delay; /* Time to wait between each bind() retry */
......
......@@ -21,6 +21,7 @@
#include "msg_id.h"
#include "smblib.h"
#include "scfglib.h"
#include "git_branch.h"
#include "git_hash.h"
......@@ -169,7 +170,7 @@ BOOL add_msg_ids(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, smbmsg_t* remsg)
if(smb->subnum == INVALID_SUB && msg->to_net.type == NET_FIDO) {
safe_snprintf(msg_id, sizeof(msg_id)
,"%s %08lx"
,smb_faddrtoa(&cfg->faddr[nearest_sysfaddr(cfg, msg->to_net.addr)], NULL)
,smb_faddrtoa(nearest_sysfaddr(cfg, msg->to_net.addr), NULL)
,msgid_serialno(msg)
);
if(smb_hfield_str(msg, FIDOMSGID, msg_id) != SMB_SUCCESS)
......@@ -249,16 +250,3 @@ char* msg_program_id(char* pid, size_t maxlen)
,__DATE__,compiler);
return pid;
}
uint nearest_sysfaddr(scfg_t* cfg, faddr_t* dest_addr)
{
uint i;
for(i=0; i<cfg->total_faddrs; i++)
if(dest_addr->zone == cfg->faddr[i].zone && dest_addr->net == cfg->faddr[i].net)
return i;
for(i=0; i<cfg->total_faddrs; i++)
if(dest_addr->zone == cfg->faddr[i].zone)
return i;
return 0;
}
......@@ -35,7 +35,6 @@ DLLEXPORT uint32_t get_new_msg_number(smb_t*);
DLLEXPORT BOOL add_msg_ids(scfg_t*, smb_t*, smbmsg_t*, smbmsg_t* remsg);
DLLEXPORT BOOL add_reply_ids(scfg_t*, smb_t*, smbmsg_t*, smbmsg_t* remsg);
DLLEXPORT char* msg_program_id(char* pid, size_t);
DLLEXPORT uint nearest_sysfaddr(scfg_t*, faddr_t* dest_addr);
#ifdef __cplusplus
}
......
......@@ -42,6 +42,7 @@ static const char* strMaxInactivity="MaxInactivity";
static const char* strMaxConConn="MaxConcurrentConnections";
static const char* strHostName="HostName";
static const char* strLogLevel="LogLevel";
static const char* strTLSErrorLevel="TLSErrorLevel";
static const char* strBindRetryCount="BindRetryCount";
static const char* strBindRetryDelay="BindRetryDelay";
static const char* strAnswerSound="AnswerSound";
......@@ -277,6 +278,7 @@ static void get_ini_globals(str_list_t list, global_startup_t* global)
global->outgoing4.s_addr=iniGetIpAddress(list,section,strOutgoing4,0);
global->outgoing6=iniGetIp6Address(list,section,strOutgoing6,wildcard6);
global->log_level=iniGetLogLevel(list,section,strLogLevel,DEFAULT_LOG_LEVEL);
global->tls_error_level=iniGetLogLevel(list,section, strTLSErrorLevel, 0);
global->bind_retry_count=iniGetInteger(list,section,strBindRetryCount,DEFAULT_BIND_RETRY_COUNT);
global->bind_retry_delay=iniGetInteger(list,section,strBindRetryDelay,DEFAULT_BIND_RETRY_DELAY);
global->login_attempt = get_login_attempt_settings(list, section, NULL);
......@@ -617,6 +619,8 @@ void sbbs_read_ini(
mail->log_level
=iniGetLogLevel(list,section,strLogLevel,global->log_level);
mail->tls_error_level
=iniGetLogLevel(list,section, strTLSErrorLevel, global->tls_error_level);
mail->options
=iniGetBitField(list,section,strOptions,mail_options
,MAIL_OPT_ALLOW_POP3);
......@@ -739,7 +743,7 @@ void sbbs_read_ini(
web->log_level
=iniGetLogLevel(list,section,strLogLevel,global->log_level);
web->tls_error_level
=iniGetLogLevel(list,section, "TLSErrorLevel", web->tls_error_level);
=iniGetLogLevel(list,section, strTLSErrorLevel, global->tls_error_level);
web->options
=iniGetBitField(list,section,strOptions,web_options
,BBS_OPT_NO_HOST_LOOKUP | WEB_OPT_HTTP_LOGGING);
......@@ -809,6 +813,7 @@ BOOL sbbs_write_ini(
iniSetIp6Address(lp,section,strOutgoing6,global->outgoing6,&style);
iniSetStringList(lp, section, strInterfaces, ",", global->interfaces, &style);
iniSetLogLevel(lp,section,strLogLevel,global->log_level,&style);
iniSetLogLevel(lp,section,strTLSErrorLevel,global->tls_error_level,&style);
iniSetInteger(lp,section,strBindRetryCount,global->bind_retry_count,&style);
iniSetInteger(lp,section,strBindRetryDelay,global->bind_retry_delay,&style);
set_login_attempt_settings(lp, section, global->login_attempt, style);
......@@ -1045,7 +1050,10 @@ BOOL sbbs_write_ini(
iniRemoveValue(lp,section,strLogLevel);
else if(!iniSetLogLevel(lp,section,strLogLevel,mail->log_level,&style))
break;
if(mail->tls_error_level==global->tls_error_level)
iniRemoveValue(lp,section,strTLSErrorLevel);
else if(!iniSetLogLevel(lp,section,strTLSErrorLevel,mail->tls_error_level,&style))
break;
if(!iniSetShortInt(lp,section,"SMTPPort",mail->smtp_port,&style))
break;
if(!iniSetShortInt(lp,section,"SubmissionPort",mail->submission_port,&style))
......@@ -1244,6 +1252,10 @@ BOOL sbbs_write_ini(
iniRemoveValue(lp,section,strLogLevel);
else if(!iniSetLogLevel(lp,section,strLogLevel,web->log_level,&style))
break;
if(web->tls_error_level==global->tls_error_level)
iniRemoveValue(lp,section,strTLSErrorLevel);
else if(!iniSetLogLevel(lp,section,strTLSErrorLevel,web->tls_error_level,&style))
break;
/* JavaScript Operating Parameters */
if(!sbbs_set_js_settings(lp,section,&web->js,&global->js,&style))
......
......@@ -66,6 +66,8 @@ int getlibnum(scfg_t*, const char* code);
int getsubnum(scfg_t*, const char* code);
int getgrpnum(scfg_t*, const char* code);
faddr_t* nearest_sysfaddr(scfg_t*, faddr_t*);
#ifdef __cplusplus
}
#endif
......
......@@ -532,6 +532,10 @@ BOOL read_msgs_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
for(i=0;i<cfg->total_faddrs;i++)
get_int(cfg->faddr[i],instream);
// Sanity-check each sub's FidoNet-style address
for(i = 0; i < cfg->total_subs; i++)
cfg->sub[i]->faddr = *nearest_sysfaddr(cfg, &cfg->sub[i]->faddr);
get_str(cfg->origline,instream);
get_str(cfg->netmail_sem,instream);
get_str(cfg->echomail_sem,instream);
......@@ -821,3 +825,28 @@ int getgrpnum(scfg_t* cfg, const char* code)
return cfg->sub[i]->grp;
return i;
}
faddr_t* nearest_sysfaddr(scfg_t* cfg, faddr_t* addr)
{
uint i;
if(cfg->total_faddrs <= 0)
return addr;
for(i=0; i < cfg->total_faddrs; i++)
if(memcmp(addr, &cfg->faddr[i], sizeof(*addr)) == 0)
return &cfg->faddr[i];
for(i=0; i < cfg->total_faddrs; i++)
if(addr->zone == cfg->faddr[i].zone
&& addr->net == cfg->faddr[i].net
&& addr->node == cfg->faddr[i].node)
return &cfg->faddr[i];
for(i=0; i < cfg->total_faddrs; i++)
if(addr->zone == cfg->faddr[i].zone
&& addr->net == cfg->faddr[i].net)
return &cfg->faddr[i];
for(i=0; i < cfg->total_faddrs; i++)
if(addr->zone == cfg->faddr[i].zone)
return &cfg->faddr[i];
return &cfg->faddr[0];
}
......@@ -70,6 +70,7 @@ typedef struct {
struct in6_addr outgoing6;
str_list_t interfaces;
int log_level;
int tls_error_level; /* Cap the severity of TLS error log messages */
js_startup_t js;
uint bind_retry_count; /* Number of times to retry bind() calls */
uint bind_retry_delay; /* Time to wait between each bind() retry */
......