diff -cprN procps-2.0.4/proc/ksym.c procps/proc/ksym.c *** procps-2.0.4/proc/ksym.c Fri Mar 12 10:34:44 1999 --- procps/proc/ksym.c Thu May 4 11:03:13 2000 *************** int psdb = -1; *** 170,175 **** --- 170,178 ---- #endif int open_psdb(const char *override) { + /* FreeVSD: Don't even bother with the kernel System.map as it + is never going to exist. */ + #if 0 static char *sysmap_paths[] = { "/boot/System.map-%s", "/boot/System.map", *************** int open_psdb(const char *override) { *** 225,230 **** --- 228,234 ---- (int) sizeof db_hdr.magic, procps_version); close(psdb); } + #endif #endif return -1; } diff -cprN procps-2.0.4/proc/readproc.c procps/proc/readproc.c *** procps-2.0.4/proc/readproc.c Wed Sep 22 15:01:14 1999 --- procps/proc/readproc.c Thu May 4 11:03:13 2000 *************** char** file2strvec(char* directory, char *** 303,310 **** proc_t* readproc(PROCTAB* PT, proc_t* rbuf) { static struct direct *ent; /* dirent handle */ static struct stat sb; /* stat buffer */ ! static char path[32], sbuf[512]; /* bufs for stat,statm */ ! int allocated = 0, matched = 0; /* flags */ proc_t *p = NULL; /* loop until a proc matching restrictions is found or no more processes */ --- 303,310 ---- proc_t* readproc(PROCTAB* PT, proc_t* rbuf) { static struct direct *ent; /* dirent handle */ static struct stat sb; /* stat buffer */ ! static char path[32], temp1[32], sbuf[512]; /* bufs for stat,statm */ ! int fd, allocated = 0, matched = 0; /* flags */ proc_t *p = NULL; /* loop until a proc matching restrictions is found or no more processes */ *************** next_proc: /* get next PID for consid *** 332,337 **** --- 332,345 ---- if (Do(UID) && !XinLN(uid_t, sb.st_uid, PT->uids, PT->nuid)) goto next_proc; /* not one of the requested uids */ + /* FreeVSD: For chrooted environments we do not want a virtual server + seeing other processes on the system. */ + sprintf (temp1, "%s/root", path); + fd = open (temp1, O_RDONLY); + if (fd == -1) + goto next_proc; + close (fd); + if (!allocated) { /* assign mem for return buf */ p = rbuf ? rbuf : xcalloc(p, sizeof *p); /* passed buf or alloced mem */ allocated = 1; /* remember space is set up */ *************** next_proc: /* get next PID for consid *** 403,410 **** proc_t* ps_readproc(PROCTAB* PT, proc_t* rbuf) { static struct direct *ent; /* dirent handle */ static struct stat sb; /* stat buffer */ ! static char path[32], sbuf[512]; /* bufs for stat,statm */ ! int allocated = 0 /* , matched = 0 */ ; /* flags */ proc_t *p = NULL; /* loop until a proc matching restrictions is found or no more processes */ --- 411,418 ---- proc_t* ps_readproc(PROCTAB* PT, proc_t* rbuf) { static struct direct *ent; /* dirent handle */ static struct stat sb; /* stat buffer */ ! static char path[32], temp1[32], sbuf[512]; /* bufs for stat,statm */ ! int fd, allocated = 0 /* , matched = 0 */ ; /* flags */ proc_t *p = NULL; /* loop until a proc matching restrictions is found or no more processes */ *************** next_proc: /* get next PID for consid *** 423,428 **** --- 431,444 ---- if (stat(path, &sb) == -1) /* no such dirent (anymore) */ goto next_proc; + + /* FreeVSD: For chrooted environments we do not want a virtual server + seeing other processes on the system. */ + sprintf (temp1, "%s/root", path); + fd = open (temp1, O_RDONLY); + if (fd == -1) + goto next_proc; + close (fd); if (!allocated) { /* assign mem for return buf */ p = rbuf ? rbuf : xcalloc(p, sizeof *p); /* passed buf or alloced mem */ diff -cprN procps-2.0.4/ps/display.c procps/ps/display.c *** procps-2.0.4/ps/display.c Fri Sep 24 15:05:22 1999 --- procps/ps/display.c Wed May 17 06:51:09 2000 *************** static void fancy_spew(void){ *** 343,357 **** /***** no comment */ int main(int argc, char *argv[]){ - if(getuid()!=geteuid()){ - fprintf(stderr, "This /bin/ps is not secure for setuid operation."); - exit(1); - } - if(getgid()!=getegid()){ - fprintf(stderr, "This /bin/ps is not secure for setgid operation."); - exit(1); - } - #ifdef DEBUG init_stack_trace(argv[0]); #else --- 343,348 ---- diff -cprN procps-2.0.4/watch.c procps/watch.c *** procps-2.0.4/watch.c Tue Aug 31 17:43:44 1999 --- procps/watch.c Thu May 4 11:03:13 2000 *************** *** 19,24 **** --- 19,25 ---- #include #include #include + #undef ERR #include #include #include