Skip to content

Commit

Permalink
lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • Loading branch information
alejandro-colomar committed Feb 16, 2025
1 parent d52ffeb commit dd9501d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
3 changes: 2 additions & 1 deletion lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ libshadow_la_SOURCES = \
semanage.c \
setugid.c \
setupenv.c \
sgetpwent.c \
sgetspent.c \
sgroupio.c \
sgroupio.h \
Expand All @@ -193,6 +192,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 \
Expand Down
3 changes: 0 additions & 3 deletions lib/prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,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);
Expand Down
2 changes: 2 additions & 0 deletions lib/pwio.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <stdio.h>
#include "commonio.h"
#include "pwio.h"
#include "shadow/passwd/sgetpwent.h"


static /*@null@*/ /*@only@*/void *passwd_dup (const void *ent)
{
Expand Down
20 changes: 10 additions & 10 deletions lib/sgetpwent.c → lib/shadow/passwd/sgetpwent.c
Original file line number Diff line number Diff line change
@@ -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 <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause


#include <config.h>

#ident "$Id$"
#include "shadow/passwd/sgetpwent.h"

#include <sys/types.h>
#include <stdio.h>
Expand All @@ -25,6 +24,7 @@

#define NFIELDS 7


/*
* sgetpwent - convert a string to a (struct passwd)
*
Expand All @@ -37,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 *buf)
{
Expand Down Expand Up @@ -105,4 +106,3 @@ sgetpwent(const char *buf)

return &pwent;
}

17 changes: 17 additions & 0 deletions lib/shadow/passwd/sgetpwent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
// 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 <pwd.h>


struct passwd *sgetpwent(const char *s);


#endif // include guard
2 changes: 1 addition & 1 deletion po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ lib/selinux.c
lib/semanage.c
lib/setugid.c
lib/setupenv.c
lib/sgetpwent.c
lib/sgetspent.c
lib/sgroupio.c
lib/shadow.c
lib/shadow/group/sgetgrent.c
lib/shadow/passwd/sgetpwent.c
lib/shadowio.c
lib/shadowmem.c
lib/shell.c
Expand Down

0 comments on commit dd9501d

Please sign in to comment.