Don't return owner in list_owner_ranges API call.

Closes: 339

struct subordinate_range is pretty closely tied to the existing
subid code and /etc/subuid format, so it includes an owner.  Dropping
that or even renaming it is more painful than I'd first thought.
So introduce a 'struct subid_range' which is only the start and
count, leaving 'struct subordinate_range' as the owner, start and
count.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
This commit is contained in:
Serge Hallyn
2021-05-16 21:47:05 -05:00
parent f9831a4a1a
commit 322db32971
7 changed files with 63 additions and 38 deletions

View File

@@ -66,26 +66,21 @@ bool libsubid_init(const char *progname, FILE * logfd)
}
static
int get_subid_ranges(const char *owner, enum subid_type id_type, struct subordinate_range ***ranges)
int get_subid_ranges(const char *owner, enum subid_type id_type, struct subid_range ***ranges)
{
return list_owner_ranges(owner, id_type, ranges);
}
int get_subuid_ranges(const char *owner, struct subordinate_range ***ranges)
int get_subuid_ranges(const char *owner, struct subid_range ***ranges)
{
return get_subid_ranges(owner, ID_TYPE_UID, ranges);
}
int get_subgid_ranges(const char *owner, struct subordinate_range ***ranges)
int get_subgid_ranges(const char *owner, struct subid_range ***ranges)
{
return get_subid_ranges(owner, ID_TYPE_GID, ranges);
}
void subid_free_ranges(struct subordinate_range **ranges, int count)
{
return free_subordinate_ranges(ranges, count);
}
static
int get_subid_owner(unsigned long id, enum subid_type id_type, uid_t **owner)
{