Fix id -A when the subject has an extended subject token associated with
them (for example when they have logged in from an ip6 source). - Stick with the initial call to getaudit(2), if it returns E2BIG, use getaudit_addr(2) instead and set the "extended" flag to indicate that we the calling credential has an extended subject state. - Additionally, add the printing of the machine/at_addr (the ip/ip6 addresses) MFC after: 1 week Obtained from: TrustedBSD Project
This commit is contained in:
parent
3b49571934
commit
3a572f38ad
@ -313,14 +313,46 @@ void
|
||||
auditid(void)
|
||||
{
|
||||
auditinfo_t auditinfo;
|
||||
auditinfo_addr_t ainfo_addr;
|
||||
int ret, extended;
|
||||
|
||||
if (getaudit(&auditinfo) < 0)
|
||||
extended = 0;
|
||||
ret = getaudit(&auditinfo);
|
||||
if (ret < 0 && errno == E2BIG) {
|
||||
if (getaudit_addr(&ainfo_addr, sizeof(ainfo_addr)) < 0)
|
||||
err(1, "getaudit_addr");
|
||||
extended = 1;
|
||||
} else if (ret < 0)
|
||||
err(1, "getaudit");
|
||||
printf("auid=%d\n", auditinfo.ai_auid);
|
||||
printf("mask.success=0x%08x\n", auditinfo.ai_mask.am_success);
|
||||
printf("mask.failure=0x%08x\n", auditinfo.ai_mask.am_failure);
|
||||
printf("termid.port=0x%08x\n", auditinfo.ai_termid.port);
|
||||
printf("asid=%d\n", auditinfo.ai_asid);
|
||||
if (extended != 0) {
|
||||
(void) printf("auid=%d\n"
|
||||
"mask.success=0x%08x\n"
|
||||
"mask.failure=0x%08x\n"
|
||||
"asid=%d\n"
|
||||
"termid_addr.port=0x%08x\n"
|
||||
"termid_addr.addr[0]=0x%08x\n"
|
||||
"termid_addr.addr[1]=0x%08x\n"
|
||||
"termid_addr.addr[2]=0x%08x\n"
|
||||
"termid_addr.addr[3]=0x%08x\n",
|
||||
ainfo_addr.ai_auid, ainfo_addr.ai_mask.am_success,
|
||||
ainfo_addr.ai_mask.am_failure, ainfo_addr.ai_asid,
|
||||
ainfo_addr.ai_termid.at_port,
|
||||
ainfo_addr.ai_termid.at_addr[0],
|
||||
ainfo_addr.ai_termid.at_addr[1],
|
||||
ainfo_addr.ai_termid.at_addr[2],
|
||||
ainfo_addr.ai_termid.at_addr[3]);
|
||||
} else {
|
||||
(void) printf("auid=%d\n"
|
||||
"mask.success=0x%08x\n"
|
||||
"mask.failure=0x%08x\n"
|
||||
"asid=%d\n"
|
||||
"termid.port=0x%08x\n"
|
||||
"termid.machine=0x%08x\n",
|
||||
auditinfo.ai_auid, auditinfo.ai_mask.am_success,
|
||||
auditinfo.ai_mask.am_failure,
|
||||
auditinfo.ai_asid, auditinfo.ai_termid.port,
|
||||
auditinfo.ai_termid.machine);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user