mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-24 00:45:52 +00:00
Drop privileges before executing user commands
Submitted by: jedgar
This commit is contained in:
parent
394c5a75bd
commit
f3ea91ef96
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=25306
21
sysutils/ascpu/files/patch-sec01
Normal file
21
sysutils/ascpu/files/patch-sec01
Normal file
@ -0,0 +1,21 @@
|
||||
--- ascpu_x.c.orig Thu Dec 16 17:45:26 1999
|
||||
+++ ascpu_x.c Wed Dec 29 20:47:32 1999
|
||||
@@ -6,6 +6,7 @@
|
||||
* This software is distributed under GPL. For details see LICENSE file.
|
||||
*/
|
||||
|
||||
+#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@@ -585,6 +586,10 @@
|
||||
#ifdef DEBUG
|
||||
printf("ascpu: system(%s)\n",Command);
|
||||
#endif
|
||||
+ if (setgid(getgid()) != 0)
|
||||
+ err(1, "Can't drop setgid privileges");
|
||||
+ if (setuid(getuid()) != 0)
|
||||
+ err(1, "Can't drop setuid privileges");
|
||||
system( Command );
|
||||
}
|
||||
break;
|
Loading…
Reference in New Issue
Block a user