Date: Wed, 22 Nov 2006 15:28:37 GMT From: "Christian S.J. Peron" <csjp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 110392 for review Message-ID: <200611221528.kAMFSbkS083196@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=110392 Change 110392 by csjp@csjp_xor on 2006/11/22 15:27:54 Include code that should have come in my previous submit Affected files ... .. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_syscalls.c#27 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_syscalls.c#27 (text+ko) ==== @@ -329,14 +329,19 @@ if ((tp = pfind(udata.au_aupinfo.ap_pid)) == NULL) return (EINVAL); + if (tp->p_au->ai_termid.at_type == AU_IPv6) { + PROC_UNLOCK(tp); + return (EINVAL); + } udata.au_aupinfo.ap_auid = tp->p_au->ai_auid; udata.au_aupinfo.ap_mask.am_success = tp->p_au->ai_mask.am_success; udata.au_aupinfo.ap_mask.am_failure = tp->p_au->ai_mask.am_failure; udata.au_aupinfo.ap_termid.machine = - tp->p_au->ai_termid.machine; - udata.au_aupinfo.ap_termid.port = tp->p_au->ai_termid.port; + tp->p_au->ai_termid.at_addr[0]; + udata.au_aupinfo.ap_termid.port = + (dev_t)tp->p_au->ai_termid.at_port; udata.au_aupinfo.ap_asid = tp->p_au->ai_asid; PROC_UNLOCK(tp); break; @@ -369,7 +374,18 @@ break; case A_GETPINFO_ADDR: - return (ENOSYS); + if (udata.au_aupinfo_addr.ap_pid < 1) + return (EINVAL); + if ((tp = pfind(udata.au_aupinfo_addr.ap_pid)) == NULL) + return (EINVAL); + udata.au_aupinfo_addr.ap_auid = tp->p_au->ai_auid; + udata.au_aupinfo_addr.ap_mask.am_success = + tp->p_au->ai_mask.am_success; + udata.au_aupinfo_addr.ap_mask.am_failure = + tp->p_au->ai_mask.am_failure; + udata.au_aupinfo_addr.ap_termid = tp->p_au->ai_termid; + udata.au_aupinfo_addr.ap_asid = tp->p_au->ai_asid; + PROC_UNLOCK(tp); break; case A_GETKAUDIT: @@ -507,7 +523,15 @@ return (error); PROC_LOCK(td->td_proc); - ai = *td->td_proc->p_au; + if (td->td_proc->p_au->ai_termid.at_type == AU_IPv6) { + PROC_UNLOCK(td->td_proc); + return (E2BIG); + } + ai.ai_auid = td->td_proc->p_au->ai_auid; + ai.ai_mask = td->td_proc->p_au->ai_mask; + ai.ai_asid = td->td_proc->p_au->ai_asid; + ai.ai_termid.machine = td->td_proc->p_au->ai_termid.at_addr[0]; + ai.ai_termid.port = td->td_proc->p_au->ai_termid.at_port; PROC_UNLOCK(td->td_proc); return (copyout(&ai, uap->auditinfo, sizeof(ai))); @@ -541,7 +565,12 @@ * XXXRW: Test privilege while holding the proc lock? */ PROC_LOCK(td->td_proc); - *td->td_proc->p_au = ai; + td->td_proc->p_au->ai_auid = ai.ai_auid; + td->td_proc->p_au->ai_mask = ai.ai_mask; + td->td_proc->p_au->ai_asid = ai.ai_asid; + td->td_proc->p_au->ai_termid.at_addr[0] = ai.ai_termid.machine; + td->td_proc->p_au->ai_termid.at_port = ai.ai_termid.port; + td->td_proc->p_au->ai_termid.at_type = AU_IPv4; PROC_UNLOCK(td->td_proc); return (0); @@ -552,6 +581,7 @@ int getaudit_addr(struct thread *td, struct getaudit_addr_args *uap) { + struct auditinfo_addr aia; int error; #ifdef MAC @@ -563,7 +593,12 @@ error = suser(td); if (error) return (error); - return (ENOSYS); + if (uap->length < sizeof(aia)) + return (EOVERFLOW); + PROC_LOCK(td->td_proc); + aia = *td->td_proc->p_au; + PROC_UNLOCK(td->td_proc); + return (copyout(&aia, uap->auditinfo_addr, sizeof(aia))); } /* MPSAFE */ @@ -571,6 +606,7 @@ int setaudit_addr(struct thread *td, struct setaudit_addr_args *uap) { + struct auditinfo_addr aia; int error; error = suser(td); @@ -582,8 +618,13 @@ if (error) return (error); #endif - - return (ENOSYS); + error = copyin(uap->auditinfo_addr, &aia, sizeof(aia)); + if (error) + return (error); + PROC_LOCK(td->td_proc); + *td->td_proc->p_au = aia; + PROC_UNLOCK(td->td_proc); + return (error); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611221528.kAMFSbkS083196>