]> granicus.if.org Git - shadow/commitdiff
Remove dead code.
authorNicolas François <nicolas.francois@centraliens.net>
Thu, 15 Aug 2013 14:46:51 +0000 (16:46 +0200)
committerNicolas François <nicolas.francois@centraliens.net>
Thu, 15 Aug 2013 15:30:19 +0000 (17:30 +0200)
* libmisc/find_new_sub_gids.c: Remove dead code.
find_new_sub_gids() is always called with *range_count set to 0.
It's more difficult to keep the subordinate GIDs and UIDs
synchronized, than for the user's UID/GId because the count of
subordinate IDs may differ.
* libmisc/find_new_sub_uids.c: Likewise.
* lib/subordinateio.h, lib/subordinateio.c: Remove APIs that are
no more needed: is_sub_uid_range_free(), is_sub_gid_range_free(),
is_range_free().

ChangeLog
lib/subordinateio.c
lib/subordinateio.h
libmisc/find_new_sub_gids.c
libmisc/find_new_sub_uids.c

index de1f02bd2afa31c4e4d6a074a74505fb11e54d2d..7ae37b1aa23b462079309cef59956a824a088074 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-08-15  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/find_new_sub_gids.c: Remove dead code.
+       find_new_sub_gids() is always called with *range_count set to 0.
+       It's more difficult to keep the subordinate GIDs and UIDs
+       synchronized, than for the user's UID/GId because the count of
+       subordinate IDs may differ.
+       * libmisc/find_new_sub_uids.c: Likewise.
+       * lib/subordinateio.h, lib/subordinateio.c: Remove APIs that are
+       no more needed: is_sub_uid_range_free(), is_sub_gid_range_free(),
+       is_range_free().
+
 2013-08-13  Nicolas François  <nicolas.francois@centraliens.net>
 
        * configure.in: Check if sizeof uid_t and gid_t is larger than 32
index 5a9f4743170810c6407e8808828c1850196cfce9..e79d9e57801a248ec5cbde8f3e50f50890aa2dc9 100644 (file)
@@ -125,23 +125,6 @@ static /*@observer@*/ /*@null*/const struct subordinate_range *subordinate_next(
        commonio_next (db);
 }
 
-static bool is_range_free(struct commonio_db *db, unsigned long start,
-                         unsigned long count)
-{
-       const struct subordinate_range *range;
-       unsigned long end = start + count - 1;
-
-       commonio_rewind(db);
-       while ((range = commonio_next(db)) != NULL) {
-               unsigned long first = range->start;
-               unsigned long last = first + range->count - 1;
-
-               if ((end >= first) && (start <= last))
-                       return false;
-       }
-       return true;
-}
-
 static const bool range_exists(struct commonio_db *db, const char *owner)
 {
        const struct subordinate_range *range;
@@ -406,11 +389,6 @@ int sub_uid_open (int mode)
        return commonio_open (&subordinate_uid_db, mode);
 }
 
-bool is_sub_uid_range_free(uid_t start, unsigned long count)
-{
-       return is_range_free (&subordinate_uid_db, start, count);
-}
-
 bool sub_uid_assigned(const char *owner)
 {
        return range_exists (&subordinate_uid_db, owner);
@@ -489,11 +467,6 @@ int sub_gid_open (int mode)
        return commonio_open (&subordinate_gid_db, mode);
 }
 
-bool is_sub_gid_range_free(gid_t start, unsigned long count)
-{
-       return is_range_free (&subordinate_gid_db, start, count);
-}
-
 bool have_sub_gids(const char *owner, gid_t start, unsigned long count)
 {
        return have_range(&subordinate_gid_db, owner, start, count);
index 42aa50694827679f3933a3c760fa2733b87040af..a21d72b8e8fb4124535026a94b8fc4ed2e903b60 100644 (file)
@@ -12,7 +12,6 @@
 #include <sys/types.h>
 
 extern int sub_uid_close(void);
-extern bool is_sub_uid_range_free(uid_t start, unsigned long count);
 extern bool have_sub_uids(const char *owner, uid_t start, unsigned long count);
 extern bool sub_uid_file_present (void);
 extern bool sub_uid_assigned(const char *owner);
@@ -26,7 +25,6 @@ extern int sub_uid_remove (const char *owner, uid_t start, unsigned long count);
 extern uid_t sub_uid_find_free_range(uid_t min, uid_t max, unsigned long count);
 
 extern int sub_gid_close(void);
-extern bool is_sub_gid_range_free(gid_t start, unsigned long count);
 extern bool have_sub_gids(const char *owner, gid_t start, unsigned long count);
 extern bool sub_gid_file_present (void);
 extern bool sub_gid_assigned(const char *owner);
index 5d12d9ac2db39c103f07c6952156f77d8f6a455b..335203ca199172173b5abdf68896b13fe9e53b5f 100644 (file)
@@ -68,14 +68,6 @@ int find_new_sub_gids (const char *owner,
                return -1;
        }
 
-       /* Is there a preferred range that works? */
-       if ((*range_count != 0) &&
-           (*range_start >= min) &&
-           (((*range_start) + (*range_count) - 1) <= max) &&
-           is_sub_gid_range_free(*range_start, *range_count)) {
-               return 0;
-       }
-
        start = sub_gid_find_free_range(min, max, count);
        if (start == (gid_t)-1) {
                fprintf (stderr,
index 525408ce6d3738dcd45e95a11af9757bca11c934..6afaa96d16ec71d2b8943d164ae429f04786fa4a 100644 (file)
@@ -68,14 +68,6 @@ int find_new_sub_uids (const char *owner,
                return -1;
        }
 
-       /* Is there a preferred range that works? */
-       if ((*range_count != 0) &&
-           (*range_start >= min) &&
-           (((*range_start) + (*range_count) - 1) <= max) &&
-           is_sub_uid_range_free(*range_start, *range_count)) {
-               return 0;
-       }
-
        start = sub_uid_find_free_range(min, max, count);
        if (start == (uid_t)-1) {
                fprintf (stderr,