That's the only file where it's called, and it's a delicate function.
Reduce the chances that other files call it.
Link: <https://github.com/shadow-maint/shadow/pull/908>
Suggested-by: Samanta Navarro <ferivoz@riseup.net>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
date_to_str.c \
defines.h \
encrypt.c \
- entry.c \
env.c \
exitcodes.h \
faillog.h \
+++ /dev/null
-/*
- * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
- * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
- * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
- * SPDX-FileCopyrightText: 2007 - 2008, Nicolas François
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <config.h>
-
-#ident "$Id$"
-
-#include <sys/types.h>
-#include <stdio.h>
-
-#include "alloc.h"
-#include "prototypes.h"
-#include "defines.h"
-#include <pwd.h>
-
-void pw_entry (const char *name, struct passwd *pwent)
-{
- struct passwd *passwd;
-
- struct spwd *spwd;
-
- if (!(passwd = getpwnam (name))) { /* local, no need for xgetpwnam */
- pwent->pw_name = NULL;
- return;
- } else {
- pwent->pw_name = xstrdup (passwd->pw_name);
- pwent->pw_uid = passwd->pw_uid;
- pwent->pw_gid = passwd->pw_gid;
- pwent->pw_gecos = xstrdup (passwd->pw_gecos);
- pwent->pw_dir = xstrdup (passwd->pw_dir);
- pwent->pw_shell = xstrdup (passwd->pw_shell);
-#if !defined(AUTOSHADOW)
- /* local, no need for xgetspnam */
- if ((spwd = getspnam (name))) {
- pwent->pw_passwd = xstrdup (spwd->sp_pwdp);
- return;
- }
-#endif
- pwent->pw_passwd = xstrdup (passwd->pw_passwd);
- }
-}
/* encrypt.c */
extern /*@exposed@*//*@null@*/char *pw_encrypt (const char *, const char *);
-/* entry.c */
-extern void pw_entry (const char *, struct passwd *);
-
/* env.c */
extern void addenv (const char *, /*@null@*/const char *);
extern void initenv (void);
lib/copydir.c
lib/date_to_str.c
lib/encrypt.c
-lib/entry.c
lib/env.c
lib/failure.c
lib/fields.c
#include <signal.h>
#include <stdio.h>
#include <sys/ioctl.h>
+#include <sys/types.h>
#include "agetpass.h"
+#include "alloc.h"
#include "attr.h"
#include "defines.h"
#include "getdef.h"
#include "shadowlog.h"
#include "string/strtcpy.h"
+
/*
* Global variables
*/
#define ALARM 60
#endif
-/* local function prototypes */
+
static void catch_signals (int);
+static void pw_entry(const char *name, struct passwd *pwent);
+
static void catch_signals (unused int sig)
{
return ((err == ENOENT) ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
}
+
+static void
+pw_entry(const char *name, struct passwd *pwent)
+{
+ struct passwd *passwd;
+
+ struct spwd *spwd;
+
+ if (!(passwd = getpwnam (name))) { /* local, no need for xgetpwnam */
+ pwent->pw_name = NULL;
+ return;
+ } else {
+ pwent->pw_name = xstrdup (passwd->pw_name);
+ pwent->pw_uid = passwd->pw_uid;
+ pwent->pw_gid = passwd->pw_gid;
+ pwent->pw_gecos = xstrdup (passwd->pw_gecos);
+ pwent->pw_dir = xstrdup (passwd->pw_dir);
+ pwent->pw_shell = xstrdup (passwd->pw_shell);
+#if !defined(AUTOSHADOW)
+ /* local, no need for xgetspnam */
+ if ((spwd = getspnam (name))) {
+ pwent->pw_passwd = xstrdup (spwd->sp_pwdp);
+ return;
+ }
+#endif
+ pwent->pw_passwd = xstrdup (passwd->pw_passwd);
+ }
+}