| 1 | /* Copyright (C) 2009-2022 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. */ |
| 37 | struct 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. */ |
| 52 | extern 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. */ |
| 60 | extern 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. */ |
| 68 | extern 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. */ |
| 76 | extern 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. */ |
| 84 | extern 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. */ |
| 92 | extern 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. */ |
| 100 | extern 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. */ |
| 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)); |
| 113 | |
| 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)); |
| 118 | |
| 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)); |
| 123 | |
| 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 */ |
| 129 | |
| 130 | __END_DECLS |
| 131 | |
| 132 | #endif /* gshadow.h */ |
| 133 | |