Author: adrian.chadd
Date: Mon Feb 2 15:52:15 2009
New Revision: 13797
Modified:
branches/LUSCA_HEAD/src/client_side.c
Log:
Eliminate strBuf() ; use stringDupToCOffset() to create a temporary C
string for use by inet_aton()
Modified: branches/LUSCA_HEAD/src/client_side.c
==============================================================================
--- branches/LUSCA_HEAD/src/client_side.c (original)
+++ branches/LUSCA_HEAD/src/client_side.c Mon Feb 2 15:52:15 2009
@@ -268,13 +268,13 @@
* it to to replace indirect_client_addr, then repeat the cycle.
*/
const char *p;
- const char *asciiaddr;
+ char *asciiaddr;
int l;
struct in_addr addr;
debug(33, 5) ("clientFollowXForwardedForDone: indirect_client_addr=%s
is
trusted\n",
inet_ntoa(request->indirect_client_addr));
- p = strBuf(request->x_forwarded_for_iterator);
- l = strLen(request->x_forwarded_for_iterator);
+ p = strBuf2(request->x_forwarded_for_iterator);
+ l = strLen2(request->x_forwarded_for_iterator);
/*
* XXX x_forwarded_for_iterator should really be a list of
@@ -293,16 +293,20 @@
/* look for start of last item in list */
while (l > 0 && !(p[l - 1] == ',' || xisspace(p[l - 1])))
l--;
- asciiaddr = p + l;
+
+ /* Take a temporary copy of the buffer so inet_aton() can run on it */
+ asciiaddr = stringDupToCOffset(&request->x_forwarded_for_iterator,
l);
if (inet_aton(asciiaddr, &addr) == 0) {
/* the address is not well formed; do not use it */
debug(33, 3) ("clientFollowXForwardedForDone: malformed
address '%s'\n",
asciiaddr);
+ safe_free(asciiaddr);
goto done;
}
debug(33, 3) ("clientFollowXForwardedForDone: changing
indirect_client_addr from %s to '%s'\n",
inet_ntoa(request->indirect_client_addr),
asciiaddr);
+ safe_free(asciiaddr);
request->indirect_client_addr = addr;
strCut(&request->x_forwarded_for_iterator, l);
if (!Config.onoff.acl_uses_indirect_client) {
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---