PERFORCE change 160214 for review
Robert Watson
rwatson at FreeBSD.org
Sun Apr 5 12:40:39 PDT 2009
On Sat, 4 Apr 2009, Christian S.J. Peron wrote:
> - if (getaudit_addr(&aia, sizeof(aia) < 0)
> + error = getaudit_addr(&aia, sizeof(aia));
> + if (error < 0 && errno == ENOSYS) {
> + error = getaudit(&ai);
> + if (error < 0)
> + err(1, "getaudit");
> + aid = ai.ai_auid;
> + } else if (error < 0)
> err(1, "getaudit_addr");
> - error = audit_submit(AUE_su, aia.ai_auid, EPERM, 1,
> + else
> + aid = aia.ai_auid;
> + error = audit_submit(AUE_su, aid, EPERM, 1,
> "bad su from %s to %s", from_login, to_login);
Something like this would be simpler, given that all they need is the auid:
error = getauid(&auid);
if (error == 0) {
if (audit_submit(AUE_su, auid, EPERM, 1,
"bad su from %s to %s", from_login, to_login) < < 0)
err(1 "audit_submit");
} else if (errno != ENOSYS)
err(1, "getauid");
But then I'd explicitly point out that it's safe to call audit_submit() with
an invalid auid.
Robert N M Watson
Computer Laboratory
University of Cambridge
More information about the p4-projects
mailing list