The Linux Programming Interface
Users and Groups 157 8.4 Retrieving User and Group Information In this section, we look at library functions that permit us to r ...
158 Chapter 8 Because they return a pointer to statically allocated memory, getpwnam() and getpwuid() are not reentrant. In fact ...
Users and Groups 159 The getgrnam() function looks up group information by group name, and the getgrgid() function performs look ...
160 Chapter 8 if (name == NULL || *name == '\0') /* On NULL or empty string */ return -1; /* return an error */ u = strtol(name, ...
Users and Groups 161 The getpwent() function returns records from the password file one by one, return- ing NULL when there are ...
162 Chapter 8 We won’t describe these functions in detail, since their operation is similar to the corresponding password file f ...
Users and Groups 163 The crypt() algorithm takes a key (i.e., a password) of up to 8 characters, and applies a variation of the ...
164 Chapter 8 The getpass() function first disables echoing and all processing of terminal special characters (such as the inter ...
Users and Groups 165 lnmax = sysconf(_SC_LOGIN_NAME_MAX); if (lnmax == -1) / If limit is indeterminate / lnmax = 256; / make a g ...
166 Chapter 8 memory. This minimizes the possibility of a program crash producing a core dump file that could be read to discove ...
Chapter 9: Process Credentials Every process has a set of associated numeric user identifiers (UIDs) and group iden- tifiers (GI ...
168 Chapter 9 (Section 8.1). When a new process is created (e.g., when the shell executes a pro- gram), it inherits these identi ...
Process Credentials 169 As shown in this example, it is possible for a program to have both of these bits set, although this is ...
170 Chapter 9 # ls -l check_password -rwsr-xr-x 1 root users 18150 Oct 28 10:49 check_password # exit $ whoami This is an unpriv ...
Process Credentials 171 The saved set IDs are a System V invention adopted by POSIX. They were not provided on releases of BSD p ...
172 Chapter 9 ownership of new files, in terms of the effective IDs of a process. Even though the process’s file-system IDs are ...
Process Credentials 173 Modifying effective IDs The setuid() system call changes the effective user ID—and possibly the real use ...
174 Chapter 9 changes, rule 1 applies exactly as stated. In rule 2, since changing the group IDs doesn’t cause a process to lose ...
Process Credentials 175 In older versions of the GNU C library (glibc 2.0 and earlier), seteuid(euid) is implemented as setreuid ...
176 Chapter 9 SUSv3 says that it is unspecified whether an unprivileged process can use setreuid() to change the value of the re ...
«
6
7
8
9
10
11
12
13
14
15
»
Free download pdf