April 2024 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
001: /* Copyright (C) 1991,1992,1995-2001,2003,2004 Free Software Foundation, Inc. 002: This file is part of the GNU C Library. 003: 004: The GNU C Library is free software; you can redistribute it and/or 005: modify it under the terms of the GNU Lesser General Public 006: License as published by the Free Software Foundation; either 007: version 2.1 of the License, or (at your option) any later version. 008: 009: The GNU C Library is distributed in the hope that it will be useful, 010: but WITHOUT ANY WARRANTY; without even the implied warranty of 011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012: Lesser General Public License for more details. 013: 014: You should have received a copy of the GNU Lesser General Public 015: License along with the GNU C Library; if not, write to the Free 016: Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 017: 02111-1307 USA. */ 018: 019: /* 020: * POSIX Standard: 9.2.2 User Database Access <pwd.h> 021: */ 022: 023: #ifndef _PWD_H 024: #define _PWD_H 1 025: 026: #include <features.h> 027: 028: __BEGIN_DECLS 029: 030: #include <bits/types.h> 031: 032: #define __need_size_t 033: #include <stddef.h> 034: 035: #if defined __USE_XOPEN || defined __USE_XOPEN2K 036: /* The Single Unix specification says that some more types are 037: available here. */ 038: # ifndef __gid_t_defined 039: typedef __gid_t gid_t; 040: # define __gid_t_defined 041: # endif 042: 043: # ifndef __uid_t_defined 044: typedef __uid_t uid_t; 045: # define __uid_t_defined 046: # endif 047: #endif 048: 049: /* The passwd structure. */ 050: struct passwd 051: { 052: char *pw_name; /* Username. */ 053: char *pw_passwd; /* Password. */ 054: __uid_t pw_uid; /* User ID. */ 055: __gid_t pw_gid; /* Group ID. */ 056: char *pw_gecos; /* Real name. */ 057: char *pw_dir; /* Home directory. */ 058: char *pw_shell; /* Shell program. */ 059: }; 060: 061: 062: #if defined __USE_SVID || defined __USE_GNU 063: # define __need_FILE 064: # include <stdio.h> 065: #endif 066: 067: 068: #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED 069: /* Rewind the password-file stream. 070: 071: This function is a possible cancellation point and therefore not 072: marked with __THROW. */ 073: extern void setpwent (void); 074: 075: /* Close the password-file stream. 076: 077: This function is a possible cancellation point and therefore not 078: marked with __THROW. */ 079: extern void endpwent (void); 080: 081: /* Read an entry from the password-file stream, opening it if necessary. 082: 083: This function is a possible cancellation point and therefore not 084: marked with __THROW. */ 085: extern struct passwd *getpwent (void); 086: #endif 087: 088: #ifdef __USE_SVID 089: /* Read an entry from STREAM. 090: 091: This function is not part of POSIX and therefore no official 092: cancellation point. But due to similarity with an POSIX interface 093: or due to the implementation it is a cancellation point and 094: therefore not marked with __THROW. */ 095: extern struct passwd *fgetpwent (FILE *__stream); 096: 097: /* Write the given entry onto the given stream. 098: 099: This function is not part of POSIX and therefore no official 100: cancellation point. But due to similarity with an POSIX interface 101: or due to the implementation it is a cancellation point and 102: therefore not marked with __THROW. */ 103: extern int putpwent (__const struct passwd *__restrict __p, 104: FILE *__restrict __f); 105: #endif 106: 107: /* Search for an entry with a matching user ID. 108: 109: This function is a possible cancellation point and therefore not 110: marked with __THROW. */ 111: extern struct passwd *getpwuid (__uid_t __uid); 112: 113: /* Search for an entry with a matching username. 114: 115: This function is a possible cancellation point and therefore not 116: marked with __THROW. */ 117: extern struct passwd *getpwnam (__const char *__name); 118: 119: #if defined __USE_POSIX || defined __USE_MISC 120: 121: # ifdef __USE_MISC 122: /* Reasonable value for the buffer sized used in the reentrant 123: functions below. But better use `sysconf'. */ 124: # define NSS_BUFLEN_PASSWD 1024 125: # endif 126: 127: /* Reentrant versions of some of the functions above. 128: 129: PLEASE NOTE: the `getpwent_r' function is not (yet) standardized. 130: The interface may change in later versions of this library. But 131: the interface is designed following the principals used for the 132: other reentrant functions so the chances are good this is what the 133: POSIX people would choose. */ 134: 135: # if defined __USE_SVID || defined __USE_MISC 136: /* This function is not part of POSIX and therefore no official 137: cancellation point. But due to similarity with an POSIX interface 138: or due to the implementation it is a cancellation point and 139: therefore not marked with __THROW. */ 140: extern int getpwent_r (struct passwd *__restrict __resultbuf, 141: char *__restrict __buffer, size_t __buflen, 142: struct passwd **__restrict __result); 143: # endif 144: 145: extern int getpwuid_r (__uid_t __uid, 146: struct passwd *__restrict __resultbuf, 147: char *__restrict __buffer, size_t __buflen, 148: struct passwd **__restrict __result); 149: 150: extern int getpwnam_r (__const char *__restrict __name, 151: struct passwd *__restrict __resultbuf, 152: char *__restrict __buffer, size_t __buflen, 153: struct passwd **__restrict __result); 154: 155: 156: # ifdef __USE_SVID 157: /* Read an entry from STREAM. This function is not standardized and 158: probably never will. 159: 160: This function is not part of POSIX and therefore no official 161: cancellation point. But due to similarity with an POSIX interface 162: or due to the implementation it is a cancellation point and 163: therefore not marked with __THROW. */ 164: extern int fgetpwent_r (FILE *__restrict __stream, 165: struct passwd *__restrict __resultbuf, 166: char *__restrict __buffer, size_t __buflen, 167: struct passwd **__restrict __result); 168: # endif 169: 170: #endif /* POSIX or reentrant */ 171: 172: #ifdef __USE_GNU 173: /* Re-construct the password-file line for the given uid 174: in the given buffer. This knows the format that the caller 175: will expect, but this need not be the format of the password file. 176: 177: This function is not part of POSIX and therefore no official 178: cancellation point. But due to similarity with an POSIX interface 179: or due to the implementation it is a cancellation point and 180: therefore not marked with __THROW. */ 181: extern int getpw (__uid_t __uid, char *__buffer); 182: #endif 183: 184: __END_DECLS 185: 186: #endif /* pwd.h */ 187: