count = getdef_ulong ("SUB_GID_COUNT", 65536);
if (min > max || count >= max || (min + count - 1) > max) {
- (void) fprintf (log_get_logfd(),
- _("%s: Invalid configuration: SUB_GID_MIN (%lu),"
- " SUB_GID_MAX (%lu), SUB_GID_COUNT (%lu)\n"),
- log_get_progname(), min, max, count);
+ errno = ERANGE;
return -1;
}
start = sub_gid_find_free_range(min, max, count);
if (start == (id_t)-1) {
- fprintf (log_get_logfd(),
- _("%s: Can't get unique subordinate GID range\n"),
- log_get_progname());
- SYSLOG(LOG_WARN, "no more available subordinate GIDs on the system");
+ errno = EUSERS;
return -1;
}
*range_start = start;
count = getdef_ulong ("SUB_UID_COUNT", 65536);
if (min > max || count >= max || (min + count - 1) > max) {
- (void) fprintf (log_get_logfd(),
- _("%s: Invalid configuration: SUB_UID_MIN (%lu),"
- " SUB_UID_MAX (%lu), SUB_UID_COUNT (%lu)\n"),
- log_get_progname(), min, max, count);
+ errno = ERANGE;
return -1;
}
start = sub_uid_find_free_range(min, max, count);
if (start == (id_t)-1) {
- fprintf (log_get_logfd(),
- _("%s: Can't get unique subordinate UID range\n"),
- log_get_progname());
- SYSLOG(LOG_WARN, "no more available subordinate UIDs on the system");
+ errno = EUSERS;
return -1;
}
*range_start = start;
if (find_new_sub_uids(&sub_uid_start, &sub_uid_count) != 0)
{
fprintf (stderr,
- _("%s: can't find subordinate user range\n"),
- Prog);
+ _("%s: can't find subordinate user range: %s\n"),
+ Prog, strerrno());
+ SYSLOG(LOG_WARN, "can't find subordinate user range: %s\n",
+ strerrno());
fail_exit (EXIT_FAILURE, process_selinux);
}
if (sub_uid_add(fields[0], sub_uid_start, sub_uid_count) == 0)
unsigned long sub_gid_count = 0;
if (find_new_sub_gids(&sub_gid_start, &sub_gid_count) != 0) {
fprintf (stderr,
- _("%s: can't find subordinate group range\n"),
- Prog);
+ _("%s: can't find subordinate group range: %s\n"),
+ Prog, strerrno());
+ SYSLOG(LOG_WARN, "can't find subordinate group range: %s\n",
+ strerrno());
fail_exit (EXIT_FAILURE, process_selinux);
}
if (sub_gid_add(fields[0], sub_gid_start, sub_gid_count) == 0) {
if (is_sub_uid && subuid_count != 0) {
if (find_new_sub_uids(&sub_uid_start, &subuid_count) < 0) {
fprintf (stderr,
- _("%s: can't create subordinate user IDs\n"),
- Prog);
+ _("%s: can't create subordinate user IDs: %s\n"),
+ Prog, strerrno());
+ SYSLOG(LOG_WARN, "can't create subordinate user IDs: %s\n",
+ strerrno());
fail_exit(E_SUB_UID_UPDATE, process_selinux);
}
}
if (is_sub_gid && subgid_count != 0) {
if (find_new_sub_gids(&sub_gid_start, &subgid_count) < 0) {
fprintf (stderr,
- _("%s: can't create subordinate group IDs\n"),
- Prog);
+ _("%s: can't create subordinate group IDs: %s\n"),
+ Prog, strerrno());
+ SYSLOG(LOG_WARN, "can't create subordinate group IDs: %s\n",
+ strerrno());
fail_exit(E_SUB_GID_UPDATE, process_selinux);
}
}
if (Sflg) {
if (find_range (&add_sub_uids, find_new_sub_uids) == 0) {
fprintf (stderr,
- _("%s: unable to find new subordinate uid range\n"),
- Prog);
+ _("%s: unable to find new subordinate uid range: %s\n"),
+ Prog, strerrno());
+ SYSLOG(LOG_WARN, "unable to find new subordinate uid range: %s\n",
+ strerrno());
fail_exit (E_SUB_UID_UPDATE, process_selinux);
}
if (find_range (&add_sub_gids, find_new_sub_gids) == 0) {
fprintf (stderr,
- _("%s: unable to find new subordinate gid range\n"),
- Prog);
+ _("%s: unable to find new subordinate gid range: %s\n"),
+ Prog, strerrno());
+ SYSLOG(LOG_WARN, "unable to find new subordinate gid range: %s\n",
+ strerrno());
fail_exit (E_SUB_GID_UPDATE, process_selinux);
}
}