glibtop_get_proc_map on Linux doesn't need to be SUID.

Revert this proof of concept.
Add C file with comments to document how to make a call SUID.
This commit is contained in:
Benoît Dejean
2018-03-26 18:14:58 +02:00
parent ec662d01da
commit e4335d4db2
3 changed files with 337 additions and 11 deletions

View File

@@ -30,7 +30,6 @@
#include <stddef.h>
#include "glibtop_private.h"
#include "glibtop_suid.h"
#include "procmap_smaps.c"
@@ -61,7 +60,7 @@ static const unsigned long _glibtop_sysdeps_map_entry_smaps =
/* Init function. */
void
_glibtop_init_proc_map_p (glibtop *server)
_glibtop_init_proc_map_s (glibtop *server)
{
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
}
@@ -185,7 +184,7 @@ parse_line(char* line,
glibtop_map_entry *
glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, pid_t pid)
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
{
char procfilename[GLIBTOP_MAP_FILENAME_LEN+1];
@@ -215,17 +214,10 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, pid_t pid)
snprintf (procfilename, sizeof procfilename, filename, (unsigned)pid);
glibtop_suid_enter (server);
if((maps = fopen (procfilename, "r")) == NULL) {
glibtop_suid_leave (server);
return (glibtop_map_entry*) g_array_free(entry_list, TRUE);
}
glibtop_debug("opened %p", maps);
glibtop_suid_leave (server);
while(TRUE)
{
unsigned long perm;