1/* Copyright (C) 2009 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, write to the Free
16   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17   02111-1307 USA.  */
18
19/* Declaration of types and functions for shadow group suite.  */
20
21#ifndef _GSHADOW_H
22#define _GSHADOW_H	1
23
24#include <features.h>
25
26#include <paths.h>
27
28#define	__need_FILE
29#include <stdio.h>
30#define __need_size_t
31#include <stddef.h>
32
33/* Path to the user database files.  */
34#define	GSHADOW _PATH_GSHADOW
35
36
37__BEGIN_DECLS
38
39/* Structure of the group file.  */
40struct sgrp
41  {
42    char *sg_namp;		/* Group name.  */
43    char *sg_passwd;		/* Encrypted password.  */
44    char **sg_adm;		/* Group administrator list.  */
45    char **sg_mem;		/* Group member list.  */
46  };
47
48
49/* Open database for reading.
50
51   This function is not part of POSIX and therefore no official
52   cancellation point.  But due to similarity with an POSIX interface
53   or due to the implementation it is a cancellation point and
54   therefore not marked with __THROW.  */
55extern void setsgent (void);
56
57/* Close database.
58
59   This function is not part of POSIX and therefore no official
60   cancellation point.  But due to similarity with an POSIX interface
61   or due to the implementation it is a cancellation point and
62   therefore not marked with __THROW.  */
63extern void endsgent (void);
64
65/* Get next entry from database, perhaps after opening the file.
66
67   This function is not part of POSIX and therefore no official
68   cancellation point.  But due to similarity with an POSIX interface
69   or due to the implementation it is a cancellation point and
70   therefore not marked with __THROW.  */
71extern struct sgrp *getsgent (void);
72
73/* Get shadow entry matching NAME.
74
75   This function is not part of POSIX and therefore no official
76   cancellation point.  But due to similarity with an POSIX interface
77   or due to the implementation it is a cancellation point and
78   therefore not marked with __THROW.  */
79extern struct sgrp *getsgnam (__const char *__name);
80
81/* Read shadow entry from STRING.
82
83   This function is not part of POSIX and therefore no official
84   cancellation point.  But due to similarity with an POSIX interface
85   or due to the implementation it is a cancellation point and
86   therefore not marked with __THROW.  */
87extern struct sgrp *sgetsgent (__const char *__string);
88
89/* Read next shadow entry from STREAM.
90
91   This function is not part of POSIX and therefore no official
92   cancellation point.  But due to similarity with an POSIX interface
93   or due to the implementation it is a cancellation point and
94   therefore not marked with __THROW.  */
95extern struct sgrp *fgetsgent (FILE *__stream);
96
97/* Write line containing shadow password entry to stream.
98
99   This function is not part of POSIX and therefore no official
100   cancellation point.  But due to similarity with an POSIX interface
101   or due to the implementation it is a cancellation point and
102   therefore not marked with __THROW.  */
103extern int putsgent (__const struct sgrp *__g, FILE *__stream);
104
105
106#ifdef __USE_MISC
107/* Reentrant versions of some of the functions above.
108
109   These functions are not part of POSIX and therefore no official
110   cancellation point.  But due to similarity with an POSIX interface
111   or due to the implementation they are cancellation points and
112   therefore not marked with __THROW.  */
113extern int getsgent_r (struct sgrp *__result_buf, char *__buffer,
114		       size_t __buflen, struct sgrp **__result);
115
116extern int getsgnam_r (__const char *__name, struct sgrp *__result_buf,
117		       char *__buffer, size_t __buflen,
118		       struct sgrp **__result);
119
120extern int sgetsgent_r (__const char *__string, struct sgrp *__result_buf,
121			char *__buffer, size_t __buflen,
122			struct sgrp **__result);
123
124extern int fgetsgent_r (FILE *__stream, struct sgrp *__result_buf,
125			char *__buffer, size_t __buflen,
126			struct sgrp **__result);
127#endif	/* misc */
128
129__END_DECLS
130
131#endif /* gshadow.h */
132