From e1d8490f0654a3da0b900407d80d91d8d0da68c8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 27 Sep 2009 01:55:44 +0200 Subject: Use libicu to support unicode properly; migrated ConfigManager to UnicodeString --- src/modules/AuthProviderFile/AuthProviderFile.cpp | 12 +-- src/modules/FileLogger/Module.cpp | 12 +-- .../StorageBackendFile/StorageBackendFile.cpp | 6 +- .../UserConfigBackendHome.cpp | 18 ++-- .../UserConfigBackendKrb5.cpp | 24 +++--- .../UserDBBackendMysql/UserDBBackendMysql.cpp | 98 +++++++++++----------- 6 files changed, 85 insertions(+), 85 deletions(-) (limited to 'src/modules') diff --git a/src/modules/AuthProviderFile/AuthProviderFile.cpp b/src/modules/AuthProviderFile/AuthProviderFile.cpp index 1756747..b1e1e52 100644 --- a/src/modules/AuthProviderFile/AuthProviderFile.cpp +++ b/src/modules/AuthProviderFile/AuthProviderFile.cpp @@ -89,23 +89,23 @@ bool AuthProviderFile::handleConfigEntry(const Core::ConfigEntry &entry, bool /* if(!entry[0].getKey().matches("AuthProviderFile")) return false; - if(entry[1].empty()) + if(entry[1].isEmpty()) return true; if(entry[1].getKey().matches("Hash")) { - if(entry[2].empty()) { - filehash = entry[1][0]; + if(entry[2].isEmpty()) { + filehash = entry[1][0].extract(); if(!Common::Hash::isHashSupported(filehash)) application->logf(Core::Logger::LOG_WARNING, "AuthProviderFile: Unsupported hash '%s'", filehash.c_str()); } } else if(entry[1].getKey().matches("File")) { - if(entry[2].empty()) { - files.push_back(entry[1][0]); + if(entry[2].isEmpty()) { + files.push_back(entry[1][0].extract()); } } - else if(!entry[2].empty()) + else if(!entry[2].isEmpty()) return false; return true; diff --git a/src/modules/FileLogger/Module.cpp b/src/modules/FileLogger/Module.cpp index d000c8b..663389f 100644 --- a/src/modules/FileLogger/Module.cpp +++ b/src/modules/FileLogger/Module.cpp @@ -32,9 +32,9 @@ bool Module::handleConfigEntry(const Core::ConfigEntry &entry, bool handled) { if(entry[0].getKey().matches("Log")) { if(entry[0][0].matches("File")) { - if(entry[1].empty()) { - if(!entry[0][1].empty()) { - lastLogger.reset(new FileLogger(entry[0][1])); + if(entry[1].isEmpty()) { + if(!entry[0][1].isEmpty()) { + lastLogger.reset(new FileLogger(entry[0][1].extract())); loggers.insert(lastLogger); application->getLogManager()->registerLogger(lastLogger); @@ -47,15 +47,15 @@ bool Module::handleConfigEntry(const Core::ConfigEntry &entry, bool handled) { return true; } else if(entry[1].getKey().matches("Level")) { - if(entry[2].empty()) { + if(entry[2].isEmpty()) { try { - if(boost::algorithm::to_lower_copy(static_cast(entry[1][0])) == "remote") + if(entry[1][0].matches("remote")) lastLogger->setRemoteLevel(Core::LogManager::parseLevel(entry[1][1])); else lastLogger->setLevel(Core::LogManager::parseLevel(entry[1][0])); } catch(Core::Exception e) { - application->logf(Core::Logger::LOG_WARNING, "Unknown log level '%s'.", entry[1][0].c_str()); + application->logf(Core::Logger::LOG_WARNING, "Unknown log level '%s'.", entry[1][0].extract().c_str()); } return true; diff --git a/src/modules/StorageBackendFile/StorageBackendFile.cpp b/src/modules/StorageBackendFile/StorageBackendFile.cpp index 33c6b0f..aae7e03 100644 --- a/src/modules/StorageBackendFile/StorageBackendFile.cpp +++ b/src/modules/StorageBackendFile/StorageBackendFile.cpp @@ -35,12 +35,12 @@ bool StorageBackendFile::handleConfigEntry(const Core::ConfigEntry &entry, bool boost::lock_guard lock(mutex); if(entry[1].getKey().matches("Root")) { - if(!entry[2].empty()) + if(!entry[2].isEmpty()) return false; - storageRoot = entry[1][0]; + storageRoot = entry[1][0].extract(); } - else if(!entry[1].empty()) { + else if(!entry[1].isEmpty()) { return false; } diff --git a/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp b/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp index 9f724e5..d47e03b 100644 --- a/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp +++ b/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp @@ -34,23 +34,23 @@ namespace UserConfigBackendHome { bool UserConfigBackendHome::handleConfigEntry(const Core::ConfigEntry &entry, bool /*handled*/) { if(entry[0].getKey().matches("UserManager")) { if(entry[1].getKey().matches("Skeleton")) { - if(entry[2].empty()) - skeleton = entry[1][0]; + if(entry[2].isEmpty()) + skeleton = entry[1][0].extract(); } else if(entry[1].getKey().matches("HomeDir")) { - if(entry[2].empty()) - homeDir = entry[1][0]; + if(entry[2].isEmpty()) + homeDir = entry[1][0].extract(); } else if(entry[1].getKey().matches("UserDirMode")) { - if(entry[2].empty()) { - if(entry[1][0].empty()) { + if(entry[2].isEmpty()) { + if(entry[1][0].isEmpty()) { dirMode = 0755; } else { char *endptr; - unsigned long val = std::strtoul(entry[1][0].c_str(), &endptr, 8); + unsigned long val = std::strtoul(entry[1][0].extract().c_str(), &endptr, 8); if(*endptr || val > 07777) { - application->logf(Core::Logger::LOG_WARNING, "UserBackendHome: Invalid configuration: DirMode '%s'", entry[1][0].c_str()); + application->logf(Core::Logger::LOG_WARNING, "UserBackendHome: Invalid configuration: DirMode '%s'", entry[1][0].extract().c_str()); } else { dirMode = val; @@ -58,7 +58,7 @@ bool UserConfigBackendHome::handleConfigEntry(const Core::ConfigEntry &entry, bo } } } - else if(!entry[1].empty()) + else if(!entry[1].isEmpty()) return false; return true; diff --git a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp index b10dbcf..475a689 100644 --- a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp +++ b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp @@ -92,7 +92,7 @@ bool UserConfigBackendKrb5::handleConfigEntry(const Core::ConfigEntry &entry, bo if(!entry[0].getKey().matches("UserManager")) return false; - if(entry[1].empty()) + if(entry[1].isEmpty()) return true; if(!entry[1].getKey().matches("Krb5")) @@ -101,26 +101,26 @@ bool UserConfigBackendKrb5::handleConfigEntry(const Core::ConfigEntry &entry, bo boost::lock_guard lock(mutex); if(entry[2].getKey().matches("Realm")) { - if(entry[3].empty()) - realm = entry[2][0]; + if(entry[3].isEmpty()) + realm = entry[2][0].extract(); } else if(entry[2].getKey().matches("Principal")) { - if(entry[3].empty()) - principal = entry[2][0]; + if(entry[3].isEmpty()) + principal = entry[2][0].extract(); } else if(entry[2].getKey().matches("Server")) { - if(entry[3].empty()) - server = entry[2][0]; + if(entry[3].isEmpty()) + server = entry[2][0].extract(); } else if(entry[2].getKey().matches("Password")) { - if(entry[3].empty()) - password = entry[2][0]; + if(entry[3].isEmpty()) + password = entry[2][0].extract(); } else if(entry[2].getKey().matches("Keytab")) { - if(entry[3].empty()) - keytab = entry[2][0]; + if(entry[3].isEmpty()) + keytab = entry[2][0].extract(); } - else if(!entry[2].empty()) + else if(!entry[2].isEmpty()) return false; return true; diff --git a/src/modules/UserDBBackendMysql/UserDBBackendMysql.cpp b/src/modules/UserDBBackendMysql/UserDBBackendMysql.cpp index e905541..7e7711a 100644 --- a/src/modules/UserDBBackendMysql/UserDBBackendMysql.cpp +++ b/src/modules/UserDBBackendMysql/UserDBBackendMysql.cpp @@ -40,34 +40,34 @@ bool UserDBBackendMysql::handleConfigEntry(const Core::ConfigEntry &entry, bool if(!entry[0].getKey().matches("UserManager")) return false; - if(entry[1].empty()) + if(entry[1].isEmpty()) return true; if(!entry[1].getKey().matches("Mysql")) return false; if(entry[2].getKey().matches("Host")) { - if(entry[3].empty()) - host = entry[2][0]; + if(entry[3].isEmpty()) + host = entry[2][0].extract(); } else if(entry[2].getKey().matches("Username")) { - if(entry[3].empty()) - username = entry[2][0]; + if(entry[3].isEmpty()) + username = entry[2][0].extract(); } else if(entry[2].getKey().matches("Password")) { - if(entry[3].empty()) - passwd = entry[2][0]; + if(entry[3].isEmpty()) + passwd = entry[2][0].extract(); } else if(entry[2].getKey().matches("Database")) { - if(entry[3].empty()) - db = entry[2][0]; + if(entry[3].isEmpty()) + db = entry[2][0].extract(); } else if(entry[2].getKey().matches("Port")) { - if(entry[3].empty()) { + if(entry[3].isEmpty()) { char *endptr; long val; - val = strtol(entry[2][0].c_str(), &endptr, 10); + val = strtol(entry[2][0].extract().c_str(), &endptr, 10); if(endptr != 0 || val < 0 || val > 65535) application->log(Core::Logger::LOG_WARNING, "UserDBBackendMysql: Invalid port"); @@ -76,82 +76,82 @@ bool UserDBBackendMysql::handleConfigEntry(const Core::ConfigEntry &entry, bool } } else if(entry[2].getKey().matches("UnixSocket")) { - if(entry[3].empty()) - unixSocket = entry[2][0]; + if(entry[3].isEmpty()) + unixSocket = entry[2][0].extract(); } else if(entry[2].getKey().matches("Queries")) { if(entry[3].getKey().matches("ListUsers")) { - if(entry[4].empty()) - queryListUsers = entry[3][0]; + if(entry[4].isEmpty()) + queryListUsers = entry[3][0].extract(); } else if(entry[3].getKey().matches("ListGroups")) { - if(entry[4].empty()) - queryListGroups = entry[3][0]; + if(entry[4].isEmpty()) + queryListGroups = entry[3][0].extract(); } else if(entry[3].getKey().matches("ListUserGroups")) { - if(entry[4].empty()) - queryListUserGroups = entry[3][0]; + if(entry[4].isEmpty()) + queryListUserGroups = entry[3][0].extract(); } else if(entry[3].getKey().matches("ListGroupUsers")) { - if(entry[4].empty()) - queryListGroupUsers = entry[3][0]; + if(entry[4].isEmpty()) + queryListGroupUsers = entry[3][0].extract(); } else if(entry[3].getKey().matches("UserById")) { - if(entry[4].empty()) - queryUserById = entry[3][0]; + if(entry[4].isEmpty()) + queryUserById = entry[3][0].extract(); } else if(entry[3].getKey().matches("UserByName")) { - if(entry[4].empty()) - queryUserByName = entry[3][0]; + if(entry[4].isEmpty()) + queryUserByName = entry[3][0].extract(); } else if(entry[3].getKey().matches("GroupById")) { - if(entry[4].empty()) - queryGroupById = entry[3][0]; + if(entry[4].isEmpty()) + queryGroupById = entry[3][0].extract(); } else if(entry[3].getKey().matches("GroupByName")) { - if(entry[4].empty()) - queryGroupByName = entry[3][0]; + if(entry[4].isEmpty()) + queryGroupByName = entry[3][0].extract(); } else if(entry[3].getKey().matches("UserGroupTable")) { - if(entry[4].empty()) - queryUserGroupTable = entry[3][0]; + if(entry[4].isEmpty()) + queryUserGroupTable = entry[3][0].extract(); } else if(entry[3].getKey().matches("AddUser")) { - if(entry[4].empty()) - queryAddUser = entry[3][0]; + if(entry[4].isEmpty()) + queryAddUser = entry[3][0].extract(); } else if(entry[3].getKey().matches("UpdateUser")) { - if(entry[4].empty()) - queryUpdateUser = entry[3][0]; + if(entry[4].isEmpty()) + queryUpdateUser = entry[3][0].extract(); } else if(entry[3].getKey().matches("DeleteUser")) { - if(entry[4].empty()) - queryDeleteUser = entry[3][0]; + if(entry[4].isEmpty()) + queryDeleteUser = entry[3][0].extract(); } else if(entry[3].getKey().matches("AddGroup")) { - if(entry[4].empty()) - queryAddGroup = entry[3][0]; + if(entry[4].isEmpty()) + queryAddGroup = entry[3][0].extract(); } else if(entry[3].getKey().matches("UpdateGroup")) { - if(entry[4].empty()) - queryUpdateGroup = entry[3][0]; + if(entry[4].isEmpty()) + queryUpdateGroup = entry[3][0].extract(); } else if(entry[3].getKey().matches("DeleteGroup")) { - if(entry[4].empty()) - queryDeleteGroup = entry[3][0]; + if(entry[4].isEmpty()) + queryDeleteGroup = entry[3][0].extract(); } else if(entry[3].getKey().matches("AddUserToGroup")) { - if(entry[4].empty()) - queryAddUserToGroup = entry[3][0]; + if(entry[4].isEmpty()) + queryAddUserToGroup = entry[3][0].extract(); } else if(entry[3].getKey().matches("DeleteUserFromGroup")) { - if(entry[4].empty()) - queryDeleteUserFromGroup = entry[3][0]; + if(entry[4].isEmpty()) + queryDeleteUserFromGroup = entry[3][0].extract(); } - else if(!entry[3].empty()) + else if(!entry[3].isEmpty()) return false; } - else if(!entry[2].empty()) + else if(!entry[2].isEmpty()) return false; return true; -- cgit v1.2.3