| 159 | } |
| 160 | |
| 161 | static void |
| 162 | cf_find_ids(void) |
| 163 | { |
| 164 | if (cf_subid_user) |
| 165 | { |
| 166 | if (cf_first_uid || cf_first_gid) |
| 167 | die("Configuration must not specify both subid_user and first_uid/first_gid"); |
| 168 | |
| 169 | int num_uids, num_gids; |
| 170 | cf_first_uid = find_subid("/etc/subuid", cf_subid_user, &num_uids); |
| 171 | cf_first_gid = find_subid("/etc/subgid", cf_subid_user, &num_gids); |
| 172 | |
| 173 | if (!cf_num_boxes) |
| 174 | cf_num_boxes = (num_uids < num_gids) ? num_uids : num_gids; |
| 175 | else |
| 176 | { |
| 177 | if (num_uids < cf_num_boxes) |
| 178 | die("Configured num_boxes=%d, but only %d subuids are available", cf_num_boxes, num_uids); |
| 179 | if (num_gids < cf_num_boxes) |
| 180 | die("Configured num_boxes=%d, but only %d subgids are available", cf_num_boxes, num_gids); |
| 181 | } |
| 182 | } |
| 183 | else |
| 184 | { |
| 185 | if (!cf_num_boxes || !cf_first_uid || !cf_first_gid) |
| 186 | die("Configuration must specify either subuid_user, or first_uid/first_gid/num_boxes"); |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | static void |
| 191 | cf_check(void) |
no test coverage detected
searching dependent graphs…