diff options
| author | Eric Biggers <ebiggers@google.com> | 2022-04-16 22:31:32 -0700 |
|---|---|---|
| committer | Eric Biggers <ebiggers3@gmail.com> | 2022-04-16 22:37:20 -0700 |
| commit | f0c1cae003dd216ba706d7ef14df83d311c82034 (patch) | |
| tree | 253576bb86950de1c760046ab3d38abfbff64c4f /pam/pam.go | |
| parent | 53dc5f37339f40e78cd0e91b358322cc9e589185 (diff) | |
Try to detect process being forked during PAM transaction
Update https://github.com/google/fscrypt/issues/350
Diffstat (limited to 'pam/pam.go')
| -rw-r--r-- | pam/pam.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -127,6 +127,15 @@ func (h *Handle) GetItem(i Item) (unsafe.Pointer, error) { return data, nil } +// GetServiceName retrieves the name of the application running the PAM transaction. +func (h *Handle) GetServiceName() string { + data, err := h.GetItem(Service) + if err != nil { + return "[unknown service]" + } + return C.GoString((*C.char)(data)) +} + // StartAsPamUser sets the effective privileges to that of the PAM user. func (h *Handle) StartAsPamUser() error { userPrivs, err := security.UserPrivileges(h.PamUser) |