]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/, configure.ac, po/: Remove dead file <lib/shadow.c>
authorAlejandro Colomar <alx@kernel.org>
Mon, 24 Feb 2025 22:22:02 +0000 (23:22 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Tue, 27 May 2025 07:42:39 +0000 (09:42 +0200)
We didn't even have prototypes for these APIs since long ago, when the
prototypes were removed, but misteriously the implementations remained.

Both glibc and musl provide getspnam(3), so this file was effectively
being ignored by the compiler.  Just remove it.

Also remove the check for getspnam, which isn't used elsewhere.

Fixes: 0ee095abd8db (2007-10-07; "[svn-upgrade] Integrating new upstream version, shadow (4.0.7)")
Closes: <https://github.com/shadow-maint/shadow/issues/1228>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
configure.ac
lib/Makefile.am
lib/shadow.c [deleted file]
po/POTFILES.in

index 571e20da216d67b480e6c56213723ff248115418..b079429a19c5c3fa889ae7166e1c1d749e46582f 100644 (file)
@@ -40,7 +40,7 @@ dnl shadow now uses the libc's shadow implementation
 AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
 
 AC_CHECK_FUNCS(arc4random_buf futimes \
-       getentropy getrandom getspnam getusershell \
+       getentropy getrandom getusershell \
        lckpwdf lutimes \
        updwtmpx innetgr \
        getspnam_r \
index 27efaa11903033d1f3ba1ec1a542b026211e647a..1fb2827db7c481c61d427aa557423667dae3ffc7 100644 (file)
@@ -172,7 +172,6 @@ libshadow_la_SOURCES = \
        sgetspent.c \
        sgroupio.c \
        sgroupio.h\
-       shadow.c \
        shadow/grp/agetgroups.c \
        shadow/grp/agetgroups.h \
        shadowio.c \
diff --git a/lib/shadow.c b/lib/shadow.c
deleted file mode 100644 (file)
index cc1edc9..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
- * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
- * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
- * SPDX-FileCopyrightText: 2009       , Nicolas François
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <config.h>
-
-/* Newer versions of Linux libc already have shadow support.  */
-#ifndef HAVE_GETSPNAM
-
-#ident "$Id$"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "atoi/a2i/a2s.h"
-#include "atoi/str2i/str2u.h"
-#include "defines.h"
-#include "prototypes.h"
-#include "string/strcmp/streq.h"
-#include "string/strtok/stpsep.h"
-
-
-static FILE *shadow;
-
-#define        FIELDS  9
-#define        OFIELDS 5
-
-
-/*
- * setspent - initialize access to shadow text and DBM files
- */
-
-void setspent (void)
-{
-       if (NULL != shadow) {
-               rewind (shadow);
-       }else {
-               shadow = fopen (SHADOW_FILE, "re");
-       }
-}
-
-/*
- * endspent - terminate access to shadow text and DBM files
- */
-
-void endspent (void)
-{
-       if (NULL != shadow) {
-               (void) fclose (shadow);
-       }
-
-       shadow = NULL;
-}
-
-/*
- * fgetspent - get an entry from a /etc/shadow formatted stream
- */
-
-struct spwd *fgetspent (FILE * fp)
-{
-       char  buf[BUFSIZ];
-
-       if (NULL == fp) {
-               return (0);
-       }
-
-       if (fgets (buf, sizeof buf, fp) != NULL)
-       {
-               stpsep(buf, "\n");
-               return sgetspent(buf);
-       }
-       return 0;
-}
-
-/*
- * getspent - get a (struct spwd *) from the current shadow file
- */
-
-struct spwd *getspent (void)
-{
-       if (NULL == shadow) {
-               setspent ();
-       }
-       return (fgetspent (shadow));
-}
-
-/*
- * getspnam - get a shadow entry by name
- */
-
-struct spwd *getspnam (const char *name)
-{
-       struct spwd *sp;
-
-       setspent ();
-
-       while ((sp = getspent ()) != NULL) {
-               if (streq(name, sp->sp_namp)) {
-                       break;
-               }
-       }
-       endspent ();
-       return (sp);
-}
-#else
-extern int ISO_C_forbids_an_empty_translation_unit;
-#endif
index 3aff87b2d48efd4951ba78428ea8e83252ab8b77..a925b2350b05daf95a048f580559451c9cf8bced 100644 (file)
@@ -61,7 +61,6 @@ lib/sgetgrent.c
 lib/sgetpwent.c
 lib/sgetspent.c
 lib/sgroupio.c
-lib/shadow.c
 lib/shadowio.c
 lib/shadowmem.c
 lib/shell.c