[LTP] [PATCH v2 2/2] syscalls/geteuid02: Convert into new api
Yang Xu (Fujitsu)
xuyang2018.jy@fujitsu.com
Mon Jul 17 12:42:23 CEST 2023
Hi Petr,
Kindly ping,
This case references getuid03,
the URL for providing modification suggestions is as follows:
https://patchwork.ozlabs.org/project/ltp/patch/20211109085745.21531-2-tangmeng@uniontech.com/
Best Regards
Yang Xu
> Hi Petr,
>
>> Hi Xu,
>>
>>> - if (pwent == NULL)
>>> - tst_resm(TFAIL | TERRNO, "getpwuid failed");
>>> -
>>> - UID16_CHECK(pwent->pw_uid, geteuid, cleanup);
>> Don't we need to use UID16_CHECK()? In the new API version from
>> compat_tst_16.h
>>
> >
> Previously, the EUID was obtained from the return value of getpwuid()
> and compared with the return value of geteuid() to check for a match.
> This approach seemed more like a test of getpwuid() rather than testing
> geteuid() itself.
>
> EUID is stored in /proc/self/status, and we can directly obtain it for
> comparison with the return from geteuid().
>
> Best Regards
> Yang Xu
>
>> Kind regards,
>> Petr
>>
>>> - if (pwent->pw_uid != TEST_RETURN)
>>> - tst_resm(TFAIL, "getpwuid value, %d, "
>>> - "does not match geteuid "
>>> - "value, %ld", pwent->pw_uid,
>>> - TEST_RETURN);
>>> - else
>>> - tst_resm(TPASS, "values from geteuid "
>>> - "and getpwuid match");
>>> - }
>> ...
>>> + TST_EXP_EXPR(TST_RET == uid[1],
>>> + "geteuid() ret %ld == /proc/self/status EUID: %ld",
>>> + TST_RET, uid[1]);
>>> }
>>
>>> +static struct tst_test test = {
>>> + .test_all = verify_geteuid,
>>> +};
>
More information about the ltp
mailing list