#778792 ucspi-tcp-ipv6: tcprules doesn't support ipv6 addresses in rules file

Package:
ucspi-tcp-ipv6
Source:
ucspi-tcp
Description:
command-line tools for building TCP client-server applications (IPv6)
Submitter:
Michal Jirků
Date:
2023-01-05 01:33:02 UTC
Severity:
normal
Tags:
#778792#5
Date:
2015-02-19 22:33:25 UTC
From:
To:
Dear Gerrit,

I have found a problem with ucspi-tcp-ipv6 package; namely that
tcprules dies when it encounters ipv6 address in rules file.
E.g. adding ipv6 address to /etc/tcp.smtp fails:

2 root@palladium ~ # qmailctl cdb
tcprules: fatal: unable to parse this line: 2001:4898:e0:66:82fa:5bff:fe0f:c0c9:allow,WHITELISTED="yes"
Reloaded /etc/tcp.smtp.

I have discussed this issue with Felix von Leitner (the original
author of the ipv6 patch for ucspi-tcp) and he's under the impression
this is an issue related to this debian package.

Because his patch does add the support for ipv6 addresses in tcprules.
(works for him)

We compared the tcprules.c file and the one shipping with ucspi-tcp-ipv6
package seems to be unaffected by the changes providing the necessary
support. E.g. tcprules.c:126 reads:

colon = byte_chr(x,len,':');

which causes the input rule (current config file line) to be splitted
at first colon, using the left side as an address and right side as
instructions. Which fails to validate in the next step.

Felix's patch is different:

126     colon = 0;
127     for (;;) {
128       int tmp;
129       tmp = byte_chr(x + colon,len - colon,':');
130       colon += tmp;
131       if (colon == len) continue;
132       if (byte_equal(x+colon+1,4,"deny") || byte_equal(x+colon+1,5,"allow"))
break;
133       ++colon;
134     }

which causes the address/instructions splitting to work properly.

This leads me to believe there was some omission when fefe's patch
was included in the package.

Could you please revisit his ipv6 patch and possibly address this issue?

Cheers,

Michal

#778792#10
Date:
2023-01-05 01:20:48 UTC
From:
To:
control: owner -1 !

Hi,

I am currently in the process of adopting maintainership of
the ucspi-tcp package, so I came across this bug report that
was filed some years ago.
the ucspi-tcp-ipv6 package?

If I run the attached shell program:
a) on my Debian testing laptop,
b) in a Debian unstable chroot environment, and
c) in a Debian Stretch chroot environment with ucspi-tcp-ipv6
   version 1:0.88-3.1

...it always succeeds: the tcprules invocation succeeds, and all
the tcprulescheck invocations produce the expected result. Can you run
it on your system and see what happens? If something goes wrong with
attaching it (I have deliberately changed its extension to .txt so that
it should not give any mail filters a scare, but then who knows),
you can also find it at:

https://devel.ringlet.net/misc/test-tcprules/test-tcprules.txt
[snip]

Yes, but the ucspi-tcp source package builds ucspi-tcp twice: once in
the actual source directory, and once in an ipv6/ subdirectory after
copying all the files there and applying Felix von Leitner's IPv6 patch.
So the fact that you cannot see the change in the tcprules.c file in
the source package still does not mean that the patch is not applied.

Sorry for bothering you if you have moved on to another way of doing
things in the years since you filed that bug report. Still, thank you
for trying to improve Debian by reporting a problem!

G'luck,
Peter