Le dimanche 9 octobre 2011 19:16:58, Thomas Preud'homme a écrit : > Le dimanche 9 octobre 2011 15:11:10, Julien Valroff a écrit : > > Hi, > > > > Here is an attempt to fix Debian bug #644794 [0] stating the logged > > IPv6 addresses are truncated. > > > > Cheers, > > Julien > > I would like to propose a patch myself too. Size of ip array should be 128 > but I'm thinking about replacing this array by a more appropriate > structure (like union of struct in_addr or struct in6_addr). but I want to > check it's adequate first. > > Congrats for your quick reaction Julien.
Ok, it will take more time than expected because there is also some other place in the code which I believe assume IPv4. egrep -In "\[32\]" **/*.c | wc -l gives 11 One exemple is in src/daemon.c around line 250. I transformed local_addr and remote_addr in an union of sockaddr_in and sockaddr_in6 but then the code needs to be adapted. I will try to finish the patch tomorrow. Regards. > > > [0] http://bugs.debian.org/644794 > > > > --- > > > > CHANGELOG | 2 ++ > > src/dspam.c | 6 +++--- > > 2 files changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/CHANGELOG b/CHANGELOG > > index 0ca9952..5098f71 100644 > > --- a/CHANGELOG > > +++ b/CHANGELOG > > @@ -1,3 +1,5 @@ > > +[20111009:1500] jvalroff: Fix buffer lengths for IPv6 adresses logging > > + > > > > [20111001:1200] sbajic: Fix typo and formatting issues in dspam.conf > > > > [20111001:1030] sbajic: Fix compiler warnings (unused function) in MySQL > > > > driver diff --git a/src/dspam.c b/src/dspam.c > > index 2668aba..48c12aa 100644 > > --- a/src/dspam.c > > +++ b/src/dspam.c > > @@ -409,7 +409,7 @@ process_message ( > > > > strcmp(_ds_pref_val(ATX->PTX, "optOutClamAV"), "on")) > > > > { > > > > if (has_virus(message)) { > > > > - char ip[32]; > > + char ip[46]; > > > > CTX->result = DSR_ISSPAM; > > CTX->probability = 1.0; > > CTX->confidence = 1.0; > > > > @@ -3823,7 +3823,7 @@ MEM_ALLOC: > > */ > > > > int tracksource(DSPAM_CTX *CTX) { > > > > - char ip[32]; > > + char ip[46]; > > > > if (!dspam_getsource (CTX, ip, sizeof (ip))) > > { > > > > @@ -4010,7 +4010,7 @@ int is_blacklisted(DSPAM_CTX *CTX, AGENT_CTX *ATX) > > { > > > > /* No cygwin support for IP Blacklisting */ > > return 0; > > > > #else > > > > - char ip[32]; > > + char ip[46]; > > > > int bad = 0; > > struct attribute *attrib; > > struct addrinfo *res = NULL;
signature.asc
Description: This is a digitally signed message part.