string: Improve fortify with clang
[glibc.git] / nss / gshadow.h
blobdcc5ea48463eef9afd831097461ce710d1538fee
1 /* Copyright (C) 2009-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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/>. */
18 /* Declaration of types and functions for shadow group suite. */
20 #ifndef _GSHADOW_H
21 #define _GSHADOW_H 1
23 #include <features.h>
24 #include <paths.h>
25 #include <bits/types/FILE.h>
27 #define __need_size_t
28 #include <stddef.h>
30 /* Path to the user database files. */
31 #define GSHADOW _PATH_GSHADOW
34 __BEGIN_DECLS
36 /* Structure of the group file. */
37 struct sgrp
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. */
46 /* Open database for reading.
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. */
52 extern void setsgent (void);
54 /* Close database.
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. */
60 extern void endsgent (void);
62 /* Get next entry from database, perhaps after opening the file.
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. */
68 extern struct sgrp *getsgent (void);
70 /* Get shadow entry matching NAME.
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. */
76 extern struct sgrp *getsgnam (const char *__name);
78 /* Read shadow entry from STRING.
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. */
84 extern struct sgrp *sgetsgent (const char *__string);
86 /* Read next shadow entry from STREAM.
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. */
92 extern struct sgrp *fgetsgent (FILE *__stream);
94 /* Write line containing shadow password entry to stream.
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. */
100 extern int putsgent (const struct sgrp *__g, FILE *__stream);
103 #ifdef __USE_MISC
104 /* Reentrant versions of some of the functions above.
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. */
110 extern int getsgent_r (struct sgrp *__result_buf, char *__buffer,
111 size_t __buflen, struct sgrp **__result)
112 __attr_access ((__write_only__, 2, 3));
114 extern int getsgnam_r (const char *__name, struct sgrp *__result_buf,
115 char *__buffer, size_t __buflen,
116 struct sgrp **__result)
117 __attr_access ((__write_only__, 3, 4));
119 extern int sgetsgent_r (const char *__string, struct sgrp *__result_buf,
120 char *__buffer, size_t __buflen,
121 struct sgrp **__result)
122 __attr_access ((__write_only__, 3, 4));
124 extern int fgetsgent_r (FILE *__stream, struct sgrp *__result_buf,
125 char *__buffer, size_t __buflen,
126 struct sgrp **__result)
127 __attr_access ((__write_only__, 3, 4));
128 #endif /* misc */
130 __END_DECLS
132 #endif /* gshadow.h */