From bf37645daa83185c6570aacae9e309ab8b7c92b3 Mon Sep 17 00:00:00 2001 From: Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:53:27 +0000 Subject: [PATCH] auth: assert username (#604) --- src/auth/Pam.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/auth/Pam.cpp b/src/auth/Pam.cpp index 479de4e..2ea4b04 100644 --- a/src/auth/Pam.cpp +++ b/src/auth/Pam.cpp @@ -109,8 +109,9 @@ bool CPam::auth() { const pam_conv localConv = {conv, (void*)&m_sConversationState}; pam_handle_t* handle = NULL; auto uidPassword = getpwuid(getuid()); + RASSERT(uidPassword && uidPassword->pw_name, "Failed to get username (getpwuid)"); - int ret = pam_start(m_sPamModule.c_str(), uidPassword->pw_name, &localConv, &handle); + int ret = pam_start(m_sPamModule.c_str(), uidPassword->pw_name, &localConv, &handle); if (ret != PAM_SUCCESS) { m_sConversationState.failText = "pam_start failed";