From bdea851d54851ba3e17a59555ef2798e597c3bfc Mon Sep 17 00:00:00 2001 From: Evgeniy Kozhuhovskiy Date: Sat, 12 Feb 2005 22:13:37 +0000 Subject: [PATCH] added exec feature, see changelog for details --- debian/changelog | 6 ++++++ examples/bforce.conf | 9 ++++++++- source/.version | 2 +- source/bforce/conf_proc.c | 1 + source/bforce/io_tcpip.c | 2 +- source/bforce/sess_call.c | 13 +++++++++++++ source/include/confread.h | 1 + 7 files changed, 31 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8ab06f2..b802144 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +bforce (0.22.8.ugenk5-1) unstable; urgency=low + + * Initial release from upstream + + -- Evgeniy Kozhuhovskiy Sat, 12 Feb 2005 18:48:42 +0200 + bforce (0.22.8.ugenk4-2) unstable; urgency=low * added checking of /etc/default/bforce in init.d script diff --git a/examples/bforce.conf b/examples/bforce.conf index fafb26d..161350c 100644 --- a/examples/bforce.conf +++ b/examples/bforce.conf @@ -448,6 +448,8 @@ skip_files_recv *.pif *.swp # To see a nodelist node information in the log file, write: # #run_after_handshake [useshell,logout]/usr/local/lib/ftn/nlookup $REM_ADDR_FTN +# + # # Path to the directory with "long" fileboxes. Such fileboxes names @@ -551,7 +553,7 @@ daemon_pid_file /var/run/bforce.pid # # Syslog facility (see man 3 openlog and /usr/include/sys/syslog.h for list of facilities) -# 64 == 8<3 == +# 64 == 8<3 == LOG_UUCP # See SYSLOG for details # syslog_facility 64 @@ -561,5 +563,10 @@ syslog_facility 64 # nomail_flag /etc/nomail +# +# run_before_session executes a command specified +# and returns after the command has been completed. +# +run_before_session /usr/local/bin/call_inet.sh # That's all! diff --git a/source/.version b/source/.version index 6260cde..38fd1d4 100644 --- a/source/.version +++ b/source/.version @@ -1 +1 @@ -0.22.8.ugenk4 +0.22.8.ugenk5 diff --git a/source/bforce/conf_proc.c b/source/bforce/conf_proc.c index 2bafc81..549793c 100644 --- a/source/bforce/conf_proc.c +++ b/source/bforce/conf_proc.c @@ -149,6 +149,7 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = { CONF_KEY(rescan_delay, CT_NUMBER), CONF_KEY(run_after_handshake, CT_STRING), CONF_KEY(run_after_session, CT_STRING), + CONF_KEY(run_before_session, CT_STRING), CONF_KEY(session_limit_in, CT_NUMBER), CONF_KEY(session_limit_out, CT_NUMBER), CONF_KEY(skip_files_recv, CT_STRING), diff --git a/source/bforce/io_tcpip.c b/source/bforce/io_tcpip.c index 0c27dc5..4148d40 100644 --- a/source/bforce/io_tcpip.c +++ b/source/bforce/io_tcpip.c @@ -177,7 +177,7 @@ int tcpip_init(void) tty_abort = FALSE; tty_hangup = FALSE; tty_modem = FALSE; - + /* * Set sockets I/O to the non-blocking mode */ diff --git a/source/bforce/sess_call.c b/source/bforce/sess_call.c index de71c5d..beac548 100644 --- a/source/bforce/sess_call.c +++ b/source/bforce/sess_call.c @@ -196,6 +196,19 @@ int call_system_quiet(const char *connstr, bool inet) int rc = 0; char *p; + + char *exec_cmd; + int exec_result; + + if( (exec_cmd = conf_string(cf_run_before_session)) != NULL ) + { + exec_result = system(exec_cmd); + if( exec_result = 0 ) + log("external application %s executed with zero return code (%i)", exec_cmd, exec_result); + else + logerr("external application %s executed with non-zero return code %i", exec_cmd, exec_result); + } + /* * Set verbal line name */ diff --git a/source/include/confread.h b/source/include/confread.h index 38ea0b0..7ababb7 100644 --- a/source/include/confread.h +++ b/source/include/confread.h @@ -243,6 +243,7 @@ typedef enum { cf_rescan_delay, cf_run_after_handshake, cf_run_after_session, + cf_run_before_session, cf_session_limit_in, cf_session_limit_out, cf_skip_files_recv,