Back to index

glibc  2.9
netgroup.h
Go to the documentation of this file.
00001 /* Internal header for netgroup related functions.
00002    Copyright (C) 1996, 1997, 2004 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _NETGROUP_H
00021 #define _NETGROUP_H  1
00022 
00023 #include <nsswitch.h>
00024 
00025 /* A netgroup can consist of names of other netgroups.  We have to
00026    track which netgroups were read and which still have to be read.  */
00027 struct name_list
00028 {
00029   struct name_list *next;
00030   char name[0];
00031 };
00032 
00033 
00034 /* Dataset for iterating netgroups.  */
00035 struct __netgrent
00036 {
00037   enum { triple_val, group_val } type;
00038 
00039   union
00040   {
00041     struct
00042     {
00043       const char *host;
00044       const char *user;
00045       const char *domain;
00046     }
00047     triple;
00048 
00049     const char *group;
00050   } val;
00051 
00052   /* Room for the data kept between the calls to the netgroup
00053      functions.  We must avoid global variables.  */
00054   char *data;
00055   size_t data_size;
00056   union
00057   {
00058     char *cursor;
00059     unsigned long int position;
00060   };
00061   int first;
00062 
00063   struct name_list *known_groups;
00064   struct name_list *needed_groups;
00065 
00066   /* This handle for the NSS data base is shared between all
00067      set/get/endXXXent functions.  */
00068   service_user *nip;
00069 };
00070 
00071 
00072 /* The internal netgroup handling functions might be called from outside.  */
00073 extern int __internal_setnetgrent (const char *group,
00074                                struct __netgrent *datap);
00075 extern void __internal_endnetgrent (struct __netgrent *datap);
00076 extern int __internal_getnetgrent_r (char **hostp, char **userp,
00077                                  char **domainp, struct __netgrent *datap,
00078                                  char *buffer, size_t buflen, int *errnop);
00079 
00080 #endif /* netgroup.h */