#include <ArServerUserInfo.h>
Public Member Functions | |
ArServerUserInfo (const char *baseDirectory=NULL) | |
Constructor. | |
bool | doNotUse (void) const |
std::set< std::string, ArStrCaseCmpOp > | getUsersGroups (const char *user) const |
Gets the groups a user is in (returns empty set if no user). | |
void | logUsers (void) const |
Logs the users and groups. | |
bool | matchUserPassword (const char *user, unsigned char password[16], const char *passwordKey, const char *serverKey) const |
Matchs a user and password, false if user or password is wrong. | |
bool | readFile (const char *fileName) |
Loads the file, returns false if it wasn't there. | |
void | setBaseDirectory (const char *baseDirectory) |
Sets the base directory. | |
~ArServerUserInfo () | |
Destructor. | |
Protected Member Functions | |
void | removeHandlers (void) |
bool | v1DoNotUseCallback (ArArgumentBuilder *arg) |
bool | v1HeaderCallback (ArArgumentBuilder *arg) |
bool | v1UserCallback (ArArgumentBuilder *arg) |
Protected Attributes | |
std::string | myBaseDirectory |
ArMutex | myDataMutex |
bool | myDoNotUse |
bool | myGotHeader |
std::map< std::string, std::set< std::string, ArStrCaseCmpOp > *, ArStrCaseCmpOp > | myGroups |
ArFileParser | myParser |
std::map< std::string, std::string, ArStrCaseCmpOp > | myPasswords |
ArRetFunctor1C< bool, ArServerUserInfo, ArArgumentBuilder * > | myV1DoNotUseCB |
ArRetFunctor1C< bool, ArServerUserInfo, ArArgumentBuilder * > | myV1HeaderCB |
ArRetFunctor1C< bool, ArServerUserInfo, ArArgumentBuilder * > | myV1UserCB |
The file format for this class is set up to be easy to make a new version of and yet read all the old versions.
For all of the versions everything after ; or # is ignored. The version information is then the first line of non comments.
The first version is described as such: The version string is 'UserInfoVersion1
'. Then there are lines that follow for each user which are 'user
userName password groups'. The passwords are plain text in the file, though they aren't sent that way over the network (look at ArServerBase docs for details). To display the groups available use ArServerBase::logCommandGroups().
There is an example user info file in ArNetworking/examples/serverDemo.userInfo
Definition at line 52 of file ArServerUserInfo.h.
|
Constructor.
Definition at line 31 of file ArServerUserInfo.cpp. References myDoNotUse, myGotHeader, myParser, and ArFileParser::setBaseDirectory(). |
|
Destructor.
Definition at line 41 of file ArServerUserInfo.cpp. |
|
Definition at line 253 of file ArServerUserInfo.cpp. References myDoNotUse. Referenced by ArServerBase::loadUserInfo(). |
|
Gets the groups a user is in (returns empty set if no user).
Definition at line 204 of file ArServerUserInfo.cpp. References ArLog::log(), and myGroups. Referenced by logUsers(), and ArServerClient::processPacket(). |
|
Logs the users and groups.
Definition at line 219 of file ArServerUserInfo.cpp. References getUsersGroups(), ArLog::log(), myDoNotUse, and myPasswords. Referenced by ArServerBase::logUserInfo(). |
|
Matchs a user and password, false if user or password is wrong.
Definition at line 156 of file ArServerUserInfo.cpp. References ArLog::log(), md5_append(), md5_finish(), md5_init(), and myPasswords. Referenced by ArServerClient::processPacket(). |
|
Loads the file, returns false if it wasn't there.
Definition at line 126 of file ArServerUserInfo.cpp. References ArFileParser::addHandler(), ArUtil::deleteSetPairs(), ArMutex::lock(), ArLog::log(), myDataMutex, myGotHeader, myGroups, myParser, myPasswords, myV1HeaderCB, ArFileParser::parseFile(), removeHandlers(), and ArMutex::unlock(). Referenced by ArServerBase::loadUserInfo(). |
|
Definition at line 120 of file ArServerUserInfo.cpp. References myParser, myV1HeaderCB, myV1UserCB, and ArFileParser::remHandler(). Referenced by readFile(), and v1HeaderCallback(). |
|
Sets the base directory.
Definition at line 46 of file ArServerUserInfo.cpp. References ArMutex::lock(), myDataMutex, myParser, ArFileParser::setBaseDirectory(), and ArMutex::unlock(). Referenced by ArServerBase::loadUserInfo(). |
|
Definition at line 114 of file ArServerUserInfo.cpp. References myDoNotUse. |
|
Definition at line 54 of file ArServerUserInfo.cpp. References ArFileParser::addHandler(), ArLog::log(), myDoNotUse, myGotHeader, myParser, myV1DoNotUseCB, myV1UserCB, and removeHandlers(). |
|
Definition at line 71 of file ArServerUserInfo.cpp. References ArLog::log(), myGroups, and myPasswords. |
|
Definition at line 87 of file ArServerUserInfo.h. |
|
Definition at line 80 of file ArServerUserInfo.h. Referenced by readFile(), and setBaseDirectory(). |
|
Definition at line 90 of file ArServerUserInfo.h. Referenced by ArServerUserInfo(), doNotUse(), logUsers(), v1DoNotUseCallback(), and v1HeaderCallback(). |
|
Definition at line 89 of file ArServerUserInfo.h. Referenced by ArServerUserInfo(), readFile(), and v1HeaderCallback(). |
|
Definition at line 83 of file ArServerUserInfo.h. Referenced by getUsersGroups(), readFile(), and v1UserCallback(). |
|
Definition at line 88 of file ArServerUserInfo.h. Referenced by ArServerUserInfo(), readFile(), removeHandlers(), setBaseDirectory(), and v1HeaderCallback(). |
|
Definition at line 81 of file ArServerUserInfo.h. Referenced by logUsers(), matchUserPassword(), readFile(), and v1UserCallback(). |
|
Definition at line 86 of file ArServerUserInfo.h. Referenced by v1HeaderCallback(). |
|
Definition at line 84 of file ArServerUserInfo.h. Referenced by readFile(), and removeHandlers(). |
|
Definition at line 85 of file ArServerUserInfo.h. Referenced by removeHandlers(), and v1HeaderCallback(). |