netgroup.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Internal header for netgroup related functions.
  2. Copyright (C) 1996-2026 Free Software Foundation, Inc.
  3. 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.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _NETGROUP_H
  16. #define _NETGROUP_H 1
  17. #include <nsswitch.h>
  18. /* A netgroup can consist of names of other netgroups. We have to
  19. track which netgroups were read and which still have to be read. */
  20. struct name_list
  21. {
  22. struct name_list *next;
  23. char name[];
  24. };
  25. /* Dataset for iterating netgroups. */
  26. struct __netgrent
  27. {
  28. enum { triple_val, group_val } type;
  29. union
  30. {
  31. struct
  32. {
  33. const char *host;
  34. const char *user;
  35. const char *domain;
  36. }
  37. triple;
  38. const char *group;
  39. } val;
  40. /* Room for the data kept between the calls to the netgroup
  41. functions. We must avoid global variables. */
  42. char *data;
  43. size_t data_size;
  44. union
  45. {
  46. char *cursor;
  47. unsigned long int position;
  48. };
  49. int first;
  50. struct name_list *known_groups;
  51. struct name_list *needed_groups;
  52. /* This handle for the NSS data base is shared between all
  53. set/get/endXXXent functions. */
  54. struct nss_action *nip;
  55. };
  56. /* The internal netgroup handling functions might be called from outside. */
  57. extern int __internal_setnetgrent (const char *group,
  58. struct __netgrent *datap);
  59. libc_hidden_proto (__internal_setnetgrent)
  60. extern void __internal_endnetgrent (struct __netgrent *datap);
  61. libc_hidden_proto (__internal_endnetgrent)
  62. extern int __internal_getnetgrent_r (char **hostp, char **userp,
  63. char **domainp, struct __netgrent *datap,
  64. char *buffer, size_t buflen, int *errnop);
  65. libc_hidden_proto (__internal_getnetgrent_r)
  66. #endif /* netgroup.h */