mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
kern_exec.c: Add execve_nosetid() helper
(cherry picked from commit 19e6043a44)
This commit is contained in:
parent
a3a907abbf
commit
0379dc900e
1 changed files with 11 additions and 5 deletions
|
|
@ -353,6 +353,16 @@ kern_execve(struct thread *td, struct image_args *args, struct mac *mac_p,
|
|||
return (do_execve(td, args, mac_p, oldvmspace));
|
||||
}
|
||||
|
||||
static void
|
||||
execve_nosetid(struct image_params *imgp)
|
||||
{
|
||||
imgp->credential_setid = false;
|
||||
if (imgp->newcred != NULL) {
|
||||
crfree(imgp->newcred);
|
||||
imgp->newcred = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* In-kernel implementation of execve(). All arguments are assumed to be
|
||||
* userspace pointers from the passed thread.
|
||||
|
|
@ -639,11 +649,7 @@ interpret:
|
|||
vput(newtextvp);
|
||||
vm_object_deallocate(imgp->object);
|
||||
imgp->object = NULL;
|
||||
imgp->credential_setid = false;
|
||||
if (imgp->newcred != NULL) {
|
||||
crfree(imgp->newcred);
|
||||
imgp->newcred = NULL;
|
||||
}
|
||||
execve_nosetid(imgp);
|
||||
imgp->execpath = NULL;
|
||||
free(imgp->freepath, M_TEMP);
|
||||
imgp->freepath = NULL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue