mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-12 01:40:27 +00:00
Make the debug loglevel always available
This basically means to unifdef DEBUG in (almost) all places. We keep it in src/portab/portab.h so DEBUG stays available to enable assert(). Also add a comment about this.
This commit is contained in:
parent
8e9c789ae1
commit
c7de505c91
@ -698,10 +698,8 @@ Client_ID( CLIENT *Client )
|
|||||||
{
|
{
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
if(Client->type == CLIENT_USER)
|
if(Client->type == CLIENT_USER)
|
||||||
assert(strlen(Client->id) < Conf_MaxNickLength);
|
assert(strlen(Client->id) < Conf_MaxNickLength);
|
||||||
#endif
|
|
||||||
|
|
||||||
if( Client->id[0] ) return Client->id;
|
if( Client->id[0] ) return Client->id;
|
||||||
else return "*";
|
else return "*";
|
||||||
@ -1694,7 +1692,6 @@ Client_Announce(CLIENT * Client, CLIENT * Prefix, CLIENT * User)
|
|||||||
} /* Client_Announce */
|
} /* Client_Announce */
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
|
||||||
GLOBAL void
|
GLOBAL void
|
||||||
Client_DebugDump(void)
|
Client_DebugDump(void)
|
||||||
@ -1713,7 +1710,6 @@ Client_DebugDump(void)
|
|||||||
}
|
}
|
||||||
} /* Client_DumpClients */
|
} /* Client_DumpClients */
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
@ -182,9 +182,7 @@ GLOBAL void Client_UpdateCloakedHostname PARAMS((CLIENT *Client,
|
|||||||
const char *hostname));
|
const char *hostname));
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
GLOBAL void Client_DebugDump PARAMS((void));
|
GLOBAL void Client_DebugDump PARAMS((void));
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2046,9 +2046,7 @@ Validate_Config(bool Configtest, bool Rehash)
|
|||||||
{
|
{
|
||||||
/* Validate configuration settings. */
|
/* Validate configuration settings. */
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
int i, servers, servers_once;
|
int i, servers, servers_once;
|
||||||
#endif
|
|
||||||
bool config_valid = true;
|
bool config_valid = true;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
@ -2122,7 +2120,6 @@ Validate_Config(bool Configtest, bool Rehash)
|
|||||||
"Maximum penalty increase ('MaxPenaltyTime') is set to %ld, this is not recommended!",
|
"Maximum penalty increase ('MaxPenaltyTime') is set to %ld, this is not recommended!",
|
||||||
Conf_MaxPenaltyTime);
|
Conf_MaxPenaltyTime);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
servers = servers_once = 0;
|
servers = servers_once = 0;
|
||||||
for (i = 0; i < MAX_SERVERS; i++) {
|
for (i = 0; i < MAX_SERVERS; i++) {
|
||||||
if (Conf_Server[i].name[0]) {
|
if (Conf_Server[i].name[0]) {
|
||||||
@ -2135,7 +2132,6 @@ Validate_Config(bool Configtest, bool Rehash)
|
|||||||
array_length(&Conf_Opers, sizeof(struct Conf_Oper)),
|
array_length(&Conf_Opers, sizeof(struct Conf_Oper)),
|
||||||
servers, servers_once,
|
servers, servers_once,
|
||||||
array_length(&Conf_Channels, sizeof(struct Conf_Channel)));
|
array_length(&Conf_Channels, sizeof(struct Conf_Channel)));
|
||||||
#endif
|
|
||||||
|
|
||||||
return config_valid;
|
return config_valid;
|
||||||
}
|
}
|
||||||
@ -2222,7 +2218,6 @@ va_dcl
|
|||||||
Log(Level, "%s", msg);
|
Log(Level, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dump internal state of the "configuration module".
|
* Dump internal state of the "configuration module".
|
||||||
@ -2245,7 +2240,6 @@ Conf_DebugDump(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize server configuration structure to default values.
|
* Initialize server configuration structure to default values.
|
||||||
|
@ -280,9 +280,7 @@ GLOBAL bool Conf_SSLInUse PARAMS((void));
|
|||||||
/* Password required by WEBIRC command */
|
/* Password required by WEBIRC command */
|
||||||
GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
|
GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
GLOBAL void Conf_DebugDump PARAMS((void));
|
GLOBAL void Conf_DebugDump PARAMS((void));
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2341,10 +2341,8 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events )
|
|||||||
|
|
||||||
Class_HandleServerBans(c);
|
Class_HandleServerBans(c);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
else
|
else
|
||||||
LogDebug("Resolver: discarding result for already registered connection %d.", i);
|
LogDebug("Resolver: discarding result for already registered connection %d.", i);
|
||||||
#endif
|
|
||||||
} /* cb_Read_Resolver_Result */
|
} /* cb_Read_Resolver_Result */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2688,7 +2686,6 @@ Conn_SetCertFp(UNUSED CONN_ID Idx, UNUSED const char *fingerprint)
|
|||||||
|
|
||||||
#endif /* SSL_SUPPORT */
|
#endif /* SSL_SUPPORT */
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dump internal state of the "connection module".
|
* Dump internal state of the "connection module".
|
||||||
@ -2712,6 +2709,5 @@ Conn_DebugDump(void)
|
|||||||
}
|
}
|
||||||
} /* Conn_DumpClients */
|
} /* Conn_DumpClients */
|
||||||
|
|
||||||
#endif /* DEBUG */
|
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
@ -166,9 +166,7 @@ GLOBAL long Conn_GetAuthPing PARAMS((CONN_ID Idx));
|
|||||||
GLOBAL void Conn_SetAuthPing PARAMS((CONN_ID Idx, long ID));
|
GLOBAL void Conn_SetAuthPing PARAMS((CONN_ID Idx, long ID));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
GLOBAL void Conn_DebugDump PARAMS((void));
|
GLOBAL void Conn_DebugDump PARAMS((void));
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -121,7 +121,6 @@ Log_Exit( void )
|
|||||||
* @param Format Format string like printf().
|
* @param Format Format string like printf().
|
||||||
* @param ... Further arguments.
|
* @param ... Further arguments.
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG
|
|
||||||
# ifdef PROTOTYPES
|
# ifdef PROTOTYPES
|
||||||
GLOBAL void
|
GLOBAL void
|
||||||
LogDebug( const char *Format, ... )
|
LogDebug( const char *Format, ... )
|
||||||
@ -145,7 +144,6 @@ va_dcl
|
|||||||
va_end( ap );
|
va_end( ap );
|
||||||
Log(LOG_DEBUG, "%s", msg);
|
Log(LOG_DEBUG, "%s", msg);
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,11 +182,7 @@ va_dcl
|
|||||||
}
|
}
|
||||||
else snotice = false;
|
else snotice = false;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
|
if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
|
||||||
#else
|
|
||||||
if( Level == LOG_DEBUG ) return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PROTOTYPES
|
#ifdef PROTOTYPES
|
||||||
va_start( ap, Format );
|
va_start( ap, Format );
|
||||||
@ -215,20 +209,16 @@ Log_Init_Subprocess(char UNUSED *Name)
|
|||||||
#ifdef SYSLOG
|
#ifdef SYSLOG
|
||||||
openlog(PACKAGE, LOG_CONS|LOG_PID, Conf_SyslogFacility);
|
openlog(PACKAGE, LOG_CONS|LOG_PID, Conf_SyslogFacility);
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG
|
|
||||||
Log_Subprocess(LOG_DEBUG, "%s sub-process starting, PID %ld.",
|
Log_Subprocess(LOG_DEBUG, "%s sub-process starting, PID %ld.",
|
||||||
Name, (long)getpid());
|
Name, (long)getpid());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLOBAL void
|
GLOBAL void
|
||||||
Log_Exit_Subprocess(char UNUSED *Name)
|
Log_Exit_Subprocess(char UNUSED *Name)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
|
||||||
Log_Subprocess(LOG_DEBUG, "%s sub-process %ld done.",
|
Log_Subprocess(LOG_DEBUG, "%s sub-process %ld done.",
|
||||||
Name, (long)getpid());
|
Name, (long)getpid());
|
||||||
#endif
|
|
||||||
#ifdef SYSLOG
|
#ifdef SYSLOG
|
||||||
closelog( );
|
closelog( );
|
||||||
#endif
|
#endif
|
||||||
@ -251,13 +241,8 @@ va_dcl
|
|||||||
|
|
||||||
assert(Format != NULL);
|
assert(Format != NULL);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
if ((Level == LOG_DEBUG) && (!NGIRCd_Debug))
|
if ((Level == LOG_DEBUG) && (!NGIRCd_Debug))
|
||||||
return;
|
return;
|
||||||
#else
|
|
||||||
if (Level == LOG_DEBUG)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PROTOTYPES
|
#ifdef PROTOTYPES
|
||||||
va_start(ap, Format);
|
va_start(ap, Format);
|
||||||
|
@ -40,20 +40,14 @@ GLOBAL void Log_ReInit PARAMS((void));
|
|||||||
|
|
||||||
GLOBAL void Log_ServerNotice PARAMS((char UserMode, const char *Format, ...));
|
GLOBAL void Log_ServerNotice PARAMS((char UserMode, const char *Format, ...));
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
GLOBAL void LogDebug PARAMS(( const char *Format, ... ));
|
GLOBAL void LogDebug PARAMS(( const char *Format, ... ));
|
||||||
#else
|
|
||||||
static inline void LogDebug PARAMS(( UNUSED const char *Format, ... )){/* Do nothing. The compiler should optimize this out, please ;-) */}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GLOBAL void Log_Init_Subprocess PARAMS((char *Name));
|
GLOBAL void Log_Init_Subprocess PARAMS((char *Name));
|
||||||
GLOBAL void Log_Exit_Subprocess PARAMS((char *Name));
|
GLOBAL void Log_Exit_Subprocess PARAMS((char *Name));
|
||||||
|
|
||||||
GLOBAL void Log_Subprocess PARAMS((const int Level, const char *Format, ...));
|
GLOBAL void Log_Subprocess PARAMS((const int Level, const char *Format, ...));
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
GLOBAL void Log_InitErrorfile PARAMS(( void ));
|
GLOBAL void Log_InitErrorfile PARAMS(( void ));
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -88,9 +88,7 @@ main(int argc, const char *argv[])
|
|||||||
|
|
||||||
NGIRCd_SignalQuit = NGIRCd_SignalRestart = false;
|
NGIRCd_SignalQuit = NGIRCd_SignalRestart = false;
|
||||||
NGIRCd_Passive = false;
|
NGIRCd_Passive = false;
|
||||||
#ifdef DEBUG
|
|
||||||
NGIRCd_Debug = false;
|
NGIRCd_Debug = false;
|
||||||
#endif
|
|
||||||
#ifdef SNIFFER
|
#ifdef SNIFFER
|
||||||
NGIRCd_Sniffer = false;
|
NGIRCd_Sniffer = false;
|
||||||
#endif
|
#endif
|
||||||
@ -117,12 +115,10 @@ main(int argc, const char *argv[])
|
|||||||
configtest = true;
|
configtest = true;
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
if (strcmp(argv[i], "--debug") == 0) {
|
if (strcmp(argv[i], "--debug") == 0) {
|
||||||
NGIRCd_Debug = true;
|
NGIRCd_Debug = true;
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (strcmp(argv[i], "--help") == 0) {
|
if (strcmp(argv[i], "--help") == 0) {
|
||||||
Show_Version();
|
Show_Version();
|
||||||
puts(""); Show_Help( ); puts( "" );
|
puts(""); Show_Help( ); puts( "" );
|
||||||
@ -151,12 +147,10 @@ main(int argc, const char *argv[])
|
|||||||
/* short option */
|
/* short option */
|
||||||
for (n = 1; n < strlen(argv[i]); n++) {
|
for (n = 1; n < strlen(argv[i]); n++) {
|
||||||
ok = false;
|
ok = false;
|
||||||
#ifdef DEBUG
|
|
||||||
if (argv[i][n] == 'd') {
|
if (argv[i][n] == 'd') {
|
||||||
NGIRCd_Debug = true;
|
NGIRCd_Debug = true;
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (argv[i][n] == 'f') {
|
if (argv[i][n] == 'f') {
|
||||||
if (!argv[i][n+1] && i+1 < argc) {
|
if (!argv[i][n+1] && i+1 < argc) {
|
||||||
/* Ok, next character is a blank */
|
/* Ok, next character is a blank */
|
||||||
@ -223,10 +217,8 @@ main(int argc, const char *argv[])
|
|||||||
|
|
||||||
/* Debug level for "VERSION" command */
|
/* Debug level for "VERSION" command */
|
||||||
NGIRCd_DebugLevel[0] = '\0';
|
NGIRCd_DebugLevel[0] = '\0';
|
||||||
#ifdef DEBUG
|
|
||||||
if (NGIRCd_Debug)
|
if (NGIRCd_Debug)
|
||||||
strcpy(NGIRCd_DebugLevel, "1");
|
strcpy(NGIRCd_DebugLevel, "1");
|
||||||
#endif
|
|
||||||
#ifdef SNIFFER
|
#ifdef SNIFFER
|
||||||
if (NGIRCd_Sniffer) {
|
if (NGIRCd_Sniffer) {
|
||||||
NGIRCd_Debug = true;
|
NGIRCd_Debug = true;
|
||||||
@ -349,13 +341,11 @@ Fill_Version(void)
|
|||||||
strlcat(NGIRCd_VersionAddition, "CHARCONV",
|
strlcat(NGIRCd_VersionAddition, "CHARCONV",
|
||||||
sizeof NGIRCd_VersionAddition);
|
sizeof NGIRCd_VersionAddition);
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG
|
|
||||||
if (NGIRCd_VersionAddition[0])
|
if (NGIRCd_VersionAddition[0])
|
||||||
strlcat(NGIRCd_VersionAddition, "+",
|
strlcat(NGIRCd_VersionAddition, "+",
|
||||||
sizeof NGIRCd_VersionAddition);
|
sizeof NGIRCd_VersionAddition);
|
||||||
strlcat(NGIRCd_VersionAddition, "DEBUG",
|
strlcat(NGIRCd_VersionAddition, "DEBUG",
|
||||||
sizeof NGIRCd_VersionAddition);
|
sizeof NGIRCd_VersionAddition);
|
||||||
#endif
|
|
||||||
#ifdef IDENTAUTH
|
#ifdef IDENTAUTH
|
||||||
if (NGIRCd_VersionAddition[0])
|
if (NGIRCd_VersionAddition[0])
|
||||||
strlcat(NGIRCd_VersionAddition, "+",
|
strlcat(NGIRCd_VersionAddition, "+",
|
||||||
@ -466,9 +456,7 @@ Show_Version( void )
|
|||||||
static void
|
static void
|
||||||
Show_Help( void )
|
Show_Help( void )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
|
||||||
puts( " -d, --debug log extra debug messages" );
|
puts( " -d, --debug log extra debug messages" );
|
||||||
#endif
|
|
||||||
puts( " -f, --config <f> use file <f> as configuration file" );
|
puts( " -f, --config <f> use file <f> as configuration file" );
|
||||||
puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" );
|
puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" );
|
||||||
puts( " -p, --passive disable automatic connections to other servers" );
|
puts( " -p, --passive disable automatic connections to other servers" );
|
||||||
|
@ -35,10 +35,8 @@ GLOBAL char NGIRCd_Version[126];
|
|||||||
/** String specifying the compile-time options and target platform */
|
/** String specifying the compile-time options and target platform */
|
||||||
GLOBAL char NGIRCd_VersionAddition[126];
|
GLOBAL char NGIRCd_VersionAddition[126];
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
/** Flag indicating if debug mode is active (true) or not (false) */
|
/** Flag indicating if debug mode is active (true) or not (false) */
|
||||||
GLOBAL bool NGIRCd_Debug;
|
GLOBAL bool NGIRCd_Debug;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SNIFFER
|
#ifdef SNIFFER
|
||||||
/** Flag indication if sniffer is active (true) or not (false) */
|
/** Flag indication if sniffer is active (true) or not (false) */
|
||||||
|
@ -217,10 +217,8 @@ Send_CHANINFO(CLIENT * Client, CHANNEL * Chan)
|
|||||||
char *modes, *topic, *key;
|
char *modes, *topic, *key;
|
||||||
bool has_k, has_l;
|
bool has_k, has_l;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
Log(LOG_DEBUG, "Sending CHANINFO commands for \"%s\" ...",
|
Log(LOG_DEBUG, "Sending CHANINFO commands for \"%s\" ...",
|
||||||
Channel_Name(Chan));
|
Channel_Name(Chan));
|
||||||
#endif
|
|
||||||
|
|
||||||
modes = Channel_Modes(Chan);
|
modes = Channel_Modes(Chan);
|
||||||
topic = Channel_Topic(Chan);
|
topic = Channel_Topic(Chan);
|
||||||
|
@ -114,14 +114,10 @@ Proc_GenericSignalHandler(int Signal)
|
|||||||
{
|
{
|
||||||
switch(Signal) {
|
switch(Signal) {
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
#ifdef DEBUG
|
|
||||||
Log_Subprocess(LOG_DEBUG, "Child got TERM signal, exiting.");
|
Log_Subprocess(LOG_DEBUG, "Child got TERM signal, exiting.");
|
||||||
#endif
|
|
||||||
exit(1);
|
exit(1);
|
||||||
case SIGALRM:
|
case SIGALRM:
|
||||||
#ifdef DEBUG
|
|
||||||
Log_Subprocess(LOG_DEBUG, "Child got ALARM signal, exiting.");
|
Log_Subprocess(LOG_DEBUG, "Child got ALARM signal, exiting.");
|
||||||
#endif
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,9 +93,7 @@ Resolve_Name( PROC_STAT *s, const char *Host, void (*cbfunc)(int, short))
|
|||||||
pid = Proc_Fork(s, pipefd, cbfunc, RESOLVER_TIMEOUT);
|
pid = Proc_Fork(s, pipefd, cbfunc, RESOLVER_TIMEOUT);
|
||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
/* Main process */
|
/* Main process */
|
||||||
#ifdef DEBUG
|
|
||||||
Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid );
|
Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid );
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
} else if( pid == 0 ) {
|
} else if( pid == 0 ) {
|
||||||
/* Sub process */
|
/* Sub process */
|
||||||
@ -140,15 +138,11 @@ Do_IdentQuery(int identsock, array *resolved_addr)
|
|||||||
if (identsock < 0)
|
if (identsock < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
Log_Subprocess(LOG_DEBUG, "Doing IDENT lookup on socket %d ...",
|
Log_Subprocess(LOG_DEBUG, "Doing IDENT lookup on socket %d ...",
|
||||||
identsock);
|
identsock);
|
||||||
#endif
|
|
||||||
res = ident_id( identsock, 10 );
|
res = ident_id( identsock, 10 );
|
||||||
#ifdef DEBUG
|
|
||||||
Log_Subprocess(LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"",
|
Log_Subprocess(LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"",
|
||||||
identsock, res ? res : "(NULL)");
|
identsock, res ? res : "(NULL)");
|
||||||
#endif
|
|
||||||
if (!res) /* no result */
|
if (!res) /* no result */
|
||||||
return;
|
return;
|
||||||
if (!array_cats(resolved_addr, res))
|
if (!array_cats(resolved_addr, res))
|
||||||
@ -373,9 +367,7 @@ Do_ResolveAddr(const ng_ipaddr_t *Addr, int identsock, int w_fd)
|
|||||||
|
|
||||||
array_init(&resolved_addr);
|
array_init(&resolved_addr);
|
||||||
ng_ipaddr_tostr_r(Addr, tmp_ip_str);
|
ng_ipaddr_tostr_r(Addr, tmp_ip_str);
|
||||||
#ifdef DEBUG
|
|
||||||
Log_Subprocess(LOG_DEBUG, "Now resolving %s ...", tmp_ip_str);
|
Log_Subprocess(LOG_DEBUG, "Now resolving %s ...", tmp_ip_str);
|
||||||
#endif
|
|
||||||
if (!ReverseLookup(Addr, hostname, sizeof(hostname)))
|
if (!ReverseLookup(Addr, hostname, sizeof(hostname)))
|
||||||
goto dns_done;
|
goto dns_done;
|
||||||
|
|
||||||
@ -388,9 +380,7 @@ Do_ResolveAddr(const ng_ipaddr_t *Addr, int identsock, int w_fd)
|
|||||||
Log_Forgery_NoIP(tmp_ip_str, hostname);
|
Log_Forgery_NoIP(tmp_ip_str, hostname);
|
||||||
strlcpy(hostname, tmp_ip_str, sizeof(hostname));
|
strlcpy(hostname, tmp_ip_str, sizeof(hostname));
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
Log_Subprocess(LOG_DEBUG, "Ok, translated %s to \"%s\".", tmp_ip_str, hostname);
|
Log_Subprocess(LOG_DEBUG, "Ok, translated %s to \"%s\".", tmp_ip_str, hostname);
|
||||||
#endif
|
|
||||||
dns_done:
|
dns_done:
|
||||||
len = strlen(hostname);
|
len = strlen(hostname);
|
||||||
hostname[len] = '\n';
|
hostname[len] = '\n';
|
||||||
@ -417,10 +407,8 @@ Do_ResolveName( const char *Host, int w_fd )
|
|||||||
* to parent. */
|
* to parent. */
|
||||||
array IpAddrs;
|
array IpAddrs;
|
||||||
int af;
|
int af;
|
||||||
#ifdef DEBUG
|
|
||||||
ng_ipaddr_t *addr;
|
ng_ipaddr_t *addr;
|
||||||
size_t len;
|
size_t len;
|
||||||
#endif
|
|
||||||
Log_Subprocess(LOG_DEBUG, "Now resolving \"%s\" ...", Host);
|
Log_Subprocess(LOG_DEBUG, "Now resolving \"%s\" ...", Host);
|
||||||
|
|
||||||
array_init(&IpAddrs);
|
array_init(&IpAddrs);
|
||||||
@ -440,7 +428,6 @@ Do_ResolveName( const char *Host, int w_fd )
|
|||||||
close(w_fd);
|
close(w_fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
len = array_length(&IpAddrs, sizeof(*addr));
|
len = array_length(&IpAddrs, sizeof(*addr));
|
||||||
assert(len > 0);
|
assert(len > 0);
|
||||||
addr = array_start(&IpAddrs);
|
addr = array_start(&IpAddrs);
|
||||||
@ -449,7 +436,6 @@ Do_ResolveName( const char *Host, int w_fd )
|
|||||||
Log_Subprocess(LOG_DEBUG, "translated \"%s\" to %s.",
|
Log_Subprocess(LOG_DEBUG, "translated \"%s\" to %s.",
|
||||||
Host, ng_ipaddr_tostr(addr));
|
Host, ng_ipaddr_tostr(addr));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* Write result into pipe to parent */
|
/* Write result into pipe to parent */
|
||||||
ArrayWrite(w_fd, &IpAddrs);
|
ArrayWrite(w_fd, &IpAddrs);
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ static const int signals_catch[] = {
|
|||||||
SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGCHLD, SIGUSR1, SIGUSR2
|
SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGCHLD, SIGUSR1, SIGUSR2
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Dump_State(void)
|
Dump_State(void)
|
||||||
@ -59,7 +58,6 @@ Dump_State(void)
|
|||||||
LogDebug("--- End of state dump ---");
|
LogDebug("--- End of state dump ---");
|
||||||
} /* Dump_State */
|
} /* Dump_State */
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Signal_Block(int sig)
|
Signal_Block(int sig)
|
||||||
@ -174,7 +172,6 @@ Signal_Handler(int Signal)
|
|||||||
while (waitpid( -1, NULL, WNOHANG) > 0)
|
while (waitpid( -1, NULL, WNOHANG) > 0)
|
||||||
;
|
;
|
||||||
return;
|
return;
|
||||||
#ifdef DEBUG
|
|
||||||
case SIGUSR1:
|
case SIGUSR1:
|
||||||
if (! NGIRCd_Debug) {
|
if (! NGIRCd_Debug) {
|
||||||
Log(LOG_INFO|LOG_snotice,
|
Log(LOG_INFO|LOG_snotice,
|
||||||
@ -197,7 +194,6 @@ Signal_Handler(int Signal)
|
|||||||
#endif /* SNIFFER */
|
#endif /* SNIFFER */
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -226,7 +222,6 @@ Signal_Handler_BH(int Signal)
|
|||||||
/* re-read configuration */
|
/* re-read configuration */
|
||||||
Rehash();
|
Rehash();
|
||||||
break;
|
break;
|
||||||
#ifdef DEBUG
|
|
||||||
case SIGUSR2:
|
case SIGUSR2:
|
||||||
if (NGIRCd_Debug) {
|
if (NGIRCd_Debug) {
|
||||||
Log(LOG_INFO|LOG_snotice,
|
Log(LOG_INFO|LOG_snotice,
|
||||||
@ -236,7 +231,6 @@ Signal_Handler_BH(int Signal)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogDebug("Got signal %d! Ignored.", Signal);
|
LogDebug("Got signal %d! Ignored.", Signal);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
Signal_Unblock(Signal);
|
Signal_Unblock(Signal);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
/* remove assert() macro at compile time if DEBUG is not set. */
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
# define NDEBUG
|
# define NDEBUG
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user