Add-on blacklist table. More...
#include <blacklist.hpp>
Public Types | |
typedef std::string | glob |
typedef std::vector< glob > | globlist |
Public Member Functions | |
blacklist () | |
blacklist (const config &cfg) | |
void | clear () |
void | read (const config &cfg) |
Initializes the blacklist from WML. More... | |
void | write (config &cfg) const |
Writes the blacklist to a WML node. More... | |
bool | is_blacklisted (const std::string &name, const std::string &title, const std::string &description, const std::string &author, const std::string &ip, const std::string &email) const |
Whether an add-on described by these fields is blacklisted. More... | |
Private Member Functions | |
void | parse_str_to_globlist (const std::string &str, globlist &glist) |
bool | is_in_globlist (const std::string &str, const globlist &glist) const |
bool | is_in_ip_masklist (const std::string &ip, const globlist &mlist) const |
bool | ip_matches (const std::string &ip, const glob &ip_mask) const |
Private Attributes | |
globlist | names_ |
globlist | titles_ |
globlist | descriptions_ |
globlist | authors_ |
globlist | ips_ |
globlist | emails_ |
Add-on blacklist table.
A path to a blacklist WML file may be provided in the campaignd configuration. The file's contents are used to maintain a blacklist to check certain add-on metadata fields against it every time a new or existing add-on is uploaded ([upload] request).
Blacklist entries are glob patterns accepting the '*' and '?' wildcards for matching any number of characters and a single character, respectively. The lists are expected to be comma-delimited.
ip = (net address masks) email = (email address patterns) name = (add-on id/dirname patterns) title = (add-on title patterns) author = (add-on author patterns) description = (add-on description patterns)
Definition at line 44 of file blacklist.hpp.
Definition at line 47 of file blacklist.hpp.
typedef std::vector<glob> campaignd::blacklist::globlist |
Definition at line 48 of file blacklist.hpp.
campaignd::blacklist::blacklist | ( | ) |
Definition at line 27 of file blacklist.cpp.
|
explicit |
Definition at line 37 of file blacklist.cpp.
References read().
void campaignd::blacklist::clear | ( | ) |
Definition at line 48 of file blacklist.cpp.
References authors_, descriptions_, emails_, ips_, names_, and titles_.
Referenced by campaignd::server::load_blacklist().
|
private |
Definition at line 126 of file blacklist.cpp.
References utils::wildcard_string_match().
Referenced by is_in_ip_masklist().
bool campaignd::blacklist::is_blacklisted | ( | const std::string & | name, |
const std::string & | title, | ||
const std::string & | description, | ||
const std::string & | author, | ||
const std::string & | ip, | ||
const std::string & | |||
) | const |
Whether an add-on described by these fields is blacklisted.
Empty parameters are ignored.
Definition at line 75 of file blacklist.cpp.
References authors_, descriptions_, emails_, ips_, is_in_globlist(), is_in_ip_masklist(), names_, and titles_.
Referenced by campaignd::server::handle_upload().
|
private |
Definition at line 92 of file blacklist.cpp.
References LOG_BL, utf8::lowercase(), and utils::wildcard_string_match().
Referenced by is_blacklisted().
|
private |
Definition at line 110 of file blacklist.cpp.
References ip_matches(), and LOG_BL.
Referenced by is_blacklisted().
|
private |
Initializes the blacklist from WML.
cfg | WML node object with the contents of the [blacklist] tag. |
Definition at line 59 of file blacklist.cpp.
References authors_, descriptions_, emails_, ips_, names_, parse_str_to_globlist(), and titles_.
Referenced by blacklist(), and campaignd::server::load_blacklist().
Writes the blacklist to a WML node.
cfg | WML node object to write to. Any existing contents are erased by this method. |
|
private |
Definition at line 87 of file blacklist.hpp.
Referenced by clear(), is_blacklisted(), and read().
|
private |
Definition at line 85 of file blacklist.hpp.
Referenced by clear(), is_blacklisted(), and read().
|
private |
Definition at line 89 of file blacklist.hpp.
Referenced by clear(), is_blacklisted(), and read().
|
private |
Definition at line 88 of file blacklist.hpp.
Referenced by clear(), is_blacklisted(), and read().
|
private |
Definition at line 83 of file blacklist.hpp.
Referenced by clear(), is_blacklisted(), and read().
|
private |
Definition at line 84 of file blacklist.hpp.
Referenced by clear(), is_blacklisted(), and read().