1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. 4 * Author: William Roske 5 * Co-pilot: Dave Fenner 6 * Copyright (c) 2022 SUSE LLC Avinesh Kumar <avinesh.kumar@suse.com> 7 */ 8 9/*\ 10 * [Description] 11 * 12 * Verify the basic functionality of setreuid(2) system call when executed 13 * as non-root user. 14 */ 15 16#include "tst_test.h" 17#include "compat_tst_16.h" 18 19static uid_t ruid, euid; 20 21static void run(void) 22{ 23 ruid = getuid(); 24 UID16_CHECK(ruid, setreuid); 25 26 euid = geteuid(); 27 UID16_CHECK(euid, setreuid); 28 29 TST_EXP_PASS(SETREUID(-1, -1)); 30 TST_EXP_PASS(SETREUID(-1, euid)); 31 TST_EXP_PASS(SETREUID(ruid, -1)); 32 TST_EXP_PASS(SETREUID(-1, ruid)); 33 TST_EXP_PASS(SETREUID(euid, -1)); 34 TST_EXP_PASS(SETREUID(euid, euid)); 35 TST_EXP_PASS(SETREUID(ruid, ruid)); 36} 37 38static struct tst_test test = { 39 .test_all = run 40}; 41