perl -i -npe "s/[ \t]+$//g" `find src -name "*.[ch]" -print`
[freeradius.git] / src / modules / rlm_unix / cache.h
1 /*
2  * cache.h   Definitions for structures and functions needed in cache.c
3  *
4  * Version: cache.c  0.99  04-13-1999  jeff@apex.net
5  */
6 #ifndef _CACHE_H
7 #define _CACHE_H
8
9 /* Misc definitions */
10 #define BUFSIZE  1024
11 #define HASHTABLESIZE 100000
12 #endif
13
14 /* Structure definitions */
15 struct mypasswd {
16         char    *pw_name;       /* user name */
17         char    *pw_passwd;     /* user password */
18         uid_t   pw_uid;         /* user id */
19         gid_t   pw_gid;         /* group id */
20         char    *pw_gecos;      /* full name (used for class attr */
21         struct mypasswd *next;  /* next */
22 };
23
24 struct mygroup {
25         char    *gr_name;        /* group name */
26         char    *gr_passwd;      /* group password */
27         gid_t   gr_gid;          /* group id */
28         char    **gr_mem;        /* group members */
29         struct mygroup *next;    /* next */
30 };
31
32 struct pwcache {
33   struct mypasswd *hashtable[HASHTABLESIZE];
34   struct mygroup *grphead;
35 };
36
37 /* Function prototypes */
38 struct pwcache *unix_buildpwcache(const char *passwd_file,
39                                   const char *shadow_file,
40                                   const char *group_file);
41 int H_unix_pass(struct pwcache *cache, char *name, char *passwd,
42                 VALUE_PAIR **reply_items);
43 int H_groupcmp(struct pwcache *cache, VALUE_PAIR *check, char *username);
44 void unix_freepwcache(struct pwcache *cache);