summaryrefslogtreecommitdiffstats
path: root/src/modules/UserBackendHome/UserBackendHome.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/UserBackendHome/UserBackendHome.cpp')
-rw-r--r--src/modules/UserBackendHome/UserBackendHome.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/modules/UserBackendHome/UserBackendHome.cpp b/src/modules/UserBackendHome/UserBackendHome.cpp
index d524a52..f0714fe 100644
--- a/src/modules/UserBackendHome/UserBackendHome.cpp
+++ b/src/modules/UserBackendHome/UserBackendHome.cpp
@@ -44,6 +44,23 @@ bool UserBackendHome::handleConfigEntry(const Core::ConfigEntry &entry, bool han
if(entry[2].empty())
homeDir = entry[1][0];
}
+ else if(entry[1].getKey().matches("DirMode")) {
+ if(entry[2].empty()) {
+ if(entry[1][0].empty()) {
+ dirMode = 0755;
+ }
+ else {
+ char *endptr;
+ unsigned long val = std::strtoul(entry[1][0].c_str(), &endptr, 8);
+ if(*endptr || val > 07777) {
+ application->logf(Core::LoggerBase::WARNING, "UserBackendHome: Invalid configuration: DirMode '%s'", entry[1][0].c_str());
+ }
+ else {
+ dirMode = val;
+ }
+ }
+ }
+ }
else if(!entry[1].empty())
return false;
@@ -66,7 +83,7 @@ void UserBackendHome::setOwnerAndCopyMode(const std::string &source, const std::
}
}
-void migrateOwner(const std::string &path, const Common::UserInfo &oldUserInfo, const Common::UserInfo &userInfo, bool isSymlink) {
+void UserBackendHome::migrateOwner(const std::string &path, const Common::UserInfo &oldUserInfo, const Common::UserInfo &userInfo, bool isSymlink) {
struct stat st;
if((isSymlink ? lstat : stat)(path.c_str(), &st) != 0) {
// TODO Error
@@ -100,6 +117,10 @@ void UserBackendHome::addUser(const Common::UserInfo &userInfo) throw(Core::Exce
// TODO Error
}
+ if(chmod(nativePath.c_str(), (mode_t)dirMode)) {
+ // TODO Error
+ }
+
boost::filesystem::path skeletonPath(skeleton);
if(!boost::filesystem::is_directory(skeletonPath))
return;