[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
whoson logging
Hi!
"connection" message from smtpserver have't whoson information:
May 16 00:03:40 pechkin smtpserver[37145]: connection from NO-IDENT-SERVICE[2]@h227.232.dialup.iptcom.net (whoson: )
Whoson and IDENT should be lookuped before logging if we want print ... ;)
RCS file: /cvsroot/zmailer/smtpserver/contentpolicy.c,v
retrieving revision 1.14
diff -u -r1.14 contentpolicy.c
--- smtpserver/contentpolicy.c 2003/05/05 09:29:38 1.14
+++ smtpserver/contentpolicy.c 2003/05/20 11:46:25
@@ -257,3 +257,20 @@
return rc;
}
+
+void killcfilter(SS, cpid)
+SmtpState *SS;
+int cpid;
+{
+ if (cpid > 0) {
+ if (cpol_tofp == NULL)
+ fclose(cpol_tofp);
+ cpol_tofp = NULL;
+ if (cpol_fromfp == NULL)
+ fclose(cpol_fromfp);
+ cpol_fromfp = NULL;
+ sleep(1); /* for normal filter shutdown */
+ kill(cpid, SIGKILL);
+ }
+}
+
Index: smtpserver/smtprouter.c
===================================================================
RCS file: /cvsroot/zmailer/smtpserver/smtprouter.c,v
retrieving revision 1.17
diff -u -r1.17 smtprouter.c
--- smtpserver/smtprouter.c 2002/08/23 20:42:42 1.17
+++ smtpserver/smtprouter.c 2003/05/20 11:46:25
@@ -185,8 +185,12 @@
int rpid;
{
if (rpid > 0) {
- fclose(tofp); tofp = NULL;
- fclose(fromfp); fromfp = NULL;
+ if (tofp == NULL)
+ fclose(tofp);
+ tofp = NULL;
+ if (fromfp == NULL)
+ fclose(fromfp);
+ fromfp = NULL;
kill(rpid, SIGKILL);
}
}
Index: smtpserver/smtpserver.c
===================================================================
RCS file: /cvsroot/zmailer/smtpserver/smtpserver.c,v
retrieving revision 1.136
diff -u -r1.136 smtpserver.c
--- smtpserver/smtpserver.c 2003/05/14 14:12:10 1.136
+++ smtpserver/smtpserver.c 2003/05/20 11:46:37
@@ -1244,6 +1244,30 @@
else
strcpy(SS.ident_username, "IDENT-NOT-QUERIED");
+#ifdef HAVE_WHOSON_H
+ if (do_whoson && netconnected_flg) {
+ char buf[64];
+ buf[0]='\0';
+ if (SS.raddr.v4.sin_family == AF_INET) {
+ inet_ntop(AF_INET, (void *) &SS.raddr.v4.sin_addr, /* IPv4 */
+ buf, sizeof(buf) - 1);
+#if defined(AF_INET6) && defined(INET6)
+ } else if (SS.raddr.v6.sin6_family == AF_INET6) {
+ inet_ntop(AF_INET6, (void *) &SS.raddr.v6.sin6_addr, /* IPv6 */
+ buf, sizeof(buf) - 1);
+#endif
+ }
+ if ((SS.whoson_result = wso_query(buf, SS.whoson_data,
+ sizeof(SS.whoson_data)))) {
+ strcpy(SS.whoson_data,"-unregistered-");
+ }
+ } else {
+ strcpy(SS.whoson_data,"NOT-CHECKED");
+ SS.whoson_result = -1;
+ }
+#endif /* HAVE_WHOSON_H */
+
+
if (smtp_syslog && ident_flag) {
#ifdef HAVE_WHOSON_H
zsyslog((LOG_INFO, "connection from %s@%s (whoson: %s)\n",
@@ -1322,7 +1346,7 @@
if (routerpid > 0)
killr(&SS, routerpid);
if (contentpolicypid > 1)
- killr(&SS, contentpolicypid);
+ killcfilter(&SS, contentpolicypid);
if (netconnected_flg)
sleep(2);
@@ -1345,7 +1369,7 @@
if (routerpid > 0)
killr(&SS, routerpid);
if (contentpolicypid > 1)
- killr(&SS, contentpolicypid);
+ killcfilter(&SS, contentpolicypid);
if (netconnected_flg)
sleep(2);
exit(0);
@@ -1916,7 +1940,7 @@
if (routerpid > 0)
killr(SS, routerpid);
if (contentpolicypid > 1)
- killr(SS, contentpolicypid);
+ killcfilter(SS, contentpolicypid);
exit(0);
}
report(SS, "(connected)");
@@ -2009,28 +2033,7 @@
}
#endif /* - HAVE_OPENSSL */
-
#ifdef HAVE_WHOSON_H
- if (do_whoson && netconnected_flg) {
- char buf[64];
- buf[0]='\0';
- if (SS->raddr.v4.sin_family == AF_INET) {
- inet_ntop(AF_INET, (void *) &SS->raddr.v4.sin_addr, /* IPv4 */
- buf, sizeof(buf) - 1);
-#if defined(AF_INET6) && defined(INET6)
- } else if (SS->raddr.v6.sin6_family == AF_INET6) {
- inet_ntop(AF_INET6, (void *) &SS->raddr.v6.sin6_addr, /* IPv6 */
- buf, sizeof(buf) - 1);
-#endif
- }
- if ((SS->whoson_result = wso_query(buf, SS->whoson_data,
- sizeof(SS->whoson_data)))) {
- strcpy(SS->whoson_data,"UNAVAILABLE");
- }
- } else {
- strcpy(SS->whoson_data,"NOT-CHECKED");
- SS->whoson_result = -1;
- }
policystatus = policyinit(&policydb, &SS->policystate,
SS->whoson_result);
#else
@@ -2117,7 +2120,7 @@
{
char *s = policymsg(policydb, &SS->policystate);
if (insecure)
- type(NULL,0,,NULL,"remote from %s:%d", SS->ihostaddr, SS->rport);
+ type(NULL,0,NULL,"remote from %s:%d", SS->ihostaddr, SS->rport);
else
type(NULL,0,NULL,"local from uid#%d", (int)getuid());
if (SS->policyresult != 0 || s != NULL)
Index: smtpserver/smtpserver.h
===================================================================
RCS file: /cvsroot/zmailer/smtpserver/smtpserver.h,v
retrieving revision 1.74
diff -u -r1.74 smtpserver.h
--- smtpserver/smtpserver.h 2003/05/08 01:48:35 1.74
+++ smtpserver/smtpserver.h 2003/05/20 11:46:38
@@ -489,6 +489,7 @@
#endif /* USE_TRANSLATION */
extern void killr __((SmtpState * SS, int rpid));
+extern void killcfilter __((SmtpState * SS, int rpid));
extern void typeflush __((SmtpState *));
#if defined(HAVE_STDARG_H) && defined(HAVE_VPRINTF)
extern void type __((SmtpState *, int code, const char *status, const char *fmt,...));
-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to majordomo@nic.funet.fi
- Follow-Ups:
- Re: whoson logging
- From: Matti Aarnio <mea@nic.funet.fi> (Tue, 20 May 2003 15:43:06 +0300)