diff --git a/TODO b/TODO index 88b626e..d77c054 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,3 @@ - faudrait ptet pouvoir specifier directement le oidentd_path - - - Allow to dump a config file, so that when the config is dynamically changed, we can find it back after bip restart. diff --git a/bip.conf.5 b/bip.conf.5 index be1a9d3..2dedcc5 100644 --- a/bip.conf.5 +++ b/bip.conf.5 @@ -140,6 +140,10 @@ delay = reconn_timer * number of attempts Defines the file where BIP's pid will be stored. BIP checks if this file exists and if the pid is still alive upon startup. If true, BIP refuses to start. +.TP +\fBoidentd_file\fP (default: \fB/.oidentd.conf\fP) +oidentd configuration file (if oidentd enabled). + .TP \fBport\fP (default: \fB7778\fP) The port on which BIP should listen for clients. diff --git a/samples/bip.conf b/samples/bip.conf index ffec9b1..7ea38a6 100644 --- a/samples/bip.conf +++ b/samples/bip.conf @@ -29,6 +29,9 @@ client_side_ssl = false; # Define where the pidfile should be stored. Defaults to /bip.pid #pid_file="/var/run/bip/bip.pid"; +# Defaults to /.oidentd.conf +#oidentd_file=""; + # Uncomment this line to disable logging and backlogging. #log = false diff --git a/samples/bip.vim b/samples/bip.vim index 46aeb74..5a7ef90 100644 --- a/samples/bip.vim +++ b/samples/bip.vim @@ -55,7 +55,7 @@ syn region bipMain start=/\%^/ end=/\%$/ syn keyword bipKeyword contained nextgroup=bipBoolV client_side_ssl \ log log_system syn keyword bipKeyword contained nextgroup=bipStringV log_root - \ log_format pid_file client_side_ssl_pem client_side_ciphers + \ log_format oidentd_file pid_file client_side_ssl_pem client_side_ciphers \ ssl_default_ciphers syn keyword bipKeyword contained nextgroup=bipNumericV port log_level \ log_sync_interval diff --git a/src/bip.c b/src/bip.c index 502ed04..54a11ae 100644 --- a/src/bip.c +++ b/src/bip.c @@ -1031,6 +1031,17 @@ int fireup(bip_t *bip, FILE *conf) case LEX_PID_FILE: MOVE_STRING(conf_pid_file, t->pdata); break; + +#ifdef HAVE_OIDENTD + case LEX_OIDENTD_FILE: + MOVE_STRING(bip->oidentdpath, t->pdata); + break; +#else + case LEX_OIDENTD_FILE: + mylog(LOG_WARN, "Found oidentd option whereas bip is " + "not built with oidentd support."); + break; +#endif case LEX_ALWAYS_BACKLOG: hds.always_backlog = t->ndata; break; @@ -1254,11 +1265,13 @@ int main(int argc, char **argv) } #ifdef HAVE_OIDENTD - bip.oidentdpath = bip_malloc(strlen(conf_biphome) + 1 + - strlen(OIDENTD_FILENAME) + 1); - strcpy(bip.oidentdpath, conf_biphome); - strcat(bip.oidentdpath, "/"); - strcat(bip.oidentdpath, OIDENTD_FILENAME); + if (!bip.oidentdpath) { + bip.oidentdpath = bip_malloc(strlen(conf_biphome) + 1 + + strlen(OIDENTD_FILENAME) + 1); + strcpy(bip.oidentdpath, conf_biphome); + strcat(bip.oidentdpath, "/"); + strcat(bip.oidentdpath, OIDENTD_FILENAME); + } #endif if (!confpath) { diff --git a/src/conf.y b/src/conf.y index 0125888..fda894b 100644 --- a/src/conf.y +++ b/src/conf.y @@ -68,7 +68,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_SSL_CLIENT_CERTFILE LEX_CIPHERS LEX_CSS_CIPHERS LEX_DEFAULT_CIPHERS 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_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK LEX_IGNORE_CAPAB LEX_RECONN_TIMER +%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_SSL_CLIENT_CERTFILE LEX_CIPHERS LEX_CSS_CIPHERS LEX_DEFAULT_CIPHERS 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_OIDENTD_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK LEX_IGNORE_CAPAB LEX_RECONN_TIMER %union { int number; @@ -106,6 +106,7 @@ command: | LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new( LEX_LOG_SYNC_INTERVAL, $3); } | LEX_PID_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PID_FILE, $3); } + | LEX_OIDENTD_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_OIDENTD_FILE, $3); } /* deprecated */ | LEX_BACKLOG_LINES LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_BACKLOG_LINES, $3); diff --git a/src/lex.l b/src/lex.l index 098b92b..b291a2f 100644 --- a/src/lex.l +++ b/src/lex.l @@ -108,6 +108,7 @@ list_t *parse_conf(FILE *file, int *err) "on_connect_send" { return LEX_ON_CONNECT_SEND; } "no_client_away_msg" { return LEX_NO_CLIENT_AWAY_MSG; } "pid_file" { return LEX_PID_FILE; } +"oidentd_file" { return LEX_OIDENTD_FILE; } "bip_use_notice" { return LEX_BIP_USE_NOTICE; } "client_side_ssl_pem" { return LEX_CSS_PEM; } "client_side_ciphers" { return LEX_CSS_CIPHERS; }