Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/tests/syscall



On Mon, Apr 04, 2011 at 08:32:14AM +0300, Jukka Ruohonen wrote:
> On Mon, Apr 04, 2011 at 01:59:50AM +0000, Christos Zoulas wrote:
> > >Check for getuid(2) == 0.
> > 
> > Why not setuid() to fix it?
> 
> That would indeed be the right thing to do. However, I am not quite sure how
> atf(7) actually works. It seems to create some temporary files such that
> simply changing the real and effective UID in the middle of a test gives
> 
>    tc-se:FATAL ERROR: Cannot create results file '/tmp/atf-run.21878a/tcr':
>    Permission denied
> 
> I am not sure whether this particular test deserves a more complex solution.

Adding the following to the testcase header should do the trick:

       atf_tc_set_md_var(tc,"require.user","unprivileged");

In that case, if run as root, it will lower its privileges to the
unprivileged user _atf before running the test.

-- 
Nicolas Joly

Projects and Developments in Bioinformatics
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index