Use the current process's credentials rather than socket's cached.

If the process drops its super-user privileges, we certainly don't
want to allow it to modify routing tables.

Discussed with:	rwatson
This commit is contained in:
Ruslan Ermilov 2001-09-20 08:25:25 +00:00
parent 68176c8544
commit dadb6c3bb0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83711

View File

@ -331,8 +331,8 @@ route_output(m, so)
* Verify that the caller has the appropriate privilege; RTM_GET
* is the only operation the non-superuser is allowed.
*/
if (rtm->rtm_type != RTM_GET && suser_xxx(so->so_cred, NULL, 0) != 0)
senderr(EPERM);
if (rtm->rtm_type != RTM_GET && (error = suser(curproc)) != 0)
senderr(error);
switch (rtm->rtm_type) {