| Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{grp} --- | 
| Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 2 |          The group database} | 
 | 3 |  | 
| Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 4 | \declaremodule{builtin}{grp} | 
| Fred Drake | a54a887 | 1999-03-02 17:03:42 +0000 | [diff] [blame] | 5 |   \platform{Unix} | 
| Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 6 | \modulesynopsis{The group database (\function{getgrnam()} and friends).} | 
 | 7 |  | 
| Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 8 |  | 
| Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 9 | This module provides access to the \UNIX{} group database. | 
 | 10 | It is available on all \UNIX{} versions. | 
 | 11 |  | 
 | 12 | Group database entries are reported as 4-tuples containing the | 
| Fred Drake | a5aefba | 1998-08-14 17:05:17 +0000 | [diff] [blame] | 13 | following items from the group database (see \code{<grp.h>}), in order: | 
| Fred Drake | 38e5d27 | 2000-04-03 20:13:55 +0000 | [diff] [blame] | 14 |  | 
 | 15 | \begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Meaning} | 
 | 16 |   \lineiii{0}{gr_name}{the name of the group} | 
 | 17 |   \lineiii{1}{gr_passwd}{the (encrypted) group password; often empty} | 
 | 18 |   \lineiii{2}{gr_gid}{the numerical group ID} | 
 | 19 |   \lineiii{3}{gr_mem}{all the group member's  user  names} | 
 | 20 | \end{tableiii} | 
 | 21 |  | 
| Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 22 | The gid is an integer, name and password are strings, and the member | 
 | 23 | list is a list of strings. | 
 | 24 | (Note that most users are not explicitly listed as members of the | 
| Guido van Rossum | 470be14 | 1995-03-17 16:07:09 +0000 | [diff] [blame] | 25 | group they are in according to the password database.) | 
| Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 26 | \exception{KeyError} is raised if the entry asked for cannot be found. | 
| Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 27 |  | 
 | 28 | It defines the following items: | 
 | 29 |  | 
| Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 30 | \begin{funcdesc}{getgrgid}{gid} | 
 | 31 | Return the group database entry for the given numeric group ID. | 
 | 32 | \end{funcdesc} | 
 | 33 |  | 
 | 34 | \begin{funcdesc}{getgrnam}{name} | 
 | 35 | Return the group database entry for the given group name. | 
 | 36 | \end{funcdesc} | 
 | 37 |  | 
 | 38 | \begin{funcdesc}{getgrall}{} | 
| Guido van Rossum | 6bb1adc | 1995-03-13 10:03:32 +0000 | [diff] [blame] | 39 | Return a list of all available group entries, in arbitrary order. | 
| Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 40 | \end{funcdesc} | 
| Fred Drake | 38e5d27 | 2000-04-03 20:13:55 +0000 | [diff] [blame] | 41 |  | 
 | 42 |  | 
 | 43 | \begin{seealso} | 
 | 44 |   \seemodule{pwd}{An interface to the user database, similar to this.} | 
 | 45 | \end{seealso} |