From: Alejandro Colomar Date: Mon, 24 Feb 2025 22:22:02 +0000 (+0100) Subject: lib/, configure.ac, po/: Remove dead file X-Git-Tag: 4.18.0-rc1~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=844e03a68f1e6050f19e0f72b3edf356b4cf82b7;p=thirdparty%2Fshadow.git lib/, configure.ac, po/: Remove dead file 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: Signed-off-by: Alejandro Colomar --- diff --git a/configure.ac b/configure.ac index 571e20da2..b079429a1 100644 --- a/configure.ac +++ b/configure.ac @@ -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 \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 27efaa119..1fb2827db 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -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 index cc1edc96c..000000000 --- a/lib/shadow.c +++ /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 - -/* Newer versions of Linux libc already have shadow support. */ -#ifndef HAVE_GETSPNAM - -#ident "$Id$" - -#include -#include -#include - -#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 diff --git a/po/POTFILES.in b/po/POTFILES.in index 3aff87b2d..a925b2350 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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