setuid.ha (2392B)
1 // SPDX-License-Identifier: MPL-2.0 2 // (c) Hare authors <https://harelang.org> 3 4 use rt; 5 6 // Sets the caller's user ID to the specified value. This generally requires 7 // elevated permissions from the calling process. 8 // 9 // If the system returns an error, this function will abort the program. Failing 10 // to handle errors from setuid is a grave security issue in your program, and 11 // therefore we require this function to succeed. If you need to handle the 12 // error case gracefully, call the appropriate syscall wrapper in [[rt::]] yourself, 13 // and take extreme care to handle errors correctly. 14 export fn setuid(uid: uint) void = rt::setuid(uid: rt::uid_t)!; 15 16 // Sets the caller's effective user ID to the specified value. This generally 17 // requires elevated permissions from the calling process. 18 // 19 // If the system returns an error, this function will abort the program. Failing 20 // to handle errors from seteuid is a grave security issue in your program, and 21 // therefore we require this function to succeed. If you need to handle the 22 // error case gracefully, call the appropriate syscall wrapper in [[rt::]] yourself, 23 // and take extreme care to handle errors correctly. 24 export fn seteuid(uid: uint) void = rt::seteuid(uid: rt::uid_t)!; 25 26 // Sets the caller's group ID to the specified value. This generally requires 27 // elevated permissions from the calling process. 28 // 29 // If the system returns an error, this function will abort the program. Failing 30 // to handle errors from setuid is a grave security issue in your program, and 31 // therefore we require this function to succeed. If you need to handle the 32 // error case gracefully, call the appropriate syscall wrapper in [[rt::]] yourself, 33 // and take extreme care to handle errors correctly. 34 export fn setgid(gid: uint) void = rt::setgid(gid: rt::gid_t)!; 35 36 // Sets the caller's effective group ID to the specified value. This generally 37 // requires elevated permissions from the calling process. 38 // 39 // If the system returns an error, this function will abort the program. Failing 40 // to handle errors from setegid is a grave security issue in your program, and 41 // therefore we require this function to succeed. If you need to handle the 42 // error case gracefully, call the appropriate syscall wrapper in [[rt::]] yourself, 43 // and take extreme care to handle errors correctly. 44 export fn setegid(gid: uint) void = rt::setegid(gid: rt::gid_t)!;