From 86789d22680c3583c4bc743a1db400d1647993c9 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 10 Jun 2025 12:42:56 +0200 Subject: [PATCH 01/10] lib/shadow/group/sgetgrent.c: Move free(3) call outside of helper This is for consistency with how this is done in sgetsgent(). Now we need to make sure that the list is NULL before the first call, which means that the 'grent' structure must be cleared. Since it's a static object, it's already true, but let's be explicit about it. Since we remember the address of the list in grent.gr_mem (which is static), we don't need to keep 'members' being static too, so we get rid of one static thing. Signed-off-by: Alejandro Colomar --- lib/shadow/group/sgetgrent.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/shadow/group/sgetgrent.c b/lib/shadow/group/sgetgrent.c index 2a13091ef0..98d76f62c2 100644 --- a/lib/shadow/group/sgetgrent.c +++ b/lib/shadow/group/sgetgrent.c @@ -38,12 +38,9 @@ static char ** list(char *s) { - static char **members = NULL; - + char **members; size_t n; - free(members); - members = astrsep2ls(s, ",", &n); if (members == NULL) return NULL; @@ -60,7 +57,7 @@ struct group * sgetgrent(const char *s) { static char *dup = NULL; - static struct group grent; + static struct group grent = {}; char *fields[4]; @@ -82,6 +79,9 @@ sgetgrent(const char *s) if (get_gid(fields[2], &grent.gr_gid) == -1) { return NULL; } + + free(grent.gr_mem); + grent.gr_mem = list(fields[3]); if (NULL == grent.gr_mem) { return NULL; /* out of memory */ From e1bf5b8b25000a632de986d39faf957f9be07538 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 10 Jun 2025 12:51:13 +0200 Subject: [PATCH 02/10] lib/shadow/gshadow/sgetsgent.c: Don't exit from library code Imitate how this is done in sgetgrent(). BE CAREFUL: The NULL check needs to be performed after *both* build_list() calls, since we need to make sure that either a NULL or a valid pointer is stored in both .sg_adm and .sg_mem, since we'll call free(3) next time sgetsgent() is called. Signed-off-by: Alejandro Colomar --- lib/shadow/gshadow/sgetsgent.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/shadow/gshadow/sgetsgent.c b/lib/shadow/gshadow/sgetsgent.c index a239b45ad9..9c059282a4 100644 --- a/lib/shadow/gshadow/sgetsgent.c +++ b/lib/shadow/gshadow/sgetsgent.c @@ -55,6 +55,9 @@ sgetsgent(const char *s) sgroup.sg_adm = build_list(fields[2]); sgroup.sg_mem = build_list(fields[3]); + if (sgroup.sg_adm == NULL || sgroup.sg_mem == NULL) + return NULL; + return &sgroup; } @@ -65,7 +68,9 @@ build_list(char *s) char **l; size_t n; - l = xastrsep2ls(s, ",", &n); + l = astrsep2ls(s, ",", &n); + if (l == NULL) + return NULL; if (streq(l[n-1], "")) l[n-1] = NULL; From 5bcf8a04d99059ab56cc346a56c786fd1a8463bb Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 10 Jun 2025 13:04:43 +0200 Subject: [PATCH 03/10] lib/, src/: Use more readable syntax for empty loops Signed-off-by: Alejandro Colomar --- lib/age.c | 3 ++- lib/cleanup.c | 3 ++- lib/groupio.c | 6 ++++-- lib/groupmem.c | 3 ++- lib/list.c | 3 ++- lib/sgroupio.c | 6 ++++-- src/groupdel.c | 3 ++- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/age.c b/lib/age.c index fe8b0e6198..0da755f7d0 100644 --- a/lib/age.c +++ b/lib/age.c @@ -125,7 +125,8 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp) exit (EXIT_FAILURE); } - while (((child = wait (&status)) != pid) && (child != (pid_t)-1)); + while (((child = wait (&status)) != pid) && (child != (pid_t)-1)) + continue; if ((child == pid) && (0 == status)) { return 1; diff --git a/lib/cleanup.c b/lib/cleanup.c index 4fc12eae88..9d39afec63 100644 --- a/lib/cleanup.c +++ b/lib/cleanup.c @@ -78,7 +78,8 @@ void add_cleanup (/*@notnull@*/cleanup_function pcf, /*@null@*/void *arg) } /* Add the cleanup_function at the end of the stack */ - for (i=0; NULL != cleanup_functions[i]; i++); + for (i=0; NULL != cleanup_functions[i]; i++) + continue; cleanup_functions[i] = pcf; cleanup_function_args[i] = arg; } diff --git a/lib/groupio.c b/lib/groupio.c index 119afa33df..2b08bd06de 100644 --- a/lib/groupio.c +++ b/lib/groupio.c @@ -330,7 +330,8 @@ static /*@null@*/struct commonio_entry *merge_group_entries ( return NULL; /* Concatenate the 2 list of members */ - for (i=0; NULL != gptr1->gr_mem[i]; i++); + for (i=0; NULL != gptr1->gr_mem[i]; i++) + continue; members += i; for (i=0; NULL != gptr2->gr_mem[i]; i++) { char **pmember = gptr1->gr_mem; @@ -400,7 +401,8 @@ static int split_groups (unsigned int max_members) if (NULL == gptr) { continue; } - for (members = 0; NULL != gptr->gr_mem[members]; members++); + for (members = 0; NULL != gptr->gr_mem[members]; members++) + continue; if (members <= max_members) { continue; } diff --git a/lib/groupmem.c b/lib/groupmem.c index 1ebe2f9ba0..19efa11775 100644 --- a/lib/groupmem.c +++ b/lib/groupmem.c @@ -46,7 +46,8 @@ return NULL; } - for (i = 0; grent->gr_mem[i]; i++); + for (i = 0; grent->gr_mem[i]; i++) + continue; /*@-mustfreeonly@*/ gr->gr_mem = malloc_T(i + 1, char *); diff --git a/lib/list.c b/lib/list.c index 8fa0e085ac..1ccc8c43f9 100644 --- a/lib/list.c +++ b/lib/list.c @@ -141,7 +141,8 @@ dup_list(char *const *list) assert (NULL != list); - for (i = 0; NULL != list[i]; i++); + for (i = 0; NULL != list[i]; i++) + continue; tmp = xmalloc_T(i + 1, char *); diff --git a/lib/sgroupio.c b/lib/sgroupio.c index ad3adc3463..afe12fefb7 100644 --- a/lib/sgroupio.c +++ b/lib/sgroupio.c @@ -56,7 +56,8 @@ return NULL; } - for (i = 0; NULL != sgent->sg_adm[i]; i++); + for (i = 0; NULL != sgent->sg_adm[i]; i++) + continue; /*@-mustfreeonly@*/ sg->sg_adm = malloc_T(i + 1, char *); /*@=mustfreeonly@*/ @@ -81,7 +82,8 @@ } sg->sg_adm[i] = NULL; - for (i = 0; NULL != sgent->sg_mem[i]; i++); + for (i = 0; NULL != sgent->sg_mem[i]; i++) + continue; /*@-mustfreeonly@*/ sg->sg_mem = malloc_T(i + 1, char *); /*@=mustfreeonly@*/ diff --git a/src/groupdel.c b/src/groupdel.c index 19d67fc315..dfebdc5927 100644 --- a/src/groupdel.c +++ b/src/groupdel.c @@ -267,7 +267,8 @@ static void group_busy (gid_t gid) prefix_setpwent (); - while ( ((pwd = prefix_getpwent ()) != NULL) && (pwd->pw_gid != gid) ); + while ( ((pwd = prefix_getpwent ()) != NULL) && (pwd->pw_gid != gid) ) + continue; prefix_endpwent (); From b6b2d3e96505959c9ac73ee58102ce26996d927b Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 10 Jun 2025 13:17:38 +0200 Subject: [PATCH 04/10] lib/: Deduplicate code Move build_list() to "lib/list.c", where we can reuse it. Signed-off-by: Alejandro Colomar --- lib/list.c | 17 +++++++++++++++++ lib/prototypes.h | 1 + lib/shadow/group/sgetgrent.c | 29 +---------------------------- lib/shadow/gshadow/sgetsgent.c | 22 +--------------------- 4 files changed, 20 insertions(+), 49 deletions(-) diff --git a/lib/list.c b/lib/list.c index 1ccc8c43f9..7d4a128d64 100644 --- a/lib/list.c +++ b/lib/list.c @@ -14,6 +14,7 @@ #include "string/strchr/strchrcnt.h" #include "string/strcmp/streq.h" #include "string/strdup/strdup.h" +#include "string/strtok/astrsep2ls.h" #include "string/strtok/strsep2ls.h" #undef NDEBUG @@ -231,3 +232,19 @@ comma_to_list(const char *comma) return array; } + +char ** +build_list(char *s) +{ + char **l; + size_t n; + + l = astrsep2ls(s, ",", &n); + if (l == NULL) + return NULL; + + if (streq(l[n-1], "")) + l[n-1] = NULL; + + return l; +} diff --git a/lib/prototypes.h b/lib/prototypes.h index 8fb9f190d9..990fcd0c94 100644 --- a/lib/prototypes.h +++ b/lib/prototypes.h @@ -190,6 +190,7 @@ extern /*@only@*/char **dup_list (char *const *); extern void free_list (char **); extern bool is_on_list (char *const *list, const char *member); extern /*@only@*/char **comma_to_list (const char *); +extern char **build_list(char *s); #ifdef ENABLE_LASTLOG /* log.c */ diff --git a/lib/shadow/group/sgetgrent.c b/lib/shadow/group/sgetgrent.c index 98d76f62c2..02e7f78220 100644 --- a/lib/shadow/group/sgetgrent.c +++ b/lib/shadow/group/sgetgrent.c @@ -23,33 +23,6 @@ #include "string/strcmp/streq.h" #include "string/strtok/stpsep.h" #include "string/strtok/strsep2arr.h" -#include "string/strtok/astrsep2ls.h" - - -/* - * list - turn a comma-separated string into an array of (char *)'s - * - * list() converts the comma-separated list of member names into - * an array of character pointers. - * - * FINALLY added dynamic allocation. Still need to fix sgetsgent(). - * --marekm - */ -static char ** -list(char *s) -{ - char **members; - size_t n; - - members = astrsep2ls(s, ",", &n); - if (members == NULL) - return NULL; - - if (streq(members[n-1], "")) - members[n-1] = NULL; - - return members; -} // from-string get group entry @@ -82,7 +55,7 @@ sgetgrent(const char *s) free(grent.gr_mem); - grent.gr_mem = list(fields[3]); + grent.gr_mem = build_list(fields[3]); if (NULL == grent.gr_mem) { return NULL; /* out of memory */ } diff --git a/lib/shadow/gshadow/sgetsgent.c b/lib/shadow/gshadow/sgetsgent.c index 9c059282a4..15107cd97a 100644 --- a/lib/shadow/gshadow/sgetsgent.c +++ b/lib/shadow/gshadow/sgetsgent.c @@ -14,9 +14,9 @@ #include #include +#include "prototypes.h" #include "shadow/gshadow/sgrp.h" #include "string/strcmp/streq.h" -#include "string/strtok/astrsep2ls.h" #include "string/strtok/stpsep.h" #include "string/strtok/strsep2arr.h" @@ -25,9 +25,6 @@ static struct sgrp sgroup = {}; -static char **build_list(char *s); - - // from-string get shadow group entry struct sgrp * sgetsgent(const char *s) @@ -60,21 +57,4 @@ sgetsgent(const char *s) return &sgroup; } - - -static char ** -build_list(char *s) -{ - char **l; - size_t n; - - l = astrsep2ls(s, ",", &n); - if (l == NULL) - return NULL; - - if (streq(l[n-1], "")) - l[n-1] = NULL; - - return l; -} #endif From e9f3b1ca5e0027ebac3f69a43a79df4d5c1784f4 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 10 Jun 2025 13:37:14 +0200 Subject: [PATCH 05/10] lib/list.c: comma_to_list(): Allow a trailing comma In some places we call comma_to_list(), and in others build_list(), and they're essentially the same thing: they transform a comma-separated list into an array of strings. Both of them consider an empty list to have 0 members instead of one. However, they differ in how they treat trailing commas: - comma_to_list() interprets that as an empty field. - build_list() ignores the trailing comma. The behavior of build_list() seems more appropriate, since it allows tools to generate the CSVs more easily. Also, these lists are used to represent user names or group names, so an empty user name makes no sense. This patch makes both functions be more consistent, which will eventually allow us to de-duplicate code. Signed-off-by: Alejandro Colomar --- lib/list.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/list.c b/lib/list.c index 7d4a128d64..00bc654c2d 100644 --- a/lib/list.c +++ b/lib/list.c @@ -217,18 +217,13 @@ comma_to_list(const char *comma) n = strchrcnt(members, ',') + 2; array = xmalloc_T(n, char *); - /* - * Empty list is special - 0 members, not 1 empty member. --marekm - */ - - if (streq(members, "")) { - *array = NULL; - free (members); - return array; - } - strsep2ls(members, ",", n, array); + if (streq(array[n-1], "")) + array[n-1] = NULL; + if (array[0] == NULL) + free(members); + return array; } From 438c095f7401b7180f5a4ace755ea3800410009e Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 10 Jun 2025 13:45:36 +0200 Subject: [PATCH 06/10] lib/list.c: comma_to_list(): Use xastrsep2ls() instead of its pattern Signed-off-by: Alejandro Colomar --- lib/list.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/list.c b/lib/list.c index 00bc654c2d..3feca735bf 100644 --- a/lib/list.c +++ b/lib/list.c @@ -11,11 +11,10 @@ #include "alloc/malloc.h" #include "prototypes.h" #include "defines.h" -#include "string/strchr/strchrcnt.h" #include "string/strcmp/streq.h" #include "string/strdup/strdup.h" #include "string/strtok/astrsep2ls.h" -#include "string/strtok/strsep2ls.h" +#include "string/strtok/xastrsep2ls.h" #undef NDEBUG #include @@ -209,15 +208,7 @@ comma_to_list(const char *comma) members = xstrdup (comma); - /* - * Allocate the array we're going to store the pointers into. - * n: number of delimiters + last element + NULL - */ - - n = strchrcnt(members, ',') + 2; - array = xmalloc_T(n, char *); - - strsep2ls(members, ",", n, array); + array = xastrsep2ls(members, ",", &n); if (streq(array[n-1], "")) array[n-1] = NULL; From 09e21002edbdd7e52b6bf3208da164f0c71453dc Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 10 Jun 2025 14:02:59 +0200 Subject: [PATCH 07/10] lib/shadow/group/sgetgrent.c: Remove redundant code get_gid() will fail to parse a number if the field is empty. Signed-off-by: Alejandro Colomar --- lib/shadow/group/sgetgrent.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/shadow/group/sgetgrent.c b/lib/shadow/group/sgetgrent.c index 02e7f78220..ed5027a2b7 100644 --- a/lib/shadow/group/sgetgrent.c +++ b/lib/shadow/group/sgetgrent.c @@ -20,7 +20,6 @@ #include "atoi/getnum.h" #include "defines.h" #include "prototypes.h" -#include "string/strcmp/streq.h" #include "string/strtok/stpsep.h" #include "string/strtok/strsep2arr.h" @@ -44,14 +43,10 @@ sgetgrent(const char *s) if (strsep2arr_a(dup, ":", fields) == -1) return NULL; - if (streq(fields[2], "")) - return NULL; - grent.gr_name = fields[0]; grent.gr_passwd = fields[1]; - if (get_gid(fields[2], &grent.gr_gid) == -1) { + if (get_gid(fields[2], &grent.gr_gid) == -1) return NULL; - } free(grent.gr_mem); From 63f8ff9346f6356804b92899152e0780d40ad871 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 10 Jun 2025 14:20:12 +0200 Subject: [PATCH 08/10] lib/list.c: comma_to_list(): Use build_list() instead of its pattern Signed-off-by: Alejandro Colomar --- lib/list.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/list.c b/lib/list.c index 3feca735bf..25bbcbb67c 100644 --- a/lib/list.c +++ b/lib/list.c @@ -8,13 +8,15 @@ #include "config.h" +#include +#include + #include "alloc/malloc.h" #include "prototypes.h" #include "defines.h" #include "string/strcmp/streq.h" #include "string/strdup/strdup.h" #include "string/strtok/astrsep2ls.h" -#include "string/strtok/xastrsep2ls.h" #undef NDEBUG #include @@ -198,7 +200,6 @@ comma_to_list(const char *comma) { char *members; char **array; - size_t n; assert (NULL != comma); @@ -208,10 +209,10 @@ comma_to_list(const char *comma) members = xstrdup (comma); - array = xastrsep2ls(members, ",", &n); + array = build_list(members); + if (array == NULL) + exit(EXIT_FAILURE); - if (streq(array[n-1], "")) - array[n-1] = NULL; if (array[0] == NULL) free(members); From 8ab79ee78c6f713e0cffc8fde9d88ee46af61514 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 14 Jun 2025 00:27:37 +0200 Subject: [PATCH 09/10] lib/: Rename build_list() => acsv2ls() This name tells better what this API does. The name has a leading 'a', as it allocates memory, and then 'csv2ls' because it parses a CSV into a list. Signed-off-by: Alejandro Colomar --- lib/list.c | 4 ++-- lib/prototypes.h | 2 +- lib/shadow/group/sgetgrent.c | 2 +- lib/shadow/gshadow/sgetsgent.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/list.c b/lib/list.c index 25bbcbb67c..6cf577ae11 100644 --- a/lib/list.c +++ b/lib/list.c @@ -209,7 +209,7 @@ comma_to_list(const char *comma) members = xstrdup (comma); - array = build_list(members); + array = acsv2ls(members); if (array == NULL) exit(EXIT_FAILURE); @@ -221,7 +221,7 @@ comma_to_list(const char *comma) char ** -build_list(char *s) +acsv2ls(char *s) { char **l; size_t n; diff --git a/lib/prototypes.h b/lib/prototypes.h index 990fcd0c94..68f77a4d78 100644 --- a/lib/prototypes.h +++ b/lib/prototypes.h @@ -190,7 +190,7 @@ extern /*@only@*/char **dup_list (char *const *); extern void free_list (char **); extern bool is_on_list (char *const *list, const char *member); extern /*@only@*/char **comma_to_list (const char *); -extern char **build_list(char *s); +extern char **acsv2ls(char *s); #ifdef ENABLE_LASTLOG /* log.c */ diff --git a/lib/shadow/group/sgetgrent.c b/lib/shadow/group/sgetgrent.c index ed5027a2b7..cc10ffbb42 100644 --- a/lib/shadow/group/sgetgrent.c +++ b/lib/shadow/group/sgetgrent.c @@ -50,7 +50,7 @@ sgetgrent(const char *s) free(grent.gr_mem); - grent.gr_mem = build_list(fields[3]); + grent.gr_mem = acsv2ls(fields[3]); if (NULL == grent.gr_mem) { return NULL; /* out of memory */ } diff --git a/lib/shadow/gshadow/sgetsgent.c b/lib/shadow/gshadow/sgetsgent.c index 15107cd97a..8638ed5c49 100644 --- a/lib/shadow/gshadow/sgetsgent.c +++ b/lib/shadow/gshadow/sgetsgent.c @@ -49,8 +49,8 @@ sgetsgent(const char *s) free(sgroup.sg_adm); free(sgroup.sg_mem); - sgroup.sg_adm = build_list(fields[2]); - sgroup.sg_mem = build_list(fields[3]); + sgroup.sg_adm = acsv2ls(fields[2]); + sgroup.sg_mem = acsv2ls(fields[3]); if (sgroup.sg_adm == NULL || sgroup.sg_mem == NULL) return NULL; From a05a861e605c924f6138689ba683fb401311e29a Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 29 Sep 2025 01:15:02 +0200 Subject: [PATCH 10/10] lib/, src/: Move list.c prototypes to new file list.h Signed-off-by: Alejandro Colomar --- lib/Makefile.am | 1 + lib/limits.c | 17 ++++++++--------- lib/list.c | 3 ++- lib/list.h | 23 +++++++++++++++++++++++ lib/prototypes.h | 9 --------- lib/shadow/group/sgetgrent.c | 3 +-- lib/shadow/gshadow/sgetsgent.c | 2 +- src/chgpasswd.c | 1 + src/gpasswd.c | 1 + src/groupadd.c | 1 + src/groupmod.c | 1 + src/newgrp.c | 1 + src/su.c | 1 + src/suauth.c | 1 + src/useradd.c | 1 + src/userdel.c | 1 + src/usermod.c | 1 + 17 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 lib/list.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 1154a12aca..6ed1a6e1d9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -112,6 +112,7 @@ libshadow_la_SOURCES = \ isexpired.c \ limits.c \ list.c \ + list.h \ lockpw.c \ loginprompt.c \ mail.c \ diff --git a/lib/limits.c b/lib/limits.c index 3fabe54d3a..c590c3e814 100644 --- a/lib/limits.c +++ b/lib/limits.c @@ -17,21 +17,20 @@ #ifndef USE_PAM -#ident "$Id$" - -#include -#include -#include #include -#include "prototypes.h" -#include "defines.h" #include -#include "getdef.h" -#include "shadowlog.h" +#include +#include +#include #include #include "atoi/a2i.h" #include "io/fgets/fgets.h" +#include "defines.h" +#include "list.h" +#include "getdef.h" +#include "prototypes.h" +#include "shadowlog.h" #include "string/memset/memzero.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" diff --git a/lib/list.c b/lib/list.c index 6cf577ae11..aaf6bfe5a0 100644 --- a/lib/list.c +++ b/lib/list.c @@ -8,11 +8,12 @@ #include "config.h" +#include "list.h" + #include #include #include "alloc/malloc.h" -#include "prototypes.h" #include "defines.h" #include "string/strcmp/streq.h" #include "string/strdup/strdup.h" diff --git a/lib/list.h b/lib/list.h new file mode 100644 index 0000000000..7cf81939ee --- /dev/null +++ b/lib/list.h @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2025, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#ifndef SHADOW_INCLUDE_LIB_LIST_H_ +#define SHADOW_INCLUDE_LIB_LIST_H_ + + +#include "config.h" + +#include + + +extern /*@only@*/char **add_list (/*@returned@*/ /*@only@*/char **, const char *); +extern /*@only@*/char **del_list (/*@returned@*/ /*@only@*/char **, const char *); +extern /*@only@*/char **dup_list (char *const *); +extern void free_list (char **); +extern bool is_on_list (char *const *list, const char *member); +extern /*@only@*/char **comma_to_list (const char *); +extern char **acsv2ls(char *s); + + +#endif // include guard diff --git a/lib/prototypes.h b/lib/prototypes.h index 68f77a4d78..59a7d896f4 100644 --- a/lib/prototypes.h +++ b/lib/prototypes.h @@ -183,15 +183,6 @@ void audit_logger_with_group(int type, const char *op, const char *name, extern void setup_limits (const struct passwd *); #endif -/* list.c */ -extern /*@only@*/char **add_list (/*@returned@*/ /*@only@*/char **, const char *); -extern /*@only@*/char **del_list (/*@returned@*/ /*@only@*/char **, const char *); -extern /*@only@*/char **dup_list (char *const *); -extern void free_list (char **); -extern bool is_on_list (char *const *list, const char *member); -extern /*@only@*/char **comma_to_list (const char *); -extern char **acsv2ls(char *s); - #ifdef ENABLE_LASTLOG /* log.c */ extern void dolastlog ( diff --git a/lib/shadow/group/sgetgrent.c b/lib/shadow/group/sgetgrent.c index cc10ffbb42..af1d7add8e 100644 --- a/lib/shadow/group/sgetgrent.c +++ b/lib/shadow/group/sgetgrent.c @@ -18,8 +18,7 @@ #include "alloc/malloc.h" #include "atoi/getnum.h" -#include "defines.h" -#include "prototypes.h" +#include "list.h" #include "string/strtok/stpsep.h" #include "string/strtok/strsep2arr.h" diff --git a/lib/shadow/gshadow/sgetsgent.c b/lib/shadow/gshadow/sgetsgent.c index 8638ed5c49..c2f60cdeb8 100644 --- a/lib/shadow/gshadow/sgetsgent.c +++ b/lib/shadow/gshadow/sgetsgent.c @@ -14,7 +14,7 @@ #include #include -#include "prototypes.h" +#include "list.h" #include "shadow/gshadow/sgrp.h" #include "string/strcmp/streq.h" #include "string/strtok/stpsep.h" diff --git a/src/chgpasswd.c b/src/chgpasswd.c index 5c594d6219..88fc746d5d 100644 --- a/src/chgpasswd.c +++ b/src/chgpasswd.c @@ -22,6 +22,7 @@ #include "defines.h" #include "groupio.h" #include "io/fprintf.h" +#include "list.h" #include "nscd.h" #include "sssd.h" #include "prototypes.h" diff --git a/src/gpasswd.c b/src/gpasswd.c index 3e68632a3f..272ae8eaa0 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -28,6 +28,7 @@ #include "exitcodes.h" #include "groupio.h" #include "io/fprintf.h" +#include "list.h" #include "nscd.h" #include "prototypes.h" #ifdef SHADOWGRP diff --git a/src/groupadd.c b/src/groupadd.c index 483d282283..68a2724ca5 100644 --- a/src/groupadd.c +++ b/src/groupadd.c @@ -26,6 +26,7 @@ #include "groupio.h" #include "io/fprintf.h" #include "io/syslog.h" +#include "list.h" #include "nscd.h" #include "sssd.h" #include "prototypes.h" diff --git a/src/groupmod.c b/src/groupmod.c index f847c9939b..b177cbf002 100644 --- a/src/groupmod.c +++ b/src/groupmod.c @@ -27,6 +27,7 @@ #include "defines.h" #include "groupio.h" #include "io/fprintf.h" +#include "list.h" #include "nscd.h" #include "prototypes.h" #include "pwio.h" diff --git a/src/newgrp.c b/src/newgrp.c index 69ee7c5611..e1fc8ad3a4 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -25,6 +25,7 @@ #include "exitcodes.h" #include "getdef.h" #include "io/fprintf.h" +#include "list.h" #include "prototypes.h" #include "search/l/lfind.h" #include "search/l/lsearch.h" diff --git a/src/su.c b/src/su.c index cc74ab3a74..56a3379e94 100644 --- a/src/su.c +++ b/src/su.c @@ -54,6 +54,7 @@ #include "exitcodes.h" #include "getdef.h" #include "io/fprintf.h" +#include "list.h" #ifdef USE_PAM #include "pam_defs.h" #endif /* USE_PAM */ diff --git a/src/suauth.c b/src/suauth.c index 453f9a4dfa..246f4db198 100644 --- a/src/suauth.c +++ b/src/suauth.c @@ -20,6 +20,7 @@ #include "defines.h" #include "io/fgets/fgets.h" #include "io/syslog.h" +#include "list.h" #include "prototypes.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" diff --git a/src/useradd.c b/src/useradd.c index a56d737123..8159b424de 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -44,6 +44,7 @@ #include "io/fgets/fgets.h" #include "io/fprintf.h" #include "io/syslog.h" +#include "list.h" #include "nscd.h" #include "prototypes.h" #include "pwauth.h" diff --git a/src/userdel.c b/src/userdel.c index 20f28281c1..7261db3d65 100644 --- a/src/userdel.c +++ b/src/userdel.c @@ -26,6 +26,7 @@ #include "groupio.h" #include "io/fprintf.h" #include "io/syslog.h" +#include "list.h" #include "nscd.h" #include "sssd.h" #include "prototypes.h" diff --git a/src/usermod.c b/src/usermod.c index bd9dc82c64..73eb9b321c 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -40,6 +40,7 @@ #include "groupio.h" #include "io/fprintf.h" #include "io/syslog.h" +#include "list.h" #include "nscd.h" #include "prototypes.h" #include "pwauth.h"