From aa938285a42f365e55dd83fe4039a90aa4b6b864 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 11 Sep 2024 16:23:02 +0200 Subject: [PATCH] [users] Read home_permissions setting from config --- src/modules/users/Config.cpp | 16 ++++++++++++++++ src/modules/users/Config.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index cd56bc3e2..534cc9143 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -19,6 +19,7 @@ #include "JobQueue.h" #include "compat/Variant.h" #include "utils/Logger.h" +#include "utils/Permissions.h" #include "utils/String.h" #include "utils/StringExpander.h" #include "utils/Variant.h" @@ -946,6 +947,21 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) m_forbiddenLoginNames = Calamares::getStringList( userSettings, "forbidden_names" ); m_forbiddenLoginNames << alwaysForbiddenLoginNames(); tidy( m_forbiddenLoginNames ); + + const auto permissionKey = QStringLiteral( "home_permissions" ); + if ( userSettings.contains( permissionKey ) ) + { + const auto value = Calamares::getString( userSettings, permissionKey ); + m_homeDirPermissions = Calamares::parseFileMode( value ); + if ( m_homeDirPermissions < 0 ) + { + cWarning() << "Setting for" << permissionKey << '(' << value << userSettings[permissionKey] << ") is invalid."; + } + } + else + { + m_homeDirPermissions = -1; + } } setAutoLoginGroup( either< QString, const QString& >( diff --git a/src/modules/users/Config.h b/src/modules/users/Config.h index 3640519dc..5d3776c62 100644 --- a/src/modules/users/Config.h +++ b/src/modules/users/Config.h @@ -371,6 +371,8 @@ private: QStringList m_forbiddenLoginNames; PasswordCheckList m_passwordChecks; + + int m_homeDirPermissions = -1; }; #endif