Otto
2005-09-14 14:14:15 UTC
Hi All,
I hope you can help me with this one, because I'm pretty much stumped.
My app runs as root... In one thread in my app, I'm accessing the file
system "impersonating" another user on the system, by calling
seteuid(). Maybe you can guess that this code has been ported from
_another_ OS... Anyway, up 'til now, this has always worked fine.
However, when it's running on Red Hat EL 4.0, every time I call
seteuid() in one thread, all of the other threads get a signal (SIG33).
I think this has two side effects:
1. All of the threads in my process switch to the new effective uid
2. Half of the other threads which are not signal-safe conk out,
because their last system call returned with EINTR. I should point out
that most of this code is in other libraries, and isn't under my
control...
Now I expect this is probably caused by an intentional change in the
pthreads stuff to gain better POSIX compliance, but I can't find any
documentation to this effect.
What I am really looking for is a way to revert to the "old" behavior,
where the seteuid call only affects the current thread. This would be
_really useful_
But, in anticipation of all the "you're doing this all wrong" replies
that I'm bound to receive, I'm willing to try an alternative
approach... So, is there a reliable way I can figure out, given a UID,
whether a particular file is accessible by that user, and to create
files owned by said user?
Thanks in advance for your help!
Cheers,
Otto
I hope you can help me with this one, because I'm pretty much stumped.
My app runs as root... In one thread in my app, I'm accessing the file
system "impersonating" another user on the system, by calling
seteuid(). Maybe you can guess that this code has been ported from
_another_ OS... Anyway, up 'til now, this has always worked fine.
However, when it's running on Red Hat EL 4.0, every time I call
seteuid() in one thread, all of the other threads get a signal (SIG33).
I think this has two side effects:
1. All of the threads in my process switch to the new effective uid
2. Half of the other threads which are not signal-safe conk out,
because their last system call returned with EINTR. I should point out
that most of this code is in other libraries, and isn't under my
control...
Now I expect this is probably caused by an intentional change in the
pthreads stuff to gain better POSIX compliance, but I can't find any
documentation to this effect.
What I am really looking for is a way to revert to the "old" behavior,
where the seteuid call only affects the current thread. This would be
_really useful_
But, in anticipation of all the "you're doing this all wrong" replies
that I'm bound to receive, I'm willing to try an alternative
approach... So, is there a reliable way I can figure out, given a UID,
whether a particular file is accessible by that user, and to create
files owned by said user?
Thanks in advance for your help!
Cheers,
Otto