shadow_.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* vi: set sw=4 ts=4: */
  2. /* Copyright (C) 1996, 1997, 1998, 1999 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, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. /* Declaration of types and functions for shadow password suite */
  17. #ifndef BB_SHADOW_H
  18. #define BB_SHADOW_H 1
  19. #if __GNUC_PREREQ(4,1)
  20. # pragma GCC visibility push(hidden)
  21. #endif
  22. /* This file is #included after #include <shadow.h>
  23. * We will use libc-defined structures, but will #define function names
  24. * so that function calls are directed to bb_internal_XXX replacements
  25. */
  26. /* Paths to the user database files */
  27. #ifndef _PATH_SHADOW
  28. #define _PATH_SHADOW "/etc/shadow"
  29. #endif
  30. #define setspent bb_internal_setspent
  31. #define endspent bb_internal_endspent
  32. #define getspent bb_internal_getspent
  33. #define getspnam bb_internal_getspnam
  34. #define sgetspent bb_internal_sgetspent
  35. #define fgetspent bb_internal_fgetspent
  36. #define putspent bb_internal_putspent
  37. #define getspent_r bb_internal_getspent_r
  38. #define getspnam_r bb_internal_getspnam_r
  39. #define sgetspent_r bb_internal_sgetspent_r
  40. #define fgetspent_r bb_internal_fgetspent_r
  41. #define lckpwdf bb_internal_lckpwdf
  42. #define ulckpwdf bb_internal_ulckpwdf
  43. /* All function names below should be remapped by #defines above
  44. * in order to not collide with libc names. */
  45. /* Open database for reading */
  46. extern void setspent(void);
  47. /* Close database */
  48. extern void endspent(void);
  49. /* Get next entry from database, perhaps after opening the file */
  50. extern struct spwd *getspent(void);
  51. /* Get shadow entry matching NAME */
  52. extern struct spwd *getspnam(const char *__name);
  53. /* Read shadow entry from STRING */
  54. extern struct spwd *sgetspent(const char *__string);
  55. /* Read next shadow entry from STREAM */
  56. extern struct spwd *fgetspent(FILE *__stream);
  57. /* Write line containing shadow password entry to stream */
  58. extern int putspent(const struct spwd *__p, FILE *__stream);
  59. /* Reentrant versions of some of the functions above */
  60. extern int getspent_r(struct spwd *__result_buf, char *__buffer,
  61. size_t __buflen, struct spwd **__result);
  62. extern int getspnam_r(const char *__name, struct spwd *__result_buf,
  63. char *__buffer, size_t __buflen,
  64. struct spwd **__result);
  65. extern int sgetspent_r(const char *__string, struct spwd *__result_buf,
  66. char *__buffer, size_t __buflen,
  67. struct spwd **__result);
  68. extern int fgetspent_r(FILE *__stream, struct spwd *__result_buf,
  69. char *__buffer, size_t __buflen,
  70. struct spwd **__result);
  71. /* Protect password file against multi writers */
  72. extern int lckpwdf(void);
  73. /* Unlock password file */
  74. extern int ulckpwdf(void);
  75. #if __GNUC_PREREQ(4,1)
  76. # pragma GCC visibility pop
  77. #endif
  78. #endif /* shadow.h */