~ubuntu-branches/ubuntu/edgy/lynx/edgy

« back to all changes in this revision

Viewing changes to WWW/Library/Implementation/HTGroup.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-09-16 12:14:10 UTC
  • Revision ID: james.westby@ubuntu.com-20040916121410-cz1gu92c4nqfeyrg
Tags: upstream-2.8.5
ImportĀ upstreamĀ versionĀ 2.8.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*                                    GROUP FILE ROUTINES
 
2
 
 
3
 */
 
4
 
 
5
#ifndef HTGROUP_H
 
6
#define HTGROUP_H
 
7
 
 
8
#include <HTList.h>
 
9
 
 
10
 
 
11
typedef HTList GroupDefList;
 
12
typedef HTList ItemList;
 
13
 
 
14
typedef struct {
 
15
    char *      group_name;
 
16
    ItemList *  item_list;
 
17
} GroupDef;
 
18
 
 
19
 
 
20
/*
 
21
** Access Authorization failure reasons
 
22
*/
 
23
typedef enum {
 
24
    HTAA_OK,            /* 200 OK                               */
 
25
    HTAA_OK_GATEWAY,    /* 200 OK, acting as a gateway          */
 
26
    HTAA_NO_AUTH,       /* 401 Unauthorized, not authenticated  */
 
27
    HTAA_NOT_MEMBER,    /* 401 Unauthorized, not authorized     */
 
28
    HTAA_IP_MASK,       /* 403 Forbidden by IP mask             */
 
29
    HTAA_BY_RULE,       /* 403 Forbidden by rule                */
 
30
    HTAA_NO_ACL,        /* 403 Forbidden, ACL non-existent      */
 
31
    HTAA_NO_ENTRY,      /* 403 Forbidden, no ACL entry          */
 
32
    HTAA_SETUP_ERROR,   /* 403 Forbidden, server setup error    */
 
33
    HTAA_DOTDOT,        /* 403 Forbidden, URL with /../ illegal */
 
34
    HTAA_HTBIN,         /* 403 Forbidden, /htbin not enabled    */
 
35
    HTAA_NOT_FOUND      /* 404 Not found, or read protected     */
 
36
} HTAAFailReasonType;
 
37
 
 
38
/*
 
39
 
 
40
Group definition grammar
 
41
 
 
42
  string
 
43
                         "sequence of alphanumeric characters"
 
44
 
 
45
  user_name
 
46
                         string
 
47
 
 
48
  group_name
 
49
                         string
 
50
 
 
51
  group_ref
 
52
                         group_name
 
53
 
 
54
  user_def
 
55
                         user_name | group_ref
 
56
 
 
57
  user_def_list
 
58
                           user_def { ',' user_def }
 
59
 
 
60
  user_part
 
61
                         user_def | '(' user_def_list ')'
 
62
 
 
63
  templ
 
64
 
 
65
                         "sequence of alphanumeric characters and '*'s"
 
66
 
 
67
  ip_number_mask
 
68
                         templ '.' templ '.' templ '.' templ
 
69
 
 
70
  domain_name_mask
 
71
                         templ { '.' templ }
 
72
 
 
73
  address
 
74
 
 
75
                         ip_number_mask | domain_name_mask
 
76
 
 
77
  address_def
 
78
 
 
79
                         address
 
80
 
 
81
  address_def_list
 
82
                         address_def { ',' address_def }
 
83
 
 
84
  address_part
 
85
                         address_def | '(' address_def_list ')'
 
86
 
 
87
  item
 
88
                         [user_part] ['@' address_part]
 
89
 
 
90
  item_list
 
91
                         item { ',' item }
 
92
 
 
93
  group_def
 
94
                         item_list
 
95
 
 
96
  group_decl
 
97
                         group_name ':' group_def
 
98
 
 
99
  PARSE GROUP DEFINITION
 
100
 
 
101
 */
 
102
 
 
103
PUBLIC GroupDef *HTAA_parseGroupDef PARAMS((FILE * fp));
 
104
/*
 
105
 
 
106
Fill in Pointers to referenced Group Definitions in a Group Definition
 
107
 
 
108
   References to groups (by their name) are resolved from group_def_list and pointers to
 
109
   those structures are added to group_def.
 
110
 
 
111
 */
 
112
 
 
113
PUBLIC void HTAA_resolveGroupReferences PARAMS((GroupDef *     group_def,
 
114
                                                GroupDefList * group_def_list));
 
115
/*
 
116
 
 
117
Read Group File (and do caching)
 
118
 
 
119
   If group file is already in cache returns a pointer to previously read group definition
 
120
   list.
 
121
 
 
122
 */
 
123
 
 
124
PUBLIC GroupDefList *HTAA_readGroupFile PARAMS((CONST char * filename));
 
125
/*
 
126
 
 
127
Delete Group Definition
 
128
 
 
129
   Groups in cache should never be freed by this function.  This should only be used to
 
130
   free group definitions read by HTAA_parseGroupDef.
 
131
 
 
132
 */
 
133
 
 
134
PUBLIC void GroupDef_delete PARAMS((GroupDef * group_def));
 
135
/*
 
136
 
 
137
Print Out Group Definition (for trace purposes)
 
138
 
 
139
 */
 
140
 
 
141
PUBLIC void HTAA_printGroupDef PARAMS((GroupDef * group_def));
 
142
/*
 
143
 
 
144
Does a User Belong to a Given Set of Groups
 
145
 
 
146
   This function checks both the username and the internet address.
 
147
 
 
148
 */
 
149
 
 
150
/* PUBLIC                                       HTAA_userAndInetInGroup()
 
151
**              CHECK IF USER BELONGS TO TO A GIVEN GROUP
 
152
**              AND THAT THE CONNECTION COMES FROM AN
 
153
**              ADDRESS THAT IS ALLOWED BY THAT GROUP
 
154
** ON ENTRY:
 
155
**      group           the group definition structure.
 
156
**      username        connecting user.
 
157
**      ip_number       browser host IP number, optional.
 
158
**      ip_name         browser host IP name, optional.
 
159
**                      However, one of ip_number or ip_name
 
160
**                      must be given.
 
161
** ON EXIT:
 
162
**      returns         HTAA_IP_MASK, if IP address mask was
 
163
**                      reason for failing.
 
164
**                      HTAA_NOT_MEMBER, if user does not belong
 
165
**                      to the group.
 
166
**                      HTAA_OK if both IP address and user are ok.
 
167
*/
 
168
PUBLIC HTAAFailReasonType HTAA_userAndInetInGroup PARAMS((GroupDef * group,
 
169
                                                          char *     username,
 
170
                                                          char *     ip_number,
 
171
                                                          char *     ip_name));
 
172
 
 
173
#endif /* not HTGROUP_H */