Remove OIDENTD build options.

Instead support a runtime option.
Note that existing oidentd users will have to add write_oidentd = true
in their config to keep existing behavior.
This commit is contained in:
Arnaud Cornet 2018-11-18 15:07:16 -05:00 committed by Pierre-Louis Bonicoli
parent 7844716af5
commit 34a92dedb1
Signed by: pilou
GPG Key ID: ADC2651DDACD3538
9 changed files with 20 additions and 41 deletions

View File

@ -156,6 +156,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
\fBwrite_oidentd_file\fP (default: \fIfalse\fR)
Must be set to true to overwrite oidentd configs.
.TP
\fBoidentd_file\fP (default: \fI<bipdir>/.oidentd.conf\fR)
oidentd configuration file (if oidentd enabled).

View File

@ -15,16 +15,6 @@ AC_PROG_YACC
m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal([Please install pkg-config.])])
PKG_PROG_PKG_CONFIG
AC_ARG_ENABLE([oidentd], AS_HELP_STRING([--enable-oidentd],
[Enable oidentd support (bip overwrites ~/.oidentd.conf with this on!)]))
AM_CONDITIONAL(OIDENTD, test x$enable_identd = xyes)
AS_IF([test "x$enable_oidentd" = "xyes"], [
AC_DEFINE([HAVE_OIDENTD], [], [Have bip edit ~/.oidentd.conf])
], [
enable_oidentd=no
])
PKG_CHECK_MODULES(OPENSSL, [libssl >= 0.9.8 libcrypto >= 0.9.8], [with_openssl=yes], [with_openssl=no])
AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
@ -62,6 +52,5 @@ AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
echo OPENSSL: $with_openssl
echo OIDENTD: $enable_oidentd
echo PIE: $enable_pie
echo TESTS: $enable_tests

View File

@ -43,6 +43,9 @@
# Define where the pidfile should be stored. Defaults to <bipdir>/bip.pid.
#pid_file="";
# Defaults to false, whether to write oidentd.conf files (see below).
#write_oidentd = true;
# Defaults to <bipdir>/.oidentd.conf
#oidentd_file="";

View File

@ -69,10 +69,6 @@ void adm_list_connections(struct link_client *ic, struct bipuser *bu);
void free_conf(list_t *l);
#ifdef HAVE_OIDENTD
#define OIDENTD_FILENAME ".oidentd.conf"
#endif
static void hash_binary(char *hex, unsigned char **password, unsigned int *seed)
{
unsigned char *md5;
@ -981,17 +977,12 @@ int fireup(bip_t *bip, FILE *conf)
case LEX_PID_FILE:
MOVE_STRING(conf_pid_file, t->pdata);
break;
#ifdef HAVE_OIDENTD
case LEX_WRITE_OIDENTD:
bip->write_oidentd = t->ndata;
break;
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;

View File

@ -33,6 +33,7 @@
#include "defaults.h"
#define S_CONF "bip.conf"
#define OIDENTD_FILENAME ".oidentd.conf"
extern int sighup;
extern char *conf_log_root;
@ -217,7 +218,6 @@ int main(int argc, char **argv)
strcat(conf_biphome, "/.bip");
}
#ifdef HAVE_OIDENTD
if (!bip.oidentdpath) {
bip.oidentdpath = bip_malloc(strlen(conf_biphome) + 1 +
strlen(OIDENTD_FILENAME) + 1);
@ -225,7 +225,6 @@ int main(int argc, char **argv)
strcat(bip.oidentdpath, "/");
strcat(bip.oidentdpath, OIDENTD_FILENAME);
}
#endif
if (!confpath) {
confpath = bip_malloc(strlen(conf_biphome) + 1 +
@ -236,7 +235,7 @@ int main(int argc, char **argv)
}
conf = fopen(confpath, "r");
if (!conf)
fatal("config file not found");
fatal("config file not found (%s)", confpath);
r = fireup(&bip, conf);
fclose(conf);

View File

@ -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_DH_PARAM 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
%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_DH_PARAM 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_WRITE_OIDENTD 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;
@ -107,6 +107,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_WRITE_OIDENTD LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_WRITE_OIDENTD, $3); }
| LEX_OIDENTD_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_OIDENTD_FILE, $3); }
/* deprecated */
| LEX_BACKLOG_LINES LEX_EQ LEX_INT {

View File

@ -54,10 +54,7 @@ static void server_init_modes(struct link_server *s);
static int bip_get_index(const char* str, char car);
static int bip_fls(int v);
#ifdef HAVE_OIDENTD
#define OIDENTD_FILENAME ".oidentd.conf"
void oidentd_dump(bip_t *bip);
#endif
void irc_client_free(struct link_client *cli);
extern int conf_log_sync_interval;
@ -2194,9 +2191,7 @@ connection_t *irc_server_connect(struct link *link)
conn->user_data = ls;
list_add_last(&_bip->conn_list, conn);
#ifdef HAVE_OIDENTD
oidentd_dump(_bip);
#endif
irc_server_startup(ls);
return conn;
}
@ -2237,15 +2232,16 @@ void irc_server_shutdown(struct link_server *s)
LINK(s)->prev_nick = bip_strdup(s->nick);
}
#ifdef HAVE_OIDENTD
#define BIP_OIDENTD_START "## AUTOGENERATED BY BIP. DO NOT EDIT ##\n"
#define BIP_OIDENTD_END "## END OF AUTOGENERATED STUFF ##\n"
#define BIP_OIDENTD_END_LENGTH strlen(BIP_OIDENTD_END)
void oidentd_dump(bip_t *bip)
{
mylog(LOG_ERROR, "%d %s", bip->write_oidentd, bip->oidentdpath);
if (!bip->write_oidentd || bip->oidentdpath == NULL) {
return;
}
list_iterator_t it;
FILE *f;
char *bipstart = NULL, *bipend = NULL;
@ -2352,7 +2348,6 @@ void oidentd_dump(bip_t *bip)
clean_oidentd:
fclose(f);
}
#endif
void timeout_clean_who_counts(list_t *conns)
{
@ -2559,10 +2554,8 @@ void irc_main(bip_t *bip)
int nc;
/* Da main loop */
list_t *ready = wait_event(&bip->conn_list, &timeleft, &nc);
#ifdef HAVE_OIDENTD
if (nc)
oidentd_dump(bip);
#endif
while ((conn = list_remove_first(ready)))
bip_on_event(bip, conn);
list_free(ready);

View File

@ -250,10 +250,8 @@ typedef struct bip {
hash_t users;
list_t errors;
struct link_client *reloading_client;
#ifdef HAVE_OIDENTD
char *oidentdpath;
#endif
int write_oidentd;
} bip_t;
void bip_init(bip_t *bip);

View File

@ -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; }
"write_oidentd" { return LEX_WRITE_OIDENTD; }
"oidentd_file" { return LEX_OIDENTD_FILE; }
"bip_use_notice" { return LEX_BIP_USE_NOTICE; }
"client_side_ssl_pem" { return LEX_CSS_PEM; }