commit - 5462c6c50fd01fd516e29a42ee0b15c946c11d27
commit + 0db9a31e50598db6c01d67ea72e2970256e0558b
blob - f81c308ff8cc5f401c06511a6aaa90a42e545fc4
blob + c8dbdd3c4d012b3ae9f0172db39743e1bcc255a7
--- src/ngircd/log.c
+++ src/ngircd/log.c
GLOBAL void
-Log_Init_Resolver( void )
+Log_Init_Subprocess(char *Name)
{
#ifdef SYSLOG
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
#endif
#ifdef DEBUG
- Log_Resolver(LOG_DEBUG, "Resolver sub-process starting, PID %ld.", (long)getpid());
+ Log_Subprocess(LOG_DEBUG, "%s sub-process starting, PID %ld.",
+ Name, (long)getpid());
#endif
-} /* Log_Init_Resolver */
+}
GLOBAL void
-Log_Exit_Resolver( void )
+Log_Exit_Subprocess(char *Name)
{
#ifdef DEBUG
- Log_Resolver(LOG_DEBUG, "Resolver sub-process %ld done.", (long)getpid());
+ Log_Subprocess(LOG_DEBUG, "%s sub-process %ld done.",
+ Name, (long)getpid());
#endif
#ifdef SYSLOG
closelog( );
#endif
-} /* Log_Exit_Resolver */
+}
#ifdef PROTOTYPES
GLOBAL void
-Log_Resolver( const int Level, const char *Format, ... )
+Log_Subprocess(const int Level, const char *Format, ...)
#else
GLOBAL void
-Log_Resolver( Level, Format, va_alist )
+Log_Subprocess(Level, Format, va_alist)
const int Level;
const char *Format;
va_dcl
#endif
{
- /* Eintrag des Resolver in Logfile(s) schreiben */
-
char msg[MAX_LOG_MSG_LEN];
va_list ap;
- assert( Format != NULL );
+ assert(Format != NULL);
#ifdef DEBUG
- if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
-#else
- if( Level == LOG_DEBUG ) return;
+ if ((Level == LOG_DEBUG) && (!NGIRCd_Debug))
+ return;
+#else
+ if (Level == LOG_DEBUG)
+ return;
#endif
- /* String mit variablen Argumenten zusammenbauen ... */
#ifdef PROTOTYPES
- va_start( ap, Format );
+ va_start(ap, Format);
#else
- va_start( ap );
+ va_start(ap);
#endif
- vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
- va_end( ap );
+ vsnprintf(msg, MAX_LOG_MSG_LEN, Format, ap);
+ va_end(ap);
Log_Message(Level, msg);
-} /* Log_Resolver */
+}
/**
blob - e7e6b616a9e2bad551d56444bbee0178103dcd93
blob + 9fdb8a29adddbde629af3294c8727ed1dcf3bdf6
--- src/ngircd/log.h
+++ src/ngircd/log.h
static inline void LogDebug PARAMS(( UNUSED const char *Format, ... )){/* Do nothing. The compiler should optimize this out, please ;-) */}
#endif
-GLOBAL void Log_Init_Resolver PARAMS(( void ));
-GLOBAL void Log_Exit_Resolver PARAMS(( void ));
+GLOBAL void Log_Init_Subprocess PARAMS((char *Name));
+GLOBAL void Log_Exit_Subprocess PARAMS((char *Name));
-GLOBAL void Log_Resolver 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 ));
blob - 295a559f6f14a551c6f66cb89b3036e620511db3
blob + e5ac9ec805dc6110c3b75ba9c451d7ae94bdfc94
--- src/ngircd/resolve.c
+++ src/ngircd/resolve.c
/* Sub process */
Init_Subprocess();
Do_ResolveAddr( Addr, identsock, pipefd[1]);
- Log_Exit_Resolver( );
+ Log_Exit_Subprocess("Resolver");
exit(0);
}
return false;
/* Sub process */
Init_Subprocess();
Do_ResolveName(Host, pipefd[1]);
- Log_Exit_Resolver( );
+ Log_Exit_Subprocess("Resolver");
exit(0);
}
return false;
switch(Signal) {
case SIGTERM:
#ifdef DEBUG
- Log_Resolver(LOG_DEBUG, "Resolver: Got TERM signal, exiting.");
+ Log_Subprocess(LOG_DEBUG, "Resolver: Got TERM signal, exiting.");
#endif
exit(1);
}
Init_Subprocess(void)
{
signal(SIGTERM, Signal_Handler);
- Log_Init_Resolver();
+ Log_Init_Subprocess("Resolver");
}
return;
#ifdef DEBUG
- Log_Resolver(LOG_DEBUG, "Doing IDENT lookup on socket %d ...", identsock);
+ Log_Subprocess(LOG_DEBUG, "Doing IDENT lookup on socket %d ...",
+ identsock);
#endif
res = ident_id( identsock, 10 );
#ifdef DEBUG
- Log_Resolver(LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"",
- identsock, res ? res : "(NULL)" );
+ Log_Subprocess(LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"",
+ identsock, res ? res : "(NULL)");
#endif
if (!res) /* no result */
return;
if (!array_cats(resolved_addr, res))
- Log_Resolver(LOG_WARNING, "Resolver: Cannot copy IDENT result: %s!", strerror(errno));
+ Log_Subprocess(LOG_WARNING,
+ "Resolver: Cannot copy IDENT result: %s!",
+ strerror(errno));
free(res);
#else
assert(reslen >= NG_INET_ADDRSTRLEN);
ng_ipaddr_tostr_r(IpAddr, tmp_ip_str);
- Log_Resolver(LOG_WARNING, "%s: Can't resolve address \"%s\": %s",
+ Log_Subprocess(LOG_WARNING, "%s: Can't resolve address \"%s\": %s",
funcname, tmp_ip_str, errmsg);
strlcpy(resbuf, tmp_ip_str, reslen);
return false;
switch (res) {
case 0: break;
case EAI_SYSTEM:
- Log_Resolver(LOG_WARNING, "Can't resolve \"%s\": %s", hostname, strerror(errno));
+ Log_Subprocess(LOG_WARNING, "Can't resolve \"%s\": %s", hostname, strerror(errno));
return false;
default:
- Log_Resolver(LOG_WARNING, "Can't resolve \"%s\": %s", hostname, gai_strerror(res));
+ Log_Subprocess(LOG_WARNING, "Can't resolve \"%s\": %s", hostname, gai_strerror(res));
return false;
}
if (!h) {
#ifdef h_errno
- Log_Resolver(LOG_WARNING, "Can't resolve \"%s\": %s", hostname, Get_Error(h_errno));
+ Log_Subprocess(LOG_WARNING, "Can't resolve \"%s\": %s",
+ hostname, Get_Error(h_errno));
#else
- Log_Resolver(LOG_WARNING, "Can't resolve \"%s\"", hostname);
+ Log_Subprocess(LOG_WARNING, "Can't resolve \"%s\"", hostname);
#endif
return false;
}
tmpAddrs = array_start(resolved_addr);
while (len > 0) {
- Log_Resolver(LOG_WARNING, "Address mismatch: %s != %s",
+ Log_Subprocess(LOG_WARNING, "Address mismatch: %s != %s",
tmp_ip_str, ng_ipaddr_tostr(tmpAddrs));
tmpAddrs++;
len--;
static void
Log_Forgery_NoIP(const char *ip, const char *host)
{
- Log_Resolver(LOG_WARNING, "Possible forgery: %s resolved to %s "
+ Log_Subprocess(LOG_WARNING, "Possible forgery: %s resolved to %s "
"(which has no ip address)", ip, host);
}
static void
Log_Forgery_WrongIP(const char *ip, const char *host)
{
- Log_Resolver(LOG_WARNING,"Possible forgery: %s resolved to %s "
+ Log_Subprocess(LOG_WARNING,"Possible forgery: %s resolved to %s "
"(which points to different address)", ip, host);
}
assert(data);
if( (size_t)write(fd, data, len) != len )
- Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!",
+ Log_Subprocess( LOG_CRIT, "Resolver: Can't write to parent: %s!",
strerror(errno));
}
array_init(&resolved_addr);
ng_ipaddr_tostr_r(Addr, tmp_ip_str);
#ifdef DEBUG
- Log_Resolver(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)))
goto dns_done;
strlcpy(hostname, tmp_ip_str, sizeof(hostname));
}
#ifdef DEBUG
- Log_Resolver(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:
len = strlen(hostname);
hostname[len] = '\n';
if (!array_copyb(&resolved_addr, hostname, ++len)) {
- Log_Resolver(LOG_CRIT, "Resolver: Can't copy resolved name: %s!", strerror(errno));
+ Log_Subprocess(LOG_CRIT,
+ "Resolver: Can't copy resolved name: %s!",
+ strerror(errno));
array_free(&resolved_addr);
return;
}
ng_ipaddr_t *addr;
size_t len;
#endif
- Log_Resolver(LOG_DEBUG, "Now resolving \"%s\" ...", Host);
+ Log_Subprocess(LOG_DEBUG, "Now resolving \"%s\" ...", Host);
array_init(&IpAddrs);
/* Resolve hostname */
addr = array_start(&IpAddrs);
assert(addr);
for (; len > 0; --len,addr++) {
- Log_Resolver(LOG_DEBUG, "translated \"%s\" to %s.",
+ Log_Subprocess(LOG_DEBUG, "translated \"%s\" to %s.",
Host, ng_ipaddr_tostr(addr));
}
#endif