Update of /cvsroot/spamassassin/spamassassin/spamd
In directory sc8-pr-cvs1:/tmp/cvs-serv22014/spamd
Modified Files:
libspamc.c
Log Message:
removed connect() debugging from libspamc, bug seems fixed now
Index: libspamc.c
===================================================================
RCS file: /cvsroot/spamassassin/spamassassin/spamd/libspamc.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -b -w -u -d -r1.25 -r1.26
--- libspamc.c 1 Feb 2003 16:21:47 -0000 1.25
+++ libspamc.c 2 Feb 2003 15:30:24 -0000 1.26
@@ -75,7 +75,8 @@
#define EX__MAX 200
#endif
-static const int DO_CONNECT_DEBUG_SYSLOGS = 1;
+#undef DO_CONNECT_DEBUG_SYSLOGS
+/* or #define DO_CONNECT_DEBUG_SYSLOGS 1 */
static const int ESC_PASSTHROUGHRAW = EX__MAX+666;
@@ -109,7 +110,9 @@
struct sockaddr_in addrbuf, *addr;
struct in_addr inaddrlist[256];
- int i; char dbgbuf[2048]; int dbgbuflen = 0; // DBG
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
+ int dbgiter; char dbgbuf[2048]; int dbgbuflen = 0;
+#endif
/* NOTE: do not call syslog() (unless you are about to return) before
* we take a copy of the h_addr_list.
@@ -129,6 +132,8 @@
memset (inaddrlist, 0, sizeof(inaddrlist));
for (hostnum=0; hent->h_addr_list[hostnum] != 0; hostnum++) {
+
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
dbgbuflen += snprintf (dbgbuf+dbgbuflen, 2047-dbgbuflen,
"[%d %lx: %d.%d.%d.%d]",
hostnum, hent->h_addr_list[hostnum],
@@ -136,6 +141,7 @@
hent->h_addr_list[hostnum][1],
hent->h_addr_list[hostnum][2],
hent->h_addr_list[hostnum][3]);
+#endif
if (hostnum > 255) {
syslog (LOG_ERR, "too many address in hostent (%d), ignoring others",
@@ -149,34 +155,38 @@
return EX_SOFTWARE;
}
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
dbgbuflen += snprintf (dbgbuf+dbgbuflen, 2047-dbgbuflen,
"[%d: %d.%d.%d.%d] ", sizeof (struct in_addr),
hent->h_addr_list[hostnum][0],
hent->h_addr_list[hostnum][1],
hent->h_addr_list[hostnum][2],
hent->h_addr_list[hostnum][3]);
+#endif
memcpy ((void *) &(inaddrlist[hostnum]),
(void *) hent->h_addr_list[hostnum],
sizeof (struct in_addr));
}
- if (DO_CONNECT_DEBUG_SYSLOGS) {
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
syslog (LOG_DEBUG, "dbg: %d %s", hostnum, dbgbuf); dbgbuflen = 0;
- }
+#endif
}
- if (DO_CONNECT_DEBUG_SYSLOGS) {
- for (i = 0; i < hostnum; i++) {
- syslog (LOG_DEBUG, "dbg: host addr %d/%d = %lx at %lx",
- i, hostnum, inaddrlist[i].s_addr, &(inaddrlist[i]));
- }
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
+ for (dbgiter = 0; dbgiter < hostnum; dbgiter++) {
+ syslog (LOG_DEBUG, "dbg: host addr %d/%d = %lx at %lx", dbgiter, hostnum,
+ inaddrlist[dbgiter].s_addr, &(inaddrlist[dbgiter]));
}
+#endif
hent = NULL; /* cannot use hent after this point, syslog() may overwrite it */
- if (DO_CONNECT_DEBUG_SYSLOGS) { syslog (LOG_DEBUG, "dbg: socket"); }
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
+ syslog (LOG_DEBUG, "dbg: socket");
+#endif
if(-1 == (mysock = socket(PF_INET,SOCK_STREAM,0)))
{
@@ -199,8 +209,6 @@
}
}
- if (DO_CONNECT_DEBUG_SYSLOGS) { syslog (LOG_DEBUG, "dbg: setsockopt"); }
-
#ifdef USE_TCP_NODELAY
/* TODO: should this be up above the connect()? */
value = 1; /* make this explicit! */
@@ -223,14 +231,17 @@
#endif
for (numloops=0; numloops < MAX_CONNECT_RETRIES; numloops++) {
- if (DO_CONNECT_DEBUG_SYSLOGS) {
+
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
syslog (LOG_DEBUG, "dbg: connect() to spamd %d", numloops);
- }
+#endif
+
if (argaddr != NULL) {
addr = (struct sockaddr_in *) argaddr; /* use the one provided */
- if (DO_CONNECT_DEBUG_SYSLOGS) {
+
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
syslog (LOG_DEBUG, "dbg: using argaddr");
- }
+#endif
} else {
/* cycle through the addrs in hent */
@@ -244,29 +255,30 @@
return EX_SOFTWARE;
}
- if (DO_CONNECT_DEBUG_SYSLOGS) {
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
syslog (LOG_DEBUG, "dbg: cpy addr %d/%d at %lx",
numloops%hostnum, hostnum, &(inaddrlist[numloops % hostnum]));
- }
+#endif
memcpy (&addrbuf.sin_addr, &(inaddrlist[numloops % hostnum]),
sizeof(addrbuf.sin_addr));
addr = &addrbuf;
- if (DO_CONNECT_DEBUG_SYSLOGS) {
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
syslog (LOG_DEBUG, "dbg: conn addr %d/%d = %lx",
numloops%hostnum, hostnum, addrbuf.sin_addr.s_addr);
- }
+#endif
}
syslog (LOG_DEBUG, "dbg: connect() to spamd at %s",
inet_ntoa(((struct sockaddr_in *)addr)->sin_addr));
status = connect(mysock,(const struct sockaddr *) addr, sizeof(*addr));
- if (DO_CONNECT_DEBUG_SYSLOGS) {
+
+#ifdef DO_CONNECT_DEBUG_SYSLOGS
syslog (LOG_DEBUG, "dbg: connect() to spamd at %s done",
inet_ntoa(((struct sockaddr_in *)addr)->sin_addr));
- }
+#endif
if (status < 0)
{
|