Subject: fork bomb with lpd

From: Carlos Carvalho <[email-masked]>
Date: Wed, 12 Jun 96 16:17 EST

Here's part of a msg. I've just sent to debian-bugs:

---------
Finally, another weird problem. lpd is complaining about invalid
printer names, but the printcap is correct; also, the behaviour is
somewhat erratic. To debug this I inserted a fprintf in the routine
that gets the hole lines from /etc/printcap, to show the full line,
and in the calling routine, to show the returned value. This is inside
a loop, that finishes when the printcap file ends. I also just made
the forked children exit immediately. This way I got a large dump,
with many repetitions of the printer entries, which is obviously
bogus. However, putting a fflush right after the two fprintf's the
problem disappeared completely!! Am I missing something or is there a
problem elsewhere?
----------

I'm repeating this here because this has an important consequence:
when lpd starts it forks a child for each printer it finds in
/etc/printcap. The repetition of lines I mentioned above thus produces
a furious fork loop. This apparently is no problem when the machine
boots, but when it's running fully it can get killed. I've just
restarted lpd in 5 machines here, and two of them just stopped
responding and I had to press the big switch :-( There's surely a bug
somewhere, but I don't know where to look for it.

This is with 2.0.0 and libc 5.2.18-6.

Carlos