shadow/gshadow/gshadow.h \
shadow/gshadow/putsgent.c \
shadow/gshadow/putsgent.h \
+ shadow/gshadow/setsgent.c \
+ shadow/gshadow/setsgent.h \
shadowio.c \
shadowio.h \
shadowlog.c \
#include "defines.h"
#include "prototypes.h"
#include "shadow/gshadow/gshadow.h"
+#include "shadow/gshadow/setsgent.h"
#include "string/strcmp/streq.h"
#include "string/strtok/stpsep.h"
#include "string/strtok/strsep2arr.h"
return l;
}
-void setsgent (void)
-{
- if (NULL != gshadow) {
- rewind(gshadow);
- } else {
- gshadow = fopen(_PATH_GSHADOW, "re");
- }
-}
-
/*@observer@*//*@null@*/struct sgrp *
sgetsgent(const char *s)
{
/*@observer@*//*@null@*/struct sgrp *getsgnam (const char *);
/*@observer@*//*@null@*/struct sgrp *sgetsgent (const char *);
/*@observer@*//*@null@*/struct sgrp *fgetsgent (/*@null@*/FILE *);
-void setsgent (void);
#define GSHADOW "/etc/gshadow"
--- /dev/null
+// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2005, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008-2009, Nicolas François
+// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include "config.h"
+
+#include "shadow/gshadow/setsgent.h"
+
+#include <paths.h>
+#include <stddef.h>
+#include <stdio.h>
+
+#include "shadow/gshadow/gshadow.h"
+
+
+#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
+// set-resources-for-working-with shadow group entries
+void
+setsgent(void)
+{
+ if (NULL != gshadow) {
+ rewind(gshadow);
+ } else {
+ gshadow = fopen(_PATH_GSHADOW, "re");
+ }
+}
+#endif
--- /dev/null
+// SPDX-FileCopyrightText: 1988-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1997, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2005, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_SETSGENT_H_
+#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_SETSGENT_H_
+
+
+#include "config.h"
+
+
+#if __has_include(<gshadow.h>)
+# include <gshadow.h>
+#else
+void setsgent(void);
+#endif
+
+
+#endif // include guard