auth: assert username (#604)

This commit is contained in:
Maximilian Seidler 2024-12-23 20:53:27 +00:00 committed by GitHub
parent 5361dc40da
commit bf37645daa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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";