I'm developing an open source web content filter:
http://dansguardian.org/
Which uses a libary called nb++:
http://nbpp.sourceforge.net/
I've tried their mailing list and had no success with my problem. Even the
library authors don't know the answer.
Basically, if I run my daemon in multithreaded mode with a pool of
processes /and/ I change the user from root to a lower privelage user such
as squid, it randomly quits. If I run it fork threaded where it forks
upon an incomming connection it does not quit, ever. If I run it multi-
threaded as root - it never has this random quitting problem.
I noticed that oops:
http://zipper.paco.net/~igor/oops.eng/
has comments in the code that due to linuxthreads design you can not call
setuid even when you call setuid before any thread creation. So it does a
setgid then a seteuid instead.
I thought that may be the solution to the problem, but copying the oops
code for setting the user did not fix it.
So, the questions:
1. Does anyone have any more information about linux and linuxthreads and
this seteuid thing?
2. Does anyone know what the problem is or have any ideas?
3. Why would it quit randomly as say squid, but not as root? Is the squid
user running out of ulimits?
4. After doing some research, there seems to be a problem with linuxthreads
and setuid and friends. So is there anything wrong with me changing the
permissions on the executable binary so that the target user owns it and it
is chmod'ed u+s? It seems to work, but is this good programming or is there
a neater/cleaner way?
Hey, if you have an idea and it turns out to lead to the solution - you'll
get a meantion on the developers page!
BTW, it's all written in C++ and runs on RH 6.2. I don't think the problem
is a RH specific one.
Thanks!
--
Daniel Barron - use [at jadeb.com] for personal replys.