Merge pull request #245 from hallyn/2020-04-17/libmisc

remove unused and misleading 'owner' argument from find_new_sub*
This commit is contained in:
Christian Brauner 2020-04-18 12:32:38 +02:00 committed by GitHub
commit 52aba825af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 12 deletions

View File

@ -161,12 +161,10 @@ extern int find_new_uid (bool sys_user,
#ifdef ENABLE_SUBIDS #ifdef ENABLE_SUBIDS
/* find_new_sub_gids.c */ /* find_new_sub_gids.c */
extern int find_new_sub_gids (const char *owner, extern int find_new_sub_gids (gid_t *range_start, unsigned long *range_count);
gid_t *range_start, unsigned long *range_count);
/* find_new_sub_uids.c */ /* find_new_sub_uids.c */
extern int find_new_sub_uids (const char *owner, extern int find_new_sub_uids (uid_t *range_start, unsigned long *range_count);
uid_t *range_start, unsigned long *range_count);
#endif /* ENABLE_SUBIDS */ #endif /* ENABLE_SUBIDS */

View File

@ -46,8 +46,7 @@
* *
* Return 0 on success, -1 if no unused GIDs are available. * Return 0 on success, -1 if no unused GIDs are available.
*/ */
int find_new_sub_gids (const char *owner, int find_new_sub_gids (gid_t *range_start, unsigned long *range_count)
gid_t *range_start, unsigned long *range_count)
{ {
unsigned long min, max; unsigned long min, max;
unsigned long count; unsigned long count;

View File

@ -46,8 +46,7 @@
* *
* Return 0 on success, -1 if no unused UIDs are available. * Return 0 on success, -1 if no unused UIDs are available.
*/ */
int find_new_sub_uids (const char *owner, int find_new_sub_uids (uid_t *range_start, unsigned long *range_count)
uid_t *range_start, unsigned long *range_count)
{ {
unsigned long min, max; unsigned long min, max;
unsigned long count; unsigned long count;

View File

@ -1251,7 +1251,7 @@ int main (int argc, char **argv)
if (is_sub_uid && !sub_uid_assigned(fields[0])) { if (is_sub_uid && !sub_uid_assigned(fields[0])) {
uid_t sub_uid_start = 0; uid_t sub_uid_start = 0;
unsigned long sub_uid_count = 0; unsigned long sub_uid_count = 0;
if (find_new_sub_uids(fields[0], &sub_uid_start, &sub_uid_count) == 0) { if (find_new_sub_uids(&sub_uid_start, &sub_uid_count) == 0) {
if (sub_uid_add(fields[0], sub_uid_start, sub_uid_count) == 0) { if (sub_uid_add(fields[0], sub_uid_start, sub_uid_count) == 0) {
fprintf (stderr, fprintf (stderr,
_("%s: failed to prepare new %s entry\n"), _("%s: failed to prepare new %s entry\n"),
@ -1271,7 +1271,7 @@ int main (int argc, char **argv)
if (is_sub_gid && !sub_gid_assigned(fields[0])) { if (is_sub_gid && !sub_gid_assigned(fields[0])) {
gid_t sub_gid_start = 0; gid_t sub_gid_start = 0;
unsigned long sub_gid_count = 0; unsigned long sub_gid_count = 0;
if (find_new_sub_gids(fields[0], &sub_gid_start, &sub_gid_count) == 0) { if (find_new_sub_gids(&sub_gid_start, &sub_gid_count) == 0) {
if (sub_gid_add(fields[0], sub_gid_start, sub_gid_count) == 0) { if (sub_gid_add(fields[0], sub_gid_start, sub_gid_count) == 0) {
fprintf (stderr, fprintf (stderr,
_("%s: failed to prepare new %s entry\n"), _("%s: failed to prepare new %s entry\n"),

View File

@ -2489,7 +2489,7 @@ int main (int argc, char **argv)
#ifdef ENABLE_SUBIDS #ifdef ENABLE_SUBIDS
if (is_sub_uid) { if (is_sub_uid) {
if (find_new_sub_uids(user_name, &sub_uid_start, &sub_uid_count) < 0) { if (find_new_sub_uids(&sub_uid_start, &sub_uid_count) < 0) {
fprintf (stderr, fprintf (stderr,
_("%s: can't create subordinate user IDs\n"), _("%s: can't create subordinate user IDs\n"),
Prog); Prog);
@ -2497,7 +2497,7 @@ int main (int argc, char **argv)
} }
} }
if (is_sub_gid) { if (is_sub_gid) {
if (find_new_sub_gids(user_name, &sub_gid_start, &sub_gid_count) < 0) { if (find_new_sub_gids(&sub_gid_start, &sub_gid_count) < 0) {
fprintf (stderr, fprintf (stderr,
_("%s: can't create subordinate group IDs\n"), _("%s: can't create subordinate group IDs\n"),
Prog); Prog);