Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

AccessEntry Class Reference

#include <AccessList.h>

List of all members.

Public Types

enum  { af_read = 0x1, af_post = 0x2, af_debug = 0x4, af_authentication = 0x8 }

Public Member Functions

 AccessEntry ()
 PAM Service name for this Client.

void init ()
void clear ()
void modifyAccessFlags (const std::string &flags)
void printParameters (std::ostream *pOut)
void printAccessFlags (std::ostream *pOut) const

Public Attributes

char hostname [MAXHOSTNAMELEN]
unsigned int access_flags
NewsgroupFilter list
NewsgroupFilter read
 groups visible in active db

NewsgroupFilter postTo
 groups that clients may read

Authentication authentication
 groups that clients may post to

string PAMServicename

Friends

std::ostream & operator<< (std::ostream &os, const AccessEntry &ae)


Detailed Description

Author:
Thomas Gschwind

Bug:
Documentation is missing.

Definition at line 111 of file AccessList.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
af_read 
af_post 
af_debug 
af_authentication 

Definition at line 115 of file AccessList.h.

00115              {
00116                 af_read = 0x1,
00117                 af_post = 0x2,
00118                 af_debug = 0x4,
00119                 af_authentication = 0x8,
00120         };


Constructor & Destructor Documentation

AccessEntry::AccessEntry  )  [inline]
 

PAM Service name for this Client.

Definition at line 130 of file AccessList.h.

References init().

00130                        {
00131                 init();
00132         } void init() {


Member Function Documentation

void AccessEntry::clear void   )  [inline]
 

Definition at line 138 of file AccessList.h.

References init().

00138                      {
00139                 init();
00140         }

void AccessEntry::init void   )  [inline]
 

Definition at line 132 of file AccessList.h.

Referenced by AccessEntry(), and clear().

00132                       {
00133                 hostname[0] = '\0';
00134                 access_flags = 0x0;
00135                 PAMServicename = PAM_DEFAULT_SERVICENAME;
00136         }

void AccessEntry::modifyAccessFlags const std::string &  flags  ) 
 

Definition at line 162 of file AccessList.cc.

References access_flags, af_debug, af_post, af_read, Logger::p(), and slog.

Referenced by check_auth_file(), and check_auth_unix().

00163 {
00164         string t;
00165         string::size_type i=0, j;
00166 
00167         if (flags.length() == 0) {
00168                 return;
00169         }
00170 
00171         do {
00172                 if ((j=flags.find (",", i)) == string::npos) {
00173                         j=flags.length();
00174                 }
00175                 t = flags.substr (i, j-i);
00176                 slog.p(Logger::Debug) << "j: " << (unsigned int)j << " flags: "
00177                         << flags << " t: " << t << "\t";
00178                 if (t == "read") {
00179                         access_flags |= af_read;
00180                 } else if (t == "!read") {
00181                         access_flags |= ~af_read;
00182                 } else if (t == "post") {
00183                         access_flags |= af_post;
00184                 } else if (t == "!post") {
00185                         access_flags |= ~af_post;
00186                 } else if (t == "debug") {
00187                         access_flags |= af_debug;
00188                 } else if (t == "!debug") {
00189                         access_flags |= ~af_debug;
00190                 }
00191                 i=++j;
00192         } while (j<flags.length());
00193 
00194 }

void AccessEntry::printAccessFlags std::ostream *  pOut  )  const [inline]
 

Definition at line 207 of file AccessList.h.

References access_flags, af_debug, af_post, and af_read.

Referenced by operator<<(), and printParameters().

00208 {
00209         if (access_flags == 0x0) {
00210                 *pOut << " none";
00211         }
00212         if (access_flags & af_read) {
00213                 *pOut << " read";
00214         }
00215         if (access_flags & af_post) {
00216                 *pOut << " post";
00217         }
00218         if (access_flags & af_debug) {
00219                 *pOut << " debug";
00220         }
00221 }

void AccessEntry::printParameters std::ostream *  pOut  ) 
 

Definition at line 138 of file AccessList.cc.

References authentication, NewsgroupFilter::getRulelist(), list, PAMServicename, printAccessFlags(), and Authentication::printParameters().

00139 {
00140         if (hostname[0] != '\0') {
00141                 *pOut << "\tClient " << hostname << " {" << endl;
00142         } else {
00143                 *pOut << "\tDefault {" << endl;
00144         }
00145         *pOut << "\t\tallow";
00146         printAccessFlags (pOut);
00147         *pOut << endl;
00148         if (list.getRulelist() != "") {
00149                 *pOut << "\t\tList " << list.getRulelist() << endl;
00150         }
00151         if (read.getRulelist() != "") {
00152                 *pOut << "\t\tRead " << read.getRulelist() << endl;
00153         }
00154         if (postTo.getRulelist() != "") {
00155                 *pOut << "\t\tPostTo " << postTo.getRulelist() << endl;
00156         }
00157         authentication.printParameters (pOut);
00158         *pOut << "\t\tPAMServicename " << PAMServicename << endl;
00159         *pOut << "\t}" << endl;
00160 }


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  os,
const AccessEntry ae
[friend]
 

Definition at line 14 of file AccessList.cc.

00015 {
00016 #ifdef HAVE_SSTREAM
00017         stringstream sb;
00018 #else
00019         strstream sb;
00020 #endif
00021 
00022         os << ae.hostname << '{' << endl;
00023         os << "  access_flags=" << ae.access_flags << " (";
00024         ae.printAccessFlags(&os);
00025         os << ")"<< endl;
00026         os << "  list=" << ae.list << endl;
00027         os << "  read=" << ae.read << endl;
00028         os << "  postto=" << ae.postTo << endl;
00029         ae.authentication.printParameters (&sb);
00030         os << "  PAMServicename " << ae.PAMServicename << endl;
00031         string t = sb.str();
00032         // replace \t\tAuthentication with ""
00033         t.replace(0, 17, "");
00034         os << "  authentication=" << t << endl;
00035         os << '}';
00036 
00037         return os;
00038 }


Member Data Documentation

unsigned int AccessEntry::access_flags
 

Definition at line 122 of file AccessList.h.

Referenced by modifyAccessFlags(), nnrpd(), operator<<(), printAccessFlags(), AccessList::readClient(), and set_client_command_table().

Authentication AccessEntry::authentication
 

groups that clients may post to

Definition at line 127 of file AccessList.h.

Referenced by check_auth_file(), check_auth_unix(), check_authentication(), nnrpd(), operator<<(), printParameters(), and AccessList::readClient().

char AccessEntry::hostname[MAXHOSTNAMELEN]
 

Definition at line 113 of file AccessList.h.

Referenced by nnrpd(), operator<<(), and AccessList::readClient().

NewsgroupFilter AccessEntry::list
 

Definition at line 124 of file AccessList.h.

Referenced by check_auth_file(), check_auth_unix(), operator<<(), printParameters(), and AccessList::readClient().

string AccessEntry::PAMServicename
 

Definition at line 128 of file AccessList.h.

Referenced by operator<<(), printParameters(), and AccessList::readClient().

NewsgroupFilter AccessEntry::postTo
 

groups that clients may read

Definition at line 126 of file AccessList.h.

Referenced by check_auth_file(), check_auth_unix(), ns_post(), operator<<(), and AccessList::readClient().

NewsgroupFilter AccessEntry::read
 

groups visible in active db

Definition at line 125 of file AccessList.h.

Referenced by check_auth_file(), check_auth_unix(), ns_group(), ns_listgroup(), operator<<(), and AccessList::readClient().


The documentation for this class was generated from the following files:
Generated on Sun Oct 24 21:08:21 2004 for NewsCache by doxygen 1.3.6-20040222