Replaced glibtop_init_r' with
glibtop_init_s'.
1998-07-24 Martin Baulig <martin@home-of-linux.org> * sysdeps/{kernel, linux}/*.c: Replaced `glibtop_init_r' with `glibtop_init_s'. * sysdeps/sun4/open.c (glibtop_init_p): Removed `program_name' parameter. * sysdeps/osf1/glibtop_suid.h: New file. * sysdeps/osf1/glibtop_server.h: Now correctly using `(1 << GLIBTOP_SYSDEPS_*)' instead of `GLIBTOP_SYSDEPS_*'. * sysdeps/osf1/open_suid.c (glibtop_init_p): New function. * sysdeps/osf1/proc*.c: Done some more work here.
This commit is contained in:
committed by
Martin Baulig
parent
51c5c3ac22
commit
f3f051ecba
@@ -19,9 +19,11 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/procuid.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/table.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
@@ -47,20 +49,19 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
|
||||
int ret, info_count;
|
||||
task_t thistask;
|
||||
|
||||
glibtop_open_p (server, 0, 0);
|
||||
glibtop_init_p (server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
|
||||
/* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
setreuid (server->machine.uid, server->machine.euid);
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
ret = table (TBL_PROCINFO, pid, (char *) &procinfo, 1,
|
||||
sizeof (struct tbl_procinfo));
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
if (setreuid (server->machine.euid, server->machine.uid))
|
||||
_exit (1);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
if (ret != 1) return;
|
||||
@@ -81,7 +82,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
|
||||
|
||||
/* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
setreuid (server->machine.uid, server->machine.euid);
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
/* Get task structure. */
|
||||
|
||||
@@ -95,12 +96,12 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
|
||||
|
||||
ret = task_info (thistask, TASK_BASIC_INFO,
|
||||
(task_info_t) &taskinfo, &info_count);
|
||||
|
||||
|
||||
/* `ret' is evaluated outside the `if' clause. */
|
||||
}
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
if (setreuid (server->machine.euid, server->machine.uid))
|
||||
_exit (1);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
if (ret != KERN_SUCCESS) return;
|
||||
|
Reference in New Issue
Block a user