#include <AccessList.h>
Public Member Functions | |
| AccessList () | |
| AccessEntry * | client (const char *name, struct in_addr addr) |
| void | init () |
| void | read (Lexer &lex) |
| void | readClient (Lexer &lex, const char *address) |
| void | printParameters (std::ostream *pOut) |
Private Attributes | |
| std::vector< AccessEntry > | vector |
Definition at line 167 of file AccessList.h.
|
|
Definition at line 172 of file AccessList.h.
00172 {
00173 } AccessEntry *client(const char *name, struct in_addr addr);
|
|
||||||||||||
|
Definition at line 88 of file AccessList.cc. References matchaddress(), and vector. Referenced by Config::client(), and nnrpd().
00089 {
00090 std::vector < AccessEntry >::iterator begin = vector.begin(), end =
00091 vector.end();
00092
00093 while (begin != end) {
00094 if (matchaddress(begin->hostname, name, addr) ||
00095 begin->hostname[0] == '\0') {
00096 return &(*begin);
00097 }
00098 ++begin;
00099 }
00100 return NULL;
00101 }
|
|
|
Definition at line 174 of file AccessList.h. References vector. Referenced by Config::init().
00174 {
00175 vector.clear();
00176 }
|
|
|
Definition at line 260 of file AccessList.cc. References vector. Referenced by Config::printParameters().
|
|
|
Definition at line 103 of file AccessList.cc. References ERROR_LOCATION, Lexer::getToken(), and readClient(). Referenced by Config::read().
00104 {
00105 string tok, host, port;
00106 int default_found = 0;
00107 tok = lex.getToken();
00108 if (tok != "{")
00109 throw SyntaxError(lex, "expected '{'", ERROR_LOCATION);
00110 for (;;) {
00111 tok = lex.getToken();
00112 if (tok == "Client") {
00113 host = lex.getToken();
00114 //port=lex.getToken();
00115 readClient(lex, host.c_str());
00116 } else if (tok == "Default") {
00117 readClient(lex, "");
00118 default_found++;
00119 } else if (tok == "}") {
00120 break;
00121 } else {
00122 throw SyntaxError(lex,
00123 "expected declaration or '}'",
00124 ERROR_LOCATION);
00125 }
00126 }
00127 if (!default_found)
00128 throw SyntaxError(lex,
00129 "'Default' entry not found in NewsClientList",
00130 ERROR_LOCATION);
00131 }
|
|
||||||||||||
|
Definition at line 197 of file AccessList.cc. References AccessEntry::access_flags, ACCESSLIST_SET_FILTERS, AccessEntry::authentication, ERROR_LOCATION, Lexer::getToken(), AccessEntry::hostname, AccessEntry::list, AccessEntry::PAMServicename, AccessEntry::postTo, Lexer::putbackToken(), AccessEntry::read, Authentication::set(), and vector. Referenced by read().
00198 {
00199 string tok, a1, a2, a3;
00200 int filter_set = 0;
00201 AccessEntry cur;
00202 strcpy(cur.hostname, address);
00203
00204 tok = lex.getToken();
00205 if (tok != "{")
00206 throw SyntaxError(lex, "expected '{'", ERROR_LOCATION);
00207 for (;;) {
00208 tok = lex.getToken();
00209 if (tok == "allow") {
00210 for (;;) {
00211 a1 = lex.getToken();
00212 if (a1 == "read")
00213 cur.access_flags |=
00214 AccessEntry::af_read;
00215 else if (a1 == "post")
00216 cur.access_flags |=
00217 AccessEntry::af_post;
00218 else if (a1 == "debug")
00219 cur.access_flags |=
00220 AccessEntry::af_debug;
00221 else if (a1 == "authentication")
00222 cur.access_flags |=
00223 AccessEntry::af_authentication;
00224 else if (a1 == "none")
00225 cur.access_flags = 0x0;
00226 else
00227 break;
00228 }
00229 lex.putbackToken(a1);
00230 } else if (tok == "List") {
00231 a1 = lex.getToken();
00232 cur.list = a1;
00233 filter_set |= 0x01;
00234 ACCESSLIST_SET_FILTERS;
00235 } else if (tok == "Read") {
00236 cur.read = a1 = lex.getToken();
00237 filter_set |= 0x02;
00238 ACCESSLIST_SET_FILTERS;
00239 } else if (tok == "PostTo") {
00240 cur.postTo = a1 = lex.getToken();
00241 filter_set |= 0x04;
00242 ACCESSLIST_SET_FILTERS;
00243 } else if (tok == "Authentication") {
00244 string t = lex.getToken();
00245 cur.authentication.set (t);
00246 } else if (tok == "PAMServicename") {
00247 cur.PAMServicename = lex.getToken();
00248 } else if (tok == "}") {
00249 break;
00250 } else {
00251 throw SyntaxError(lex,
00252 "expected declaration or '}'",
00253 ERROR_LOCATION);
00254 }
00255 }
00256
00257 vector.push_back(cur);
00258 }
|
|
|
Definition at line 169 of file AccessList.h. Referenced by client(), init(), printParameters(), and readClient(). |
1.3.6-20040222