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:
@@ -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)
|
||||
{
|
||||
|
@@ -3,6 +3,15 @@
|
||||
|
||||
#ifndef SUBID_RANGE_DEFINED
|
||||
#define SUBID_RANGE_DEFINED 1
|
||||
|
||||
/* subid_range is just a starting point and size of a range */
|
||||
struct subid_range {
|
||||
unsigned long start;
|
||||
unsigned long count;
|
||||
};
|
||||
|
||||
/* subordinage_range is a subid_range plus an owner, representing
|
||||
* a range in /etc/subuid or /etc/subgid */
|
||||
struct subordinate_range {
|
||||
const char *owner;
|
||||
unsigned long start;
|
||||
@@ -46,7 +55,7 @@ bool libsubid_init(const char *progname, FILE *logfd);
|
||||
*
|
||||
* returns: number of ranges found, ir < 0 on error.
|
||||
*/
|
||||
int get_subuid_ranges(const char *owner, struct subordinate_range ***ranges);
|
||||
int get_subuid_ranges(const char *owner, struct subid_range ***ranges);
|
||||
|
||||
/*
|
||||
* get_subgid_ranges: return a list of GID ranges for a user
|
||||
@@ -57,7 +66,7 @@ int get_subuid_ranges(const char *owner, struct subordinate_range ***ranges);
|
||||
*
|
||||
* returns: number of ranges found, ir < 0 on error.
|
||||
*/
|
||||
int get_subgid_ranges(const char *owner, struct subordinate_range ***ranges);
|
||||
int get_subgid_ranges(const char *owner, struct subid_range ***ranges);
|
||||
|
||||
/*
|
||||
* subid_free_ranges: free an array of subordinate_ranges returned by either
|
||||
@@ -66,7 +75,7 @@ int get_subgid_ranges(const char *owner, struct subordinate_range ***ranges);
|
||||
* @ranges: the ranges to free
|
||||
* @count: the number of ranges in @ranges
|
||||
*/
|
||||
void subid_free_ranges(struct subordinate_range **ranges, int count);
|
||||
void subid_free_ranges(struct subid_range **ranges, int count);
|
||||
|
||||
/*
|
||||
* get_subuid_owners: return a list of uids to which the given uid has been
|
||||
|
Reference in New Issue
Block a user