mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Get remote host from X-Forwarded-For:
SVN revision: 532
This commit is contained in:
parent
75ab4bbe77
commit
82e87feee1
22
src/elogd.c
22
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.108 2003/05/15 11:22:10 midas
|
||||||
|
Get remote host from X-Forwarded-For:
|
||||||
|
|
||||||
Revision 1.107 2003/05/15 10:39:47 midas
|
Revision 1.107 2003/05/15 10:39:47 midas
|
||||||
Sort correctly upper and lower case
|
Sort correctly upper and lower case
|
||||||
|
|
||||||
@ -12791,6 +12794,25 @@ int net_buffer_size;
|
|||||||
*strchr(browser, '\r') = 0;
|
*strchr(browser, '\r') = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* extract "X-Forwarded-For:" */
|
||||||
|
if ((p = strstr(net_buffer, "X-Forwarded-For:")) != NULL)
|
||||||
|
{
|
||||||
|
p += 16;
|
||||||
|
while (*p && *p == ' ')
|
||||||
|
p++;
|
||||||
|
strlcpy(str, p, sizeof(str));
|
||||||
|
if (strchr(str, '\r'))
|
||||||
|
*strchr(str, '\r') = 0;
|
||||||
|
|
||||||
|
rem_addr.S_un.S_addr = inet_addr(str);
|
||||||
|
phe = gethostbyaddr((char *) &rem_addr, 4, PF_INET);
|
||||||
|
if (phe != NULL)
|
||||||
|
{
|
||||||
|
strcpy(remote_host[i_conn], phe->h_name);
|
||||||
|
strcpy(rem_host, remote_host[i_conn]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
memset(return_buffer, 0, return_buffer_size);
|
memset(return_buffer, 0, return_buffer_size);
|
||||||
strlen_retbuf = 0;
|
strlen_retbuf = 0;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user