summaryrefslogtreecommitdiff
path: root/src/basic/user-util.h
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2018-03-21 15:26:02 +0100
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commitbe4e039d977bcee04fedcdb7a6a4b5c18cfaca38 (patch)
treead48f23d74388d38c734ea6b2d2fdcd1ecc163cb /src/basic/user-util.h
parent74d8433aa68dd73a1ea04363d4d4fd30d90c49a2 (diff)
user-util: add new wrappers for reading/writing {passwd,shadow,gshadow} database files (#8521)
The API povided by the glibc is too error-prone as one has to deal directly with errno in order to detect if errors occured. Suggested by Zbigniew.
Diffstat (limited to 'src/basic/user-util.h')
-rw-r--r--src/basic/user-util.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/basic/user-util.h b/src/basic/user-util.h
index 2bd1ee9a7..54581de15 100644
--- a/src/basic/user-util.h
+++ b/src/basic/user-util.h
@@ -20,6 +20,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+//#include <grp.h>
+//#include <gshadow.h>
+//#include <pwd.h>
+//#include <shadow.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
@@ -120,3 +124,14 @@ static inline bool valid_shell(const char *p) {
int maybe_setgroups(size_t size, const gid_t *list);
bool synthesize_nobody(void);
+
+int fgetpwent_sane(FILE *stream, struct passwd **pw);
+int fgetspent_sane(FILE *stream, struct spwd **sp);
+int fgetgrent_sane(FILE *stream, struct group **gr);
+int putpwent_sane(const struct passwd *pw, FILE *stream);
+int putspent_sane(const struct spwd *sp, FILE *stream);
+int putgrent_sane(const struct group *gr, FILE *stream);
+#ifdef ENABLE_GSHADOW
+int fgetsgent_sane(FILE *stream, struct sgrp **sg);
+int putsgent_sane(const struct sgrp *sg, FILE *stream);
+#endif