Re: hfaxd filling my logs with `-> Got a: 127.0.0.1[13] (how to stop this??)
Lee Howard <[email protected]> Fri, 27 Oct 2017 10:36:45 -0700
| Newsgroups | gmane.comp.telephony.fax.hylafax.user |
|---|---|
| Message-ID | <[email protected]> |
On 10/27/2017 09:33 AM, Aidan Van Dyk wrote:
> There are a smattering of LOG_DEBUG syslogs in the code, those could
> probably be removed.
Or put them into a debug context which requires specific enabling.
hfaxd/InetFaxServer.c++: if (debug) logDebug("`-> Got a: %s[%u]",
(const char*)a, pos);
hfaxd/InetFaxServer.c++: if (debug) logDebug("`-> Got a: %s[%u]",
(const char*)p, pos);
I don't know if the attached patch will apply to modern HylaFAX.org
codebase - since it was applied to HylaFAX+ six years ago - but I think
that it just moves this stuff into a debug context. It may not even be
runtime configurable.
Thanks,
Lee.
hylafax-debugpasv.patch
(text/x-patch, 3.2 KB)
diff -Nru hylafax.orig/hfaxd/InetFaxServer.c++ hylafax/hfaxd/InetFaxServer.c++
--- hylafax.orig/hfaxd/InetFaxServer.c++ 2011-09-03 11:48:17.358318016 -0700
+++ hylafax/hfaxd/InetFaxServer.c++ 2011-09-03 12:00:44.675708504 -0700
@@ -139,6 +139,7 @@
InetFaxServer::InetFaxServer()
{
usedefault = true;
+ debug = false;
swaitmax = 90; // wait at most 90 seconds
swaitint = 5; // interval between retries
@@ -416,7 +417,7 @@
{
if (tokenBody[0] == 'E') {
pasv_addr = ctrl_addr;
- logDebug("Extended passive requested for family %d", Socket::family(pasv_addr));
+ if (debug) logDebug("Extended passive requested for family %d", Socket::family(pasv_addr));
pdata = socket(Socket::family(pasv_addr), SOCK_STREAM, 0);
if (pdata >= 0) {
Socket::port(pasv_addr) = 0;
@@ -577,7 +578,7 @@
bool
InetFaxServer::hostPort()
{
- logDebug("Parsing hostPort(): \"%s\"", (const char*)tokenBody);
+ if (debug) logDebug("Parsing hostPort(): \"%s\"", (const char*)tokenBody);
if (tokenBody[0] == 'E')
{
@@ -588,26 +589,28 @@
syntaxError("EPRT |family|address|port|");
return false;
}
- logDebug("Parsing \"%s\"", (const char*)s);
+ if (debug) logDebug("Parsing \"%s\"", (const char*)s);
/*
* Minimual length for EPRT is: 9
* |X|X::|X|
*/
char c = s[0];
- logDebug(" `-> s.length() = %d", s.length());
- logDebug(" `-> s[0] = '%c'", s[0]);
- logDebug(" `-> s[2] = '%c'", s[2]);
- logDebug(" `-> s[%d] = '%c'", s.length()-1, s[s.length()-1]);
+ if (debug) {
+ logDebug(" `-> s.length() = %d", s.length());
+ logDebug(" `-> s[0] = '%c'", s[0]);
+ logDebug(" `-> s[2] = '%c'", s[2]);
+ logDebug(" `-> s[%d] = '%c'", s.length()-1, s[s.length()-1]);
+ }
if (s.length() > 9
&& c == s[0] && (s[1] == '1' || s[1] == '2') && c == s[2]
&& c == s[s.length()-1]) {
- logDebug("Looks like extended syntax: \"%s\" [%X: %c]", (const char*)s, c&0xFF, c);
+ if (debug) logDebug("Looks like extended syntax: \"%s\" [%X: %c]", (const char*)s, c&0xFF, c);
u_int pos = 3;
fxStr a = s.token(pos, c);
- logDebug("`-> Got a: %s[%u]", (const char*)a, pos);
+ if (debug) logDebug("`-> Got a: %s[%u]", (const char*)a, pos);
fxStr p = s.token(pos, c);
- logDebug("`-> Got a: %s[%u]", (const char*)p, pos);
+ if (debug) logDebug("`-> Got a: %s[%u]", (const char*)p, pos);
if (pos != s.length() )
{
logDebug("Parsing EPRT style failed");
@@ -615,7 +618,7 @@
return false;
}
- logDebug("Parsed: Family %c Address %s Port %s", s[1], (const char*)a, (const char*)p);
+ if (debug) logDebug("Parsed: Family %c Address %s Port %s", s[1], (const char*)a, (const char*)p);
struct addrinfo hints, *ai;
memset(&hints, 0, sizeof(hints));
diff -Nru hylafax.orig/hfaxd/InetFaxServer.h hylafax/hfaxd/InetFaxServer.h
--- hylafax.orig/hfaxd/InetFaxServer.h 2011-09-03 11:48:17.345319992 -0700
+++ hylafax/hfaxd/InetFaxServer.h 2011-09-03 12:00:01.669246480 -0700
@@ -43,6 +43,7 @@
Socket::Address data_dest; // destination of data connection
Socket::Address pasv_addr; // local end of passive connections
bool usedefault; // for data transfers
+ bool debug;
/*
* Timeout intervals for retrying connections
* to hosts that don't accept PORT cmds.