1/* Copyright (C) 2009-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18/* Declaration of types and functions for shadow group suite. */
19
20#ifndef _GSHADOW_H
21#define _GSHADOW_H 1
22
23#include <features.h>
24#include <paths.h>
25#include <bits/types/FILE.h>
26
27#define __need_size_t
28#include <stddef.h>
29
30/* Path to the user database files. */
31#define GSHADOW _PATH_GSHADOW
32
33
34__BEGIN_DECLS
35
36/* Structure of the group file. */
37struct sgrp
38 {
39 char *sg_namp; /* Group name. */
40 char *sg_passwd; /* Encrypted password. */
41 char **sg_adm; /* Group administrator list. */
42 char **sg_mem; /* Group member list. */
43 };
44
45
46/* Open database for reading.
47
48 This function is not part of POSIX and therefore no official
49 cancellation point. But due to similarity with an POSIX interface
50 or due to the implementation it is a cancellation point and
51 therefore not marked with __THROW. */
52extern void setsgent (void);
53
54/* Close database.
55
56 This function is not part of POSIX and therefore no official
57 cancellation point. But due to similarity with an POSIX interface
58 or due to the implementation it is a cancellation point and
59 therefore not marked with __THROW. */
60extern void endsgent (void);
61
62/* Get next entry from database, perhaps after opening the file.
63
64 This function is not part of POSIX and therefore no official
65 cancellation point. But due to similarity with an POSIX interface
66 or due to the implementation it is a cancellation point and
67 therefore not marked with __THROW. */
68extern struct sgrp *getsgent (void);
69
70/* Get shadow entry matching NAME.
71
72 This function is not part of POSIX and therefore no official
73 cancellation point. But due to similarity with an POSIX interface
74 or due to the implementation it is a cancellation point and
75 therefore not marked with __THROW. */
76extern struct sgrp *getsgnam (const char *__name);
77
78/* Read shadow entry from STRING.
79
80 This function is not part of POSIX and therefore no official
81 cancellation point. But due to similarity with an POSIX interface
82 or due to the implementation it is a cancellation point and
83 therefore not marked with __THROW. */
84extern struct sgrp *sgetsgent (const char *__string);
85
86/* Read next shadow entry from STREAM.
87
88 This function is not part of POSIX and therefore no official
89 cancellation point. But due to similarity with an POSIX interface
90 or due to the implementation it is a cancellation point and
91 therefore not marked with __THROW. */
92extern struct sgrp *fgetsgent (FILE *__stream);
93
94/* Write line containing shadow password entry to stream.
95
96 This function is not part of POSIX and therefore no official
97 cancellation point. But due to similarity with an POSIX interface
98 or due to the implementation it is a cancellation point and
99 therefore not marked with __THROW. */
100extern int putsgent (const struct sgrp *__g, FILE *__stream);
101
102
103#ifdef __USE_MISC
104/* Reentrant versions of some of the functions above.
105
106 These functions are not part of POSIX and therefore no official
107 cancellation point. But due to similarity with an POSIX interface
108 or due to the implementation they are cancellation points and
109 therefore not marked with __THROW. */
110extern int getsgent_r (struct sgrp *__result_buf, char *__buffer,
111 size_t __buflen, struct sgrp **__result);
112
113extern int getsgnam_r (const char *__name, struct sgrp *__result_buf,
114 char *__buffer, size_t __buflen,
115 struct sgrp **__result);
116
117extern int sgetsgent_r (const char *__string, struct sgrp *__result_buf,
118 char *__buffer, size_t __buflen,
119 struct sgrp **__result);
120
121extern int fgetsgent_r (FILE *__stream, struct sgrp *__result_buf,
122 char *__buffer, size_t __buflen,
123 struct sgrp **__result);
124#endif /* misc */
125
126__END_DECLS
127
128#endif /* gshadow.h */
129