Hi Stefan and All.
I just to test your patch and i believe is a great job and exactly all i need.
Why dont include this patch in qmail-ldap next release? works great and i believe performance is not affected.
Respect to auth_pop, auth_fail and auth_error not report "PID" or "REMOTEIP" associated so i dont know what tcpserver proccess or ip client address just to fail its authentication in an easy way.
So, i look what you did and i just to make this patch to auth_pop
looks like
diff auth_pop.c auth_pop.c.orig
96,107c96
< /* Modificaciones de cegara*/
< const char *remotehost;
< const char *remoteip;
< const char *remoteinfo;
< remoteip = env_get("TCPREMOTEIP");
< if (!remoteip) remoteip = "ip unknown";
< remotehost = env_get("TCPREMOTEHOST");
< if (!remotehost) remotehost = "host unknown";
< remoteinfo = env_get("TCPREMOTEINFO");
< if (!remoteinfo) remoteinfo = "info unknown";
< /* Fin de modificaciones de cegara */
< logit(2, "warning: auth_fail: user %s from IP=> %s, HOST=> %s, INFO=> %s failed authentication\n",login,remoteip,remotehost,remoteinfo);
---
> logit(2, "warning: auth_fail: user %s failed\n", login);
maybe
César García. Dept. Sistemas, IdecNet S.A. Centro de Gestión de Red. Edificio IdecNet. C/Juan XXIII 44. E-35004, Las Palmas de Gran Canaria, Islas Canarias - España. Tfn: +34 828 111 000 Ext: 340
Stefan Paletta wrote:
Cesar,
find attached a modification to qmail-pop3d I am using. This will make qmail-pop3d report the initial number of messages in mailbox, number of messages remaining, size of all messages, size of messages remaining, and bytes transferred to client.
warnings (error authentications) dont report associated pid.(may)?
ip reports in pop3 accounting will separate tcpserver pop3 loggin from pop3 accounting loggin and you can then associate ip connections with a pop3 accounting pid.
I did not quite understand the other features you mentioned, so if you could explain once more ...
Btw. there seems to be a quirk with the 'login' accouning -- I some- times see these lines run together with the next line from another process.
-Stefan
------------------------------------------------------------------------
Index: qmail-pop3d.c
===================================================================
--- qmail-pop3d.c (revision 10)
+++ qmail-pop3d.c (revision 14)
@@ -25,6 +25,13 @@
#include "qmail-ldap.h"
int qfd;
+
+struct message {
+ int flagdeleted;
+ unsigned long size;
+ char *fn;
+} *m;
+unsigned int numm;
/* level 0 = no logging
1 = fatal errors
@@ -50,13 +57,38 @@
void log_quit(void)
{
+ unsigned int i;
+ unsigned long before;
+ unsigned long after;
+ unsigned int remain;
char strnum[FMT_ULONG];
logit(2, "acct:");
logit(2, logs_pidhostinfo.s);
logit(2, "logout ");
+
+ before = after = 0;
+ remain = 0;
+ for (i = 0;i < numm;++i) {
+ before += m[i].size;
+ if (!m[i].flagdeleted) {
+ after += m[i].size;
+ remain++;
+ }
+ }
+
+ strnum[fmt_uint(strnum,numm)] = 0;
+ logit(2, strnum); logit(2, ":");
+ strnum[fmt_uint(strnum,remain)] = 0;
+ logit(2, strnum); logit(2, " ");
+ + strnum[fmt_ulong(strnum,before)] = 0;
+ logit(2, strnum); logit(2, ":");
+ strnum[fmt_ulong(strnum,after)] = 0;
+ logit(2, strnum); logit(2, " ");
+
strnum[fmt_ulong(strnum,log_bytes)] = 0;
- logit(2, strnum); logitf(2, " bytes transferred");
+ logitf(2, strnum);
}
void die(void) { log_quit(); _exit(0); }
@@ -112,11 +144,11 @@
void err_syntax(void) { err("syntax error"); logitf(3, "error: syntax error"); }
void err_unimpl(void) { err("unimplemented"); logitf(3, "error: unimplemented"); }
-void err_deleted(void) { err("already deleted"); logitf(3, "already deleted"); }
-void err_nozero(void) { err("messages are counted from 1"); logitf(3, "messages are counted from 1"); }
-void err_toobig(void) { err("not that many messages"); logitf(3, "not that many messages"); }
-void err_nosuch(void) { err("unable to open that message"); logitf(3, "unable to open that message"); }
-void err_nounlink(void) { err("unable to unlink all deleted messages"); logitf(3, "unable to unlink all deleted messages"); }
+void err_deleted(void) { err("already deleted"); logitf(3, "error: already deleted"); }
+void err_nozero(void) { err("messages are counted from 1"); logitf(3, "error: messages are counted from 1"); }
+void err_toobig(void) { err("not that many messages"); logitf(3, "error: not that many messages"); }
+void err_nosuch(void) { err("unable to open that message"); logitf(3, "error: unable to open that message"); }
+void err_nounlink(void) { err("unable to unlink all deleted messages"); logitf(3, "error: unable to unlink all deleted messages"); }
void okay(void) { putstr("+OK \r\n"); flush(); }
@@ -142,7 +174,7 @@
remoteip = env_get("TCPREMOTEIP");
if (!remoteip) remoteip = "unknown";
remotehost = env_get("TCPREMOTEHOST");
- if (!remotehost) remotehost = "unknown";
+ if (!remotehost) remotehost = "";
remoteinfo = env_get("TCPREMOTEINFO");
if (!remoteinfo) remoteinfo = "";
user = env_get("USER");
@@ -151,7 +183,7 @@
if (!stralloc_copys(&logs_pidhostinfo, " pid ")) die_nomem();
strnum[fmt_ulong(strnum,getpid())] = 0;
if (!stralloc_cats(&logs_pidhostinfo, strnum)) die_nomem();
- if (!stralloc_cats(&logs_pidhostinfo, ": ")) die_nomem();
+ if (!stralloc_cats(&logs_pidhostinfo, " ")) die_nomem();
if (!stralloc_cats(&logs_pidhostinfo, remotehost)) die_nomem();
if (!stralloc_cats(&logs_pidhostinfo, ":")) die_nomem();
@@ -197,13 +229,6 @@
stralloc filenames = {0};
prioq pq = {0};
-struct message {
- int flagdeleted;
- unsigned long size;
- char *fn;
-} *m;
-unsigned int numm;
-
unsigned int last = 0;
void getlist(void)