From 996b197a80f00acd9e48418cd032f9aa1ef81a89 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sun, 10 Nov 2024 23:31:23 +0100 Subject: [PATCH] lib/shadow/, lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/ Signed-off-by: Alejandro Colomar --- lib/Makefile.am | 3 ++- lib/prototypes.h | 3 --- lib/pwio.c | 2 ++ lib/{ => shadow/passwd}/sgetpwent.c | 19 +++++++++---------- lib/shadow/passwd/sgetpwent.h | 17 +++++++++++++++++ po/POTFILES.in | 2 +- 6 files changed, 31 insertions(+), 15 deletions(-) rename lib/{ => shadow/passwd}/sgetpwent.c (81%) create mode 100644 lib/shadow/passwd/sgetpwent.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 25c915b50..25f084665 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -166,7 +166,6 @@ libshadow_la_SOURCES = \ semanage.c \ setugid.c \ setupenv.c \ - sgetpwent.c \ sgetspent.c \ sgroupio.c \ sgroupio.h \ @@ -192,6 +191,8 @@ libshadow_la_SOURCES = \ shadow/gshadow/sgetsgent.h \ shadow/gshadow/sgrp.c \ shadow/gshadow/sgrp.h \ + shadow/passwd/sgetpwent.c \ + shadow/passwd/sgetpwent.h \ shadowio.c \ shadowio.h \ shadowlog.c \ diff --git a/lib/prototypes.h b/lib/prototypes.h index 2d20395ed..92a2f759f 100644 --- a/lib/prototypes.h +++ b/lib/prototypes.h @@ -397,9 +397,6 @@ extern void setup (struct passwd *); /* setupenv.c */ extern void setup_env (struct passwd *); -/* sgetpwent.c */ -extern struct passwd *sgetpwent (const char *buf); - /* sgetspent.c */ #ifndef HAVE_SGETSPENT extern struct spwd *sgetspent (const char *string); diff --git a/lib/pwio.c b/lib/pwio.c index 0674d7186..463f8378c 100644 --- a/lib/pwio.c +++ b/lib/pwio.c @@ -18,6 +18,8 @@ #include "fields.h" #include "prototypes.h" #include "pwio.h" +#include "shadow/passwd/sgetpwent.h" + static /*@null@*/ /*@only@*/void *passwd_dup (const void *ent) { diff --git a/lib/sgetpwent.c b/lib/shadow/passwd/sgetpwent.c similarity index 81% rename from lib/sgetpwent.c rename to lib/shadow/passwd/sgetpwent.c index 2e5bbbd1c..ddea1384b 100644 --- a/lib/sgetpwent.c +++ b/lib/shadow/passwd/sgetpwent.c @@ -1,15 +1,14 @@ -/* - * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh - * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz - * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko - * SPDX-FileCopyrightText: 2008 , Nicolas François - * - * SPDX-License-Identifier: BSD-3-Clause - */ +// SPDX-FileCopyrightText: 1989-1994, Julianne Frances Haugh +// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz +// SPDX-FileCopyrightText: 2003-2005, Tomasz Kłoczko +// SPDX-FileCopyrightText: 2008, Nicolas François +// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + #include "config.h" -#ident "$Id$" +#include "shadow/passwd/sgetpwent.h" #include #include @@ -38,6 +37,7 @@ * performance reasons. I am going to come up with some conditional * compilation glarp to improve on this in the future. */ +// from-string get pasword entry struct passwd * sgetpwent(const char *s) { @@ -85,4 +85,3 @@ sgetpwent(const char *s) return &pwent; } - diff --git a/lib/shadow/passwd/sgetpwent.h b/lib/shadow/passwd/sgetpwent.h new file mode 100644 index 000000000..7b82a5ce8 --- /dev/null +++ b/lib/shadow/passwd/sgetpwent.h @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#ifndef SHADOW_INCLUDE_LIB_SHADOW_PASSWD_SGETPWENT_H_ +#define SHADOW_INCLUDE_LIB_SHADOW_PASSWD_SGETPWENT_H_ + + +#include "config.h" + +#include + + +struct passwd *sgetpwent(const char *s); + + +#endif // include guard diff --git a/po/POTFILES.in b/po/POTFILES.in index af5cfa5df..1da1ae19b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -56,10 +56,10 @@ lib/selinux.c lib/semanage.c lib/setugid.c lib/setupenv.c -lib/sgetpwent.c lib/sgetspent.c lib/sgroupio.c lib/shadow/group/sgetgrent.c +lib/shadow/passwd/sgetpwent.c lib/shadowio.c lib/shadowmem.c lib/shell.c -- 2.47.3