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