Skip to content

Commit

Permalink
Fix pam SIGSEGV. (#280)
Browse files Browse the repository at this point in the history
Signed-off-by: RileyW <[email protected]>
  • Loading branch information
RileyWen authored Jun 18, 2024
1 parent 4af06fd commit 63a3024
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Craned/CgroupManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ bool CgroupManager::QueryTaskInfoOfUidAsync(uid_t uid, TaskInfoOfUid *info) {
bool CgroupManager::MigrateProcToCgroupOfTask(pid_t pid, task_id_t task_id) {
Cgroup *cg;
bool ok = AllocateAndGetCgroup(task_id, &cg);
if (cg == nullptr) return false;
if (!ok) return false;

return cg->MigrateProcIn(pid);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Misc/Pam/Pam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ extern "C" {
ok = GrpcMigrateSshProcToCgroup(pamh, getpid(), task_id);
if (ok)
return PAM_SUCCESS;
else
else {
PamSendMsgToClient(pamh, "Rejected by CraneD PAM Module.");
return PAM_SESSION_ERR;
}
} else {
// If auth result is false, it indicates that system administrator allow a
// user with no task running to log in, and then we just let it pass.
Expand Down

0 comments on commit 63a3024

Please sign in to comment.