Date: Tue, 8 May 2001 00:33:24 -0700 From: Kris Kennaway <kris@obsecurity.org> To: audit@FreeBSD.org Subject: ipcs patch Message-ID: <20010508003324.A87133@xor.obsecurity.org>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
This is partly taken from OpenBSD, the fixes to the alignment of the
output are mine.
Kris
Index: ipcs.c
===================================================================
RCS file: /mnt/ncvs/src/usr.bin/ipcs/ipcs.c,v
retrieving revision 1.14
diff -u -r1.14 ipcs.c
--- ipcs.c 2000/05/01 10:49:41 1.14
+++ ipcs.c 2001/05/08 07:31:56
@@ -192,12 +192,17 @@
* Discard setgid privileges if not the running kernel so that bad
* guys can't print interesting stuff from kernel memory.
*/
- if (namelist != NULL || core != NULL)
+ if (namelist != NULL || core != NULL) {
+ setegid(getgid());
setgid(getgid());
+ }
if ((kd = kvm_open(namelist, core, NULL, O_RDONLY, "ipcs")) == NULL)
exit(1);
+ setegid(getgid());
+ setgid(getgid());
+
switch (kvm_nlist(kd, symbols)) {
case 0:
break;
@@ -240,7 +245,7 @@
kvm_read(kd, (u_long) msqids, xmsqids, sizeof(struct msqid_ds) * msginfo.msgmni);
printf("Message Queues:\n");
- printf("T ID KEY MODE OWNER GROUP");
+ printf("T ID KEY MODE OWNER GROUP");
if (option & CREATOR)
printf(" CREATOR CGROUP");
if (option & OUTSTANDING)
@@ -262,7 +267,7 @@
cvt_time(msqptr->msg_rtime, rtime_buf);
cvt_time(msqptr->msg_ctime, ctime_buf);
- printf("q %6d %10d %s %8s %8s",
+ printf("q %8d %10d %s %8s %8s",
IXSEQ_TO_IPCID(i, msqptr->msg_perm),
msqptr->msg_perm.key,
fmt_perm(msqptr->msg_perm.mode),
@@ -328,7 +333,7 @@
shminfo.shmmni);
printf("Shared Memory:\n");
- printf("T ID KEY MODE OWNER GROUP");
+ printf("T ID KEY MODE OWNER GROUP");
if (option & CREATOR)
printf(" CREATOR CGROUP");
if (option & OUTSTANDING)
@@ -350,7 +355,7 @@
cvt_time(shmptr->shm_dtime, dtime_buf);
cvt_time(shmptr->shm_ctime, ctime_buf);
- printf("m %6d %10d %s %8s %8s",
+ printf("m %8d %10d %s %8s %8s",
IXSEQ_TO_IPCID(i, shmptr->shm_perm),
shmptr->shm_perm.key,
fmt_perm(shmptr->shm_perm.mode),
@@ -424,7 +429,7 @@
kvm_read(kd, (u_long) sema, xsema, sizeof(struct semid_ds) * seminfo.semmni);
printf("Semaphores:\n");
- printf("T ID KEY MODE OWNER GROUP");
+ printf("T ID KEY MODE OWNER GROUP");
if (option & CREATOR)
printf(" CREATOR CGROUP");
if (option & BIGGEST)
@@ -440,7 +445,7 @@
cvt_time(semaptr->sem_otime, otime_buf);
cvt_time(semaptr->sem_ctime, ctime_buf);
- printf("s %6d %10d %s %8s %8s",
+ printf("s %8d %10d %s %8s %8s",
IXSEQ_TO_IPCID(i, semaptr->sem_perm),
semaptr->sem_perm.key,
fmt_perm(semaptr->sem_perm.mode),
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.5 (FreeBSD)
Comment: For info see http://www.gnupg.org
iD8DBQE696FEWry0BWjoQKURAnBdAKDbNKA2wwNZXVowqPA16pYD+ncdbACgjT4l
tCRhsTfvzTtf772nKTHH6yY=
=By7g
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010508003324.A87133>
