1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

Added verification of target user existence

and logging message for cases when user is not found
This commit is contained in:
Valery Sinelnikov 2025-02-28 15:39:21 +04:00
parent ab632a8177
commit 463620ff25
3 changed files with 16 additions and 3 deletions

View File

@ -23,7 +23,7 @@ from .applier_frontend import (
import struct
from datetime import datetime, timedelta
import dpapi_ng
from util.util import remove_prefix_from_keys
from util.util import remove_prefix_from_keys, check_local_user_exists
from util.sid import WellKnown21RID
import subprocess
import ldb
@ -91,10 +91,13 @@ class laps_applier(applier_frontend):
self.storage = storage
# Load registry configuration
self._load_configuration()
if not self._load_configuration():
self.__module_enabled = False
return
if not self._check_requirements():
log('W29')
self.__module_enabled = False
return
# Initialize system connections and parameters
@ -129,7 +132,13 @@ class laps_applier(applier_frontend):
self.password_age_days = self.config.get('PasswordAgeDays', 30)
self.post_authentication_actions = self.config.get('PostAuthenticationActions', 3)
self.post_authentication_reset_delay = self.config.get('PostAuthenticationResetDelay', 24)
self.target_user = self.config.get('AdministratorAccountName', 'root')
name = self.config.get('AdministratorAccountName', 'root')
if check_local_user_exists(name):
self.target_user = name
else:
log('W36')
return False
return True
def _check_requirements(self):
"""

View File

@ -1055,6 +1055,9 @@ msgstr "Не удалось вычислить возраст пароля"
msgid "Failed to terminate process"
msgstr "Не удалось завершить процесс"
msgid "The user was not found to change the password"
msgstr "Пользователь для изменения пароля не был найден"
# Fatal
msgid "Unable to refresh GPO list"
msgstr "Невозможно обновить список объектов групповых политик"

View File

@ -391,6 +391,7 @@ def warning_code(code):
warning_ids[33] = 'Failed to get last login time'
warning_ids[34] = 'Failed to calculate password age'
warning_ids[35] = 'Failed to terminate process'
warning_ids[36] = 'The user was not found to change the password'
return warning_ids.get(code, 'Unknown warning code')