1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (C) International Business Machines Corp., 2001 4 * Ported by Wayne Boyer 5 * Adapted by Dustin Kirkland ([email protected]) 6 * Copyright (c) 2022 SUSE LLC Avinesh Kumar <[email protected]> 7 */ 8 9 /*\ 10 * [Description] 11 * 12 * Verify that setfsuid() syscall fails if an invalid fsuid is given. 13 */ 14 15 #include <pwd.h> 16 #include "tst_test.h" 17 #include "compat_tst_16.h" 18 run(void)19static void run(void) 20 { 21 uid_t invalid_uid, current_uid; 22 23 current_uid = geteuid(); 24 invalid_uid = (UID_T)-1; 25 26 UID16_CHECK(invalid_uid, setfsuid); 27 28 TST_EXP_VAL_SILENT(SETFSUID(invalid_uid), (long)current_uid); 29 TST_EXP_VAL(SETFSUID(invalid_uid), (long)current_uid, 30 "setfsuid(invalid_fsuid) test for expected failure:"); 31 } 32 33 static struct tst_test test = { 34 .test_all = run 35 }; 36