mirror of
https://git.FreeBSD.org/src.git
synced 2026-06-02 11:24:32 +00:00
netlink: use caller's credentials in rtnl_handle_newlink
Make sure rtnl_handle_newlink sets the caller's credential during calls to ifc_create_ifp_nl and ifc_modify_ifp_nl Reviewed by: glebius, melifaro Approved by: glebius (mentor) Differential Revision: https://reviews.freebsd.org/D54109
This commit is contained in:
@@ -675,6 +675,8 @@ static int
|
||||
rtnl_handle_newlink(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *npt)
|
||||
{
|
||||
struct nlattr_bmask bm;
|
||||
struct thread *td = curthread;
|
||||
struct ucred *cred;
|
||||
int error;
|
||||
|
||||
struct nl_parsed_link attrs = {};
|
||||
@@ -683,10 +685,16 @@ rtnl_handle_newlink(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *n
|
||||
return (error);
|
||||
nl_get_attrs_bmask_nlmsg(hdr, &ifmsg_parser, &bm);
|
||||
|
||||
/* XXX: temporary patch until the D39180 review lands */
|
||||
cred = td->td_ucred;
|
||||
td->td_ucred = nlp_get_cred(nlp);
|
||||
if (hdr->nlmsg_flags & NLM_F_CREATE)
|
||||
return (create_link(hdr, &attrs, &bm, nlp, npt));
|
||||
error = create_link(hdr, &attrs, &bm, nlp, npt);
|
||||
else
|
||||
return (modify_link(hdr, &attrs, &bm, nlp, npt));
|
||||
error = modify_link(hdr, &attrs, &bm, nlp, npt);
|
||||
td->td_ucred = cred;
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user