[LTP] [PATCH] read_all: Drop privileges

Richard Palethorpe rpalethorpe@suse.de
Tue May 15 12:55:00 CEST 2018


Hello,

Cyril Hrubis writes:

> Hi!
>> +static void maybe_drop_privs(void)
>> +{
>> +	struct passwd *nobody;
>> +
>> +	if (!drop_privs)
>> +		return;
>> +
>> +	nobody = SAFE_GETPWNAM("nobody");
>> +
>> +	TEST(setgid(nobody->pw_gid));
>> +	if (TEST_RETURN < 0 && TEST_ERRNO != EPERM)
>> +		tst_res(TBROK | TTERRNO, "Failed to use nobody gid");
>                 ^
> 		Shouldn't this be tst_brk()?
>
>> +	TEST(setuid(nobody->pw_uid));
>> +	if (TEST_RETURN < 0 && TEST_ERRNO != EPERM)
>> +		tst_res(TBROK | TTERRNO, "Failed to use nobody uid");
>                 ^
> 		And here as well?
>
> Otherwise it looks fine.

Well spotted, yes it should.

-- 
Thank you,
Richard.


More information about the ltp mailing list