aboutsummaryrefslogtreecommitdiff
path: root/include/grp_.h
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-07-15 12:53:49 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-07-15 12:53:49 +0000
commit48fb8b8392bda5c2a944489eb35572e5a9942bfa (patch)
tree863532a14dd40a1009cee3dac1dfa7fdd8bea653 /include/grp_.h
parent8d067d680796f811a61decb8bbd6f63bf05c1f41 (diff)
downloadbusybox-w32-48fb8b8392bda5c2a944489eb35572e5a9942bfa.tar.gz
busybox-w32-48fb8b8392bda5c2a944489eb35572e5a9942bfa.tar.bz2
busybox-w32-48fb8b8392bda5c2a944489eb35572e5a9942bfa.zip
Replace the old and somewhat buggy pwd_grp stuff with the shiny
new stuff mjn3 wrote for uClibc git-svn-id: svn://busybox.net/trunk/busybox@8956 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'include/grp_.h')
-rw-r--r--include/grp_.h113
1 files changed, 95 insertions, 18 deletions
diff --git a/include/grp_.h b/include/grp_.h
index 7cb0d4af6..b212b0b4a 100644
--- a/include/grp_.h
+++ b/include/grp_.h
@@ -1,39 +1,116 @@
1#ifndef __CONFIG_GRP_H 1/* Copyright (C) 1991,92,95,96,97,98,99,2000,01 Free Software Foundation, Inc.
2#define __CONFIG_GRP_H 2 This file is part of the GNU C Library.
3
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
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
18
19/*
20 * POSIX Standard: 9.2.1 Group Database Access <grp.h>
21 */
22
3 23
4#if !defined CONFIG_USE_BB_PWD_GRP 24#if !defined CONFIG_USE_BB_PWD_GRP
5#include <grp.h> 25#include <grp.h>
6 26
7#else 27#else
8 28
29#ifndef _GRP_H
30#define _GRP_H 1
31
32
9#include <sys/types.h> 33#include <sys/types.h>
10#include <features.h> 34#include <features.h>
11#include <stdio.h> 35#include <stdio.h>
12 36
13 37
14/* The group structure */ 38/* The group structure. */
15struct group 39struct group
16{ 40{
17 char *gr_name; /* Group name. */ 41 char *gr_name; /* Group name. */
18 char *gr_passwd; /* Password. */ 42 char *gr_passwd; /* Password. */
19 gid_t gr_gid; /* Group ID. */ 43 gid_t gr_gid; /* Group ID. */
20 char **gr_mem; /* Member list. */ 44 char **gr_mem; /* Member list. */
21}; 45};
22 46
23extern void setgrent __P ((void));
24extern void endgrent __P ((void));
25extern struct group * getgrent __P ((void));
26 47
27extern struct group * getgrgid __P ((__const gid_t gid)); 48/* Rewind the group-file stream. */
28extern struct group * getgrnam __P ((__const char * name)); 49extern void setgrent (void);
50
51/* Close the group-file stream. */
52extern void endgrent (void);
53
54/* Read an entry from the group-file stream, opening it if necessary. */
55extern struct group *getgrent (void);
56
57/* Read a group entry from STREAM. */
58extern struct group *fgetgrent (FILE *__stream);
59
60/* Write the given entry onto the given stream. */
61extern int putgrent (__const struct group *__restrict __p,
62 FILE *__restrict __f);
63
64/* Search for an entry with a matching group ID. */
65extern struct group *getgrgid (gid_t __gid);
66
67/* Search for an entry with a matching group name. */
68extern struct group *getgrnam (__const char *__name);
69
70/* Reentrant versions of some of the functions above.
71
72 PLEASE NOTE: the `getgrent_r' function is not (yet) standardized.
73 The interface may change in later versions of this library. But
74 the interface is designed following the principals used for the
75 other reentrant functions so the chances are good this is what the
76 POSIX people would choose. */
77
78extern int getgrent_r (struct group *__restrict __resultbuf,
79 char *__restrict __buffer, size_t __buflen,
80 struct group **__restrict __result);
81
82/* Search for an entry with a matching group ID. */
83extern int getgrgid_r (gid_t __gid, struct group *__restrict __resultbuf,
84 char *__restrict __buffer, size_t __buflen,
85 struct group **__restrict __result);
86
87/* Search for an entry with a matching group name. */
88extern int getgrnam_r (__const char *__restrict __name,
89 struct group *__restrict __resultbuf,
90 char *__restrict __buffer, size_t __buflen,
91 struct group **__restrict __result);
92
93/* Read a group entry from STREAM. This function is not standardized
94 an probably never will. */
95extern int fgetgrent_r (FILE *__restrict __stream,
96 struct group *__restrict __resultbuf,
97 char *__restrict __buffer, size_t __buflen,
98 struct group **__restrict __result);
29 99
30extern struct group * fgetgrent __P ((FILE * file)); 100/* Set the group set for the current user to GROUPS (N of them). */
101extern int setgroups (size_t __n, __const gid_t *__groups);
31 102
32extern int setgroups __P ((size_t n, __const gid_t * groups)); 103/* Store at most *NGROUPS members of the group set for USER into
33extern int initgroups __P ((__const char * user, gid_t gid)); 104 *GROUPS. Also include GROUP. The actual number of groups found is
105 returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */
106extern int getgrouplist (__const char *__user, gid_t __group,
107 gid_t *__groups, int *__ngroups);
34 108
35extern struct group * bb_getgrent __P ((int grp_fd)); 109/* Initialize the group set for the current user
110 by reading the group database and using all groups
111 of which USER is a member. Also include GROUP. */
112extern int initgroups (__const char *__user, gid_t __group);
36 113
37#endif /* USE_SYSTEM_PWD_GRP */
38#endif /* __CONFIG_GRP_H */
39 114
115#endif /* grp.h */
116#endif