diff --git a/bip.conf.1 b/bip.conf.1 index c9cdf0e..76ebff5 100644 --- a/bip.conf.1 +++ b/bip.conf.1 @@ -109,6 +109,10 @@ Ignored for the time beeing. When true, the log system is enabled. Else, BIP will not write a single log file. Backlog is then stored into memory. +.TP +\fBlog_system\fP (default: \fBtrue\fP) +When true, system messages such as connection errors are logged. Else, BIP will not write system logs. + .TP \fBlog_format\fP (default: \fB%u/%n/%Y-%m/%c.%d.log\fP) Determines the log file name depending on : diff --git a/scripts/bipgenconfig b/scripts/bipgenconfig index 0c27a9e..ad5b0ab 100755 --- a/scripts/bipgenconfig +++ b/scripts/bipgenconfig @@ -44,7 +44,10 @@ my %optdesc = ( 'desc' => 'Where do you want the pidfile to be stored ?' }, 'log' => { 'type' => 'b', 'adv' => 0, 'default' => 'true', 'optional' => 1, - 'desc' => 'Do you want to enable the logging system ?' }, + 'desc' => 'Do you want to enable channel logging ?' }, + 'log_system' => { 'type' => 'b', 'adv' => 0, 'default' => 'true', + 'optional' => 1, + 'desc' => 'Do you want to enable system logging ?' }, 'log_sync_interval' => { 'type' => 'i', 'adv' => 1, 'optional' => 1, 'default' => '5', 'depends' => 'log', 'depval' => 'true', diff --git a/src/bip.c b/src/bip.c index 5b1dc9d..589858e 100644 --- a/src/bip.c +++ b/src/bip.c @@ -49,6 +49,7 @@ hash_t adm_users; int conf_backlog = 0; extern int conf_memlog; int conf_log = 0; +int conf_log_system = 0; /* number of lines in backlog */ int conf_backlog_lines = 10; int conf_backlog_no_timestamp = 0; @@ -180,7 +181,7 @@ static pid_t daemonize(void) _exit(0); } - if (conf_log) { + if (conf_log_system) { snprintf(buf, 4095, "%s/bip.log", conf_log_root); FILE *f = fopen(buf, "a"); if (!f) @@ -621,6 +622,9 @@ int fireup(FILE *conf) case LEX_LOG: conf_log = t->ndata; break; + case LEX_LOG_SYSTEM: + conf_log_system = t->ndata; + break; case LEX_BACKLOG_LINES: conf_backlog_lines = t->ndata; break; @@ -935,6 +939,7 @@ int main(int argc, char **argv) conf_log_level = LOG_INFO; conf_backlog = 1; conf_log = 1; + conf_log_system = 1; conf_backlog_lines = 100; conf_log_sync_interval = 5; conf_daemonize = 1; diff --git a/src/bipmkpw.c b/src/bipmkpw.c index d01700c..1ea7006 100644 --- a/src/bipmkpw.c +++ b/src/bipmkpw.c @@ -24,7 +24,7 @@ int conf_log_level; FILE *conf_global_log_file; -int conf_log; +int conf_log_system; void readpass(char *buffer, int buflen) { diff --git a/src/conf.y b/src/conf.y index 824c2c3..8e665fc 100644 --- a/src/conf.y +++ b/src/conf.y @@ -80,7 +80,7 @@ struct tuple *tuple_l_new(int type, void *p) %} -%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY +%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY %union { int number; @@ -120,6 +120,7 @@ command: $$ = tuple_i_new(LEX_BL_MSG_ONLY, $3); } | LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); } + | LEX_LOG_SYSTEM LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG_SYSTEM, $3); } | LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new( LEX_ALWAYS_BACKLOG, $3); } | LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new( diff --git a/src/irc.c b/src/irc.c index 838d1e7..280693c 100644 --- a/src/irc.c +++ b/src/irc.c @@ -2197,6 +2197,7 @@ void bip_init(bip_t *bip) memset(bip, 0, sizeof(bip_t)); list_init(&bip->link_list, list_ptr_cmp); list_init(&bip->conn_list, list_ptr_cmp); + list_init(&bip->connecting_client_list, list_ptr_cmp); } void bip_recover_sighup(bip_t *bip) diff --git a/src/lex.l b/src/lex.l index 8115f6f..2819cb0 100644 --- a/src/lex.l +++ b/src/lex.l @@ -90,6 +90,7 @@ list_t *parse_conf(FILE *file) "bl_msg_only" { return LEX_BL_MSG_ONLY; } "always_backlog" { return LEX_ALWAYS_BACKLOG; } "log" { return LEX_LOG; } +"log_system" { return LEX_LOG_SYSTEM; } "log_sync_interval" { return LEX_LOG_SYNC_INTERVAL; } "follow_nick" { return LEX_FOLLOW_NICK; } "ignore_first_nick" { return LEX_IGN_FIRST_NICK; } diff --git a/src/util.c b/src/util.c index 83e6494..59453b6 100644 --- a/src/util.c +++ b/src/util.c @@ -24,7 +24,7 @@ #include extern int conf_log_level; -extern int conf_log; +extern int conf_log_system; extern int errno; /* @@ -119,7 +119,7 @@ void mylog(int level, char *fmt, ...) { va_list ap; - if (!conf_log) + if (!conf_log_system) return; va_start(ap, fmt);