1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

- Fix build on HEAD.

- Do not allow the user to send signals to arbitrary processes if
  setuid binary is used.

PR:		ports/141852
Submitted by:	Denis Barov <dindin@dindin.ru>
Security:	http://www.freebsd.org/ports/portaudit/4d6076fe-ee7a-11de-9cd0-001a926c7637.html
This commit is contained in:
Stanislav Sedov 2009-12-21 21:49:39 +00:00
parent 17bb5918e7
commit c3c507c2cf
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=246395
3 changed files with 47 additions and 2 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= fuser
PORTVERSION= 1142334561
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= http://mbsd.msk.ru/dist/
@ -32,7 +32,7 @@ EXTRA_PATCHES+= ${FILESDIR}/extra::patch-fuser.c \
EXTRA_PATCHES+= ${FILESDIR}/extra::patch-msdosfs.c
.endif
.if ${OSVERSION} >= 800101
BROKEN= does not compile on 8.X
EXTRA_PATCHES+= ${FILESDIR}/extra::patch-nfs.c
.endif
do-install:

View File

@ -0,0 +1,10 @@
--- nfs.c.orig 2009-12-21 13:33:10.000000000 -0800
+++ nfs.c 2009-12-21 13:33:22.000000000 -0800
@@ -44,7 +44,6 @@
#include <sys/mount.h>
#include <nfs/nfsproto.h>
-#include <nfs/rpcv2.h>
#include <nfsclient/nfs.h>
#include <nfsclient/nfsnode.h>

View File

@ -0,0 +1,35 @@
--- fuser.c.orig 2006-03-14 14:07:08.000000000 +0300
+++ fuser.c 2009-12-21 22:51:33.000000000 +0300
@@ -608,6 +608,7 @@
char *ep;
char *kernimg = NULL; /* We are using curr. sys by default */
char *mcore = NULL;
+ int retvalue = 0;
while ((ch = getopt(argc, argv, "C:K:cfkms:u")) != -1)
switch(ch) {
@@ -696,8 +697,13 @@
if (ufl != 0) {
print_file_info(pinfo->pid, \
pinfo->uid, ufl);
- if ((flags & KFLAG) != 0)
- (void)kill(pinfo->pid, sig);
+ if ((flags & KFLAG) != 0) {
+ if (geteuid() == getuid() || pinfo->uid == getuid()) {
+ (void)kill(pinfo->pid, sig);
+ } else {
+ retvalue = 1;
+ }
+ }
}
}
(void)fprintf(stderr, "\n");
@@ -707,7 +713,7 @@
SLIST_FREE(&prclist, next, pinfo_free);
(void)kvm_close(kd);
- return 0;
+ return retvalue;
}