Sep 052012
 

ucspi-tcp is a public domain Unix TCP command-line tool for building TCP client-server applications. It consists of the super-server tcpserver and the tcpclient application.

The software can be downloaded from D. J. Bernstein’s website:

After unpacking the tar ball, we install several patches, as the software is no longer maintained.

tar -zxvf .../ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88/

Patches

The first patch to apply, is the IPv6 patch:

patch -p1 < .../ucspi-tcp-0.88-ipv6.diff19

The second patch combines several patches in one, hence the combo patch:

patch -p1 < .../ucspi.st-combo.09.patch

Since the software is already patched once, applying the second patch generates a couple of errors:

patching file Makefile
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file Makefile.rej
patching file README.st-patch
patching file error.h
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file error.h.rej
patching file rblsmtpd.c
patching file tcpserver.c
Hunk #2 succeeded at 38 with fuzz 2 (offset 2 lines).
Hunk #3 succeeded at 153 (offset 10 lines).
Hunk #4 succeeded at 252 (offset 33 lines).
Hunk #5 FAILED at 252.
Hunk #6 succeeded at 300 (offset 34 lines).
Hunk #7 succeeded at 344 (offset 34 lines).
Hunk #8 FAILED at 343.
Hunk #9 succeeded at 397 (offset 34 lines).
Hunk #10 succeeded at 413 with fuzz 1 (offset 37 lines).
Hunk #11 FAILED at 411.
Hunk #12 FAILED at 446.
Hunk #13 succeeded at 514 (offset 42 lines).
4 out of 13 hunks FAILED -- saving rejects to file tcpserver.c.rej

There is no need to worry about the first two patches being skipped, as a closer inspection of the error.h.rej and Makefile.rej files show that they are caused by the errno patch being part of both the IPv6 and the combo patch.

The other four failed hunks we find in the file tcpserver.c.rej and we apply them by hand to the file tcpserver.c.

Finally we edit line 172 of the file rblsmtpd.c to read like this:

if (text.len > 500) text.len = 500;

Here is the super patch that you can use to patch your ucspi-tcp tree in a single run:

Apply like this:

tar -zxvf .../ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88/
patch -p1 < .../ucspi-tcp-0.88-ao-superpatch.patch

Compiling and Installing

Now it is simply a matter of compiling and installing:

make
make setup check

And you are all set, ready to move on to the next step of your qmail setup: the installation of daemontools.

Leave a Reply