Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Dec 2001 18:26:23 +0600
From:      "Eugene Panchenko" <replicator@ngs.ru>
To:        hackers@freebsd.org
Subject:   Hiding other processes
Message-ID:  <web-7584539@intranet.ru>

next in thread | raw e-mail | index | archive | help
Hello!

I know about sysctl "kern.ps_showallprocs", but it is not
very convenient because in this case only root will be able
to see all processes, and I want to wheel group to see them
all as well.  I modified kern_proc.c a bit, could you please
comment on it, and say will it work or not, and how should I
(if I should) possibly rewrite it?

Thank you a lot!

--- /sys/kern/kern_proc.c Tue May 1 20:39:06 2001
+++ kern_proc.c Fri Dec 28 21:00:11 2001
@@ -476,10 +476,14 @@
  p = LIST_FIRST(&zombproc);
  for (; p != 0; p = LIST_NEXT(p, p_list)) {
  /*
- * Show a user only their processes.
+ * Show a user only their processes
+ * unless he/she is in wheel group (gid = 0).
  */
- if ((!ps_showallprocs) && p_trespass(curproc, p))
- continue;
+ if (((!ps_showallprocs) ||
+ (curproc->p_ucred == NULL ||
+ curproc->p_ucred->cr_gid != (gid_t)0))
+ && p_trespass(curproc, p)
+ continue;
  /*
  * Skip embryonic processes.
  */


____________________________________________________________
Скоро Новый Год? Сделайте себе подарок - http://ngs.ru/tovar





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?web-7584539>