gshadow.h 5.2 KB

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