Moved usingsyslog from svr_runopts to runopts.

This commit is contained in:
Konstantin Tokarev 2015-12-01 21:52:38 +03:00
parent 2f62128297
commit 2d6bbf341d
5 changed files with 10 additions and 7 deletions

View File

@ -172,6 +172,9 @@ void cli_getopts(int argc, char ** argv) {
#ifdef ENABLE_USER_ALGO_LIST #ifdef ENABLE_USER_ALGO_LIST
opts.cipher_list = NULL; opts.cipher_list = NULL;
opts.mac_list = NULL; opts.mac_list = NULL;
#endif
#ifndef DISABLE_SYSLOG
opts.usingsyslog = 0;
#endif #endif
/* not yet /* not yet
opts.ipv4 = 1; opts.ipv4 = 1;

View File

@ -40,6 +40,7 @@ typedef struct runopts {
unsigned int recv_window; unsigned int recv_window;
time_t keepalive_secs; /* Time between sending keepalives. 0 is off */ time_t keepalive_secs; /* Time between sending keepalives. 0 is off */
time_t idle_timeout_secs; /* Exit if no traffic is sent/received in this time */ time_t idle_timeout_secs; /* Exit if no traffic is sent/received in this time */
int usingsyslog;
#ifndef DISABLE_ZLIB #ifndef DISABLE_ZLIB
/* TODO: add a commandline flag. Currently this is on by default if compression /* TODO: add a commandline flag. Currently this is on by default if compression
@ -70,7 +71,6 @@ typedef struct svr_runopts {
char * bannerfile; char * bannerfile;
int forkbg; int forkbg;
int usingsyslog;
/* ports and addresses are arrays of the portcount /* ports and addresses are arrays of the portcount
listening ports. strings are malloced. */ listening ports. strings are malloced. */

View File

@ -145,7 +145,7 @@ void main_noinetd() {
if (svr_opts.forkbg) { if (svr_opts.forkbg) {
int closefds = 0; int closefds = 0;
#ifndef DEBUG_TRACE #ifndef DEBUG_TRACE
if (!svr_opts.usingsyslog) { if (!opts.usingsyslog) {
closefds = 1; closefds = 1;
} }
#endif #endif
@ -367,8 +367,8 @@ static void commonsetup() {
struct sigaction sa_chld; struct sigaction sa_chld;
#ifndef DISABLE_SYSLOG #ifndef DISABLE_SYSLOG
if (svr_opts.usingsyslog) {
startsyslog(); startsyslog();
if (opts.usingsyslog) {
} }
#endif #endif

View File

@ -158,7 +158,7 @@ void svr_getopts(int argc, char ** argv) {
svr_opts.domotd = 1; svr_opts.domotd = 1;
#endif #endif
#ifndef DISABLE_SYSLOG #ifndef DISABLE_SYSLOG
svr_opts.usingsyslog = 1; opts.usingsyslog = 1;
#endif #endif
opts.recv_window = DEFAULT_RECV_WINDOW; opts.recv_window = DEFAULT_RECV_WINDOW;
opts.keepalive_secs = DEFAULT_KEEPALIVE; opts.keepalive_secs = DEFAULT_KEEPALIVE;
@ -189,7 +189,7 @@ void svr_getopts(int argc, char ** argv) {
break; break;
#ifndef DISABLE_SYSLOG #ifndef DISABLE_SYSLOG
case 'E': case 'E':
svr_opts.usingsyslog = 0; opts.usingsyslog = 0;
break; break;
#endif #endif
#ifdef ENABLE_SVR_LOCALTCPFWD #ifdef ENABLE_SVR_LOCALTCPFWD

View File

@ -204,7 +204,7 @@ void svr_dropbear_log(int priority, const char* format, va_list param) {
vsnprintf(printbuf, sizeof(printbuf), format, param); vsnprintf(printbuf, sizeof(printbuf), format, param);
#ifndef DISABLE_SYSLOG #ifndef DISABLE_SYSLOG
if (svr_opts.usingsyslog) { if (opts.usingsyslog) {
syslog(priority, "%s", printbuf); syslog(priority, "%s", printbuf);
} }
#endif #endif
@ -215,7 +215,7 @@ void svr_dropbear_log(int priority, const char* format, va_list param) {
havetrace = debug_trace; havetrace = debug_trace;
#endif #endif
if (!svr_opts.usingsyslog || havetrace) if (!opts.usingsyslog || havetrace)
{ {
struct tm * local_tm = NULL; struct tm * local_tm = NULL;
timesec = time(NULL); timesec = time(NULL);