[Dovecot] IP in rawlog
Timo Sirainen
tss at iki.fi
Tue Mar 15 23:03:25 EET 2005
On Tue, 2005-03-15 at 10:45 +0100, Andreas Goertz wrote:
> | no - this patch doesn't seem to work, because in rawlog.c proxy is
> | not declared. So i looked for the call to rawlog_open() and saw that
> | it's only called from main.c in imap and pop3 folder. But there also
> | is no proxy declared. Do you have another idea? Thanks in advance.
That code was for 1.0-tests, 0.99.x has entirely different rawlog code.
> Hmm - while searching for another solution i found the function
> client_syslog() in imap-login/client.c. If i understand it correctly,
> i_info() only writes to the syslog and i have no clue, how to write into
> rawlog from client.c respectively client_syslog().
Only rawlog.c knows about rawlog, it's also running as separate process
so it's not even possible to see it in client.c code.
Here's a patch for 0.99.14:
--- rawlog.c.old 2005-03-15 22:59:52.731934694 +0200
+++ rawlog.c 2005-03-15 23:01:10.535201787 +0200
@@ -89,6 +89,7 @@
void rawlog_open(int *hin, int *hout)
{
struct io *io_imap, *io_client;
+ struct ip_addr ip;
const char *home, *path, *fname;
char timestamp[50];
struct tm *tm;
@@ -131,6 +132,11 @@
return;
}
+ if (net_getpeername(0, &ip, NULL) == 0) {
+ str = t_strdup_printf("IP: %s\n", net_ip2addr(&ip));
+ write_full(log_out, str, strlen(str));
+ }
+
/* we need to fork the rawlog writer to separate process since
imap process does blocking writes. */
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://dovecot.org/pipermail/dovecot/attachments/20050315/8c1ab03e/attachment-0001.bin>
More information about the dovecot
mailing list