Hi Timo,
first of all: i'm using 0.99.14. You helped me to raw-log the client-IP using something like this in rawlog.c:
if (net_getpeername(0, &ip, NULL) == 0) { str = t_strdup_printf("IP: %s\n", net_ip2addr(&ip)); write_full(log_out, str, strlen(str)); }
Now i got the problem, that this doesn't work when the client is connected using SSL. After some testing i think, the problem is, that after calling net_getpeername() the ip-family is AF_UNIX, not AF_INET, so net_ip2addr() returns null, but i'm not sure ;-) And i have no clue, how to solve this and find out the ip...
Do you have another hint for me?
Thanks in advance.
Regards, Andreas.
On 23.6.2005, at 14:52, Andreas Goertz wrote:
first of all: i'm using 0.99.14. You helped me to raw-log the client-IP using something like this in rawlog.c:
if (net_getpeername(0, &ip, NULL) == 0) { str = t_strdup_printf("IP: %s\n", net_ip2addr(&ip)); write_full(log_out, str, strlen(str)); }
Now i got the problem, that this doesn't work when the client is connected using SSL. After some testing i think, the problem is, that after calling net_getpeername() the ip-family is AF_UNIX, not AF_INET, so net_ip2addr() returns null, but i'm not sure ;-) And i have no clue, how to solve this and find out the ip...
Do you have another hint for me?
It's because with SSL it creates another proxying socket. Hmm. Looks like the IP address is actually in IP environment. So change the str = t_strdup_... line with str = t_strdup_printf("IP: %s\n", getenv("IP"));
I thought I hadn't done that yet in 0.99.x.
Hi Timo,
It's because with SSL it creates another proxying socket. Hmm. Looks like the IP address is actually in IP environment. So change the str = t_strdup_... line with str = t_strdup_printf("IP: %s\n", getenv("IP"));
I thought I hadn't done that yet in 0.99.x.
looks like you did ;-) with getenv() it works. Thank you very much.
Regards, Andreas.
participants (2)
-
Andreas Goertz
-
Timo Sirainen