From owner-freebsd-audit Sun May 20 4: 2:32 2001 Delivered-To: freebsd-audit@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id D6CB937B424; Sun, 20 May 2001 04:02:13 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.2/8.11.2) id f4KB29n04567; Sun, 20 May 2001 14:02:09 +0300 (EEST) (envelope-from ru) Date: Sun, 20 May 2001 14:02:09 +0300 From: Ruslan Ermilov To: sobomax@FreeBSD.org Cc: nik@FreeBSD.org, audit@FreeBSD.org, arch@FreeBSD.org Subject: Re: Integrating new scrshot(1) utility into vidcontrol(1) [patch for review] Message-ID: <20010520140209.C3338@sunbay.com> Mail-Followup-To: sobomax@FreeBSD.org, nik@FreeBSD.org, audit@FreeBSD.org, arch@FreeBSD.org References: <200105182342.f4INgJx36064@mail.uic-in.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200105182342.f4INgJx36064@mail.uic-in.net>; from sobomax@mail-in.net on Sat, May 19, 2001 at 02:42:28AM +0300 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, May 19, 2001 at 02:42:28AM +0300, Maxim Sobolev wrote: > Ok, as it was agreed I've integrated scrshot(1) into > vidcontrol(1) and also added ability to dump contents > of display buffer in plain text format, so you don't > even need a special utility to see what's going on > on a console of display-less machine. :-) > > Please somebody review attached patches (esp. manpage). > Thank you! > > -Maxim > > Index: vidcontrol.1 > =================================================================== > RCS file: /home/ncvs/src/usr.sbin/vidcontrol/vidcontrol.1,v > retrieving revision 1.34 > diff -d -u -r1.34 vidcontrol.1 > --- vidcontrol.1 2001/04/18 15:51:56 1.34 > +++ vidcontrol.1 2001/05/18 23:32:37 > @@ -36,6 +36,8 @@ > .Op Fl M Ar char > .Op Fl m Cm on | off > .Op Fl r Ar foreground Ar background > +.Op Fl p > +.Op Fl P > .Op Fl s Ar number > .Op Fl t Ar N | Cm off > .Op Fl x > Sort these (put them before `r'). > @@ -185,6 +187,21 @@ > Used together with the > .Xr moused 8 > daemon for text mode cut & paste functionality. > +.It Fl p > +Capture the current contents of the video buffer corresponding > +to the terminal device referred to by standard input. > +.Nm > +writes contents of the video buffer to the standard > +output in a raw binary format. For details about that ^^ Always start a new sentence with a new line. Don't even use two spaces (though it's valid). Using two spaces, while technically speaking is right, complicates verifying of the document. Often, two spaces are put by mistake, and produce weird results. Always starting a new sentence with a new line significantly helps to debug such problems, not to say to a) speed up the proccessing and b) save the disk space. > +.Ss Format of Video Buffer Dump > If assume this hunk was simply copied from the original manpage, so it doesn't need a review. > .Sh SEE ALSO > .Xr kbdcontrol 1 , > .Xr vidfont 1 , > @@ -339,5 +468,13 @@ > .Xr rc.conf 5 , > .Xr kldload 8 , > .Xr moused 8 > +.Xr watch 8 > Missing comma after "Xr moused 8". > .Sh AUTHORS > .An S\(/oren Schmidt Aq sos@FreeBSD.org > I think Nik deserves the credits here. > @@ -70,8 +75,8 @@ > fprintf(stderr, "%s\n%s\n%s\n%s\n", > "usage: vidcontrol [-r fg bg] [-b color] [-c appearance] [-d] [-l scrmap]", > " [-i adapter | mode] [-L] [-M char] [-m on|off]", > -" [-f size file] [-s number] [-t N|off] [-x] [-g geometry]", > -" [mode] [fgcol [bgcol]] [show]"); > +" [-f size file] [-s number] [-t N|off] [-x] [-g geometry]", > +" [-p] [-P] [mode] [fgcol [bgcol]] [show]"); > exit(1); > } Similarly, sort this. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun May 20 6: 2:49 2001 Delivered-To: freebsd-audit@freebsd.org Received: from nothing-going-on.demon.co.uk (pc-62-31-42-140-hy.blueyonder.co.uk [62.31.42.140]) by hub.freebsd.org (Postfix) with ESMTP id CC35337B424; Sun, 20 May 2001 06:02:42 -0700 (PDT) (envelope-from nik@nothing-going-on.demon.co.uk) Received: (from nik@localhost) by nothing-going-on.demon.co.uk (8.11.3/8.11.3) id f4KCtiK26571; Sun, 20 May 2001 13:55:44 +0100 (BST) (envelope-from nik) Date: Sun, 20 May 2001 13:55:44 +0100 From: Nik Clayton To: sobomax@FreeBSD.org, nik@FreeBSD.org, audit@FreeBSD.org, arch@FreeBSD.org Subject: Re: Integrating new scrshot(1) utility into vidcontrol(1) [patch for review] Message-ID: <20010520135543.A25841@catkin.nothing-going-on.org> References: <200105182342.f4INgJx36064@mail.uic-in.net> <20010520140209.C3338@sunbay.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010520140209.C3338@sunbay.com>; from ru@FreeBSD.org on Sun, May 20, 2001 at 02:02:09PM +0300 Organization: FreeBSD Project Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, May 20, 2001 at 02:02:09PM +0300, Ruslan Ermilov wrote: > > .Sh AUTHORS > > .An S\(/oren Schmidt Aq sos@FreeBSD.org > >=20 > I think Nik deserves the credits here. Nope. Joel Holveck wrote the original ioctl implementation, and the first version of scrshot. I just forwarded ported them to -current, extended scrshot slightly, and wrote the man page. N --=20 FreeBSD: The Power to Serve http://www.freebsd.org/ FreeBSD Documentation Project http://www.freebsd.org/docproj/ --- 15B8 3FFC DDB4 34B0 AA5F 94B7 93A8 0764 2C37 E375 --- --G4iJoqBmSsgzjUCe Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.5 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjsHvs8ACgkQk6gHZCw343XvsACghRgUq5pwzJ/9niKhUrh+FFGC ONYAn0uvtz5agw/Eo78f1tLDYUjDowp9 =eNUy -----END PGP SIGNATURE----- --G4iJoqBmSsgzjUCe-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun May 20 6:12:49 2001 Delivered-To: freebsd-audit@freebsd.org Received: from nothing-going-on.demon.co.uk (pc-62-31-42-140-hy.blueyonder.co.uk [62.31.42.140]) by hub.freebsd.org (Postfix) with ESMTP id 6396837B424; Sun, 20 May 2001 06:12:42 -0700 (PDT) (envelope-from nik@nothing-going-on.demon.co.uk) Received: (from nik@localhost) by nothing-going-on.demon.co.uk (8.11.3/8.11.3) id f4KD7lG26613; Sun, 20 May 2001 14:07:48 +0100 (BST) (envelope-from nik) Date: Sun, 20 May 2001 14:07:47 +0100 From: Nik Clayton To: sobomax@FreeBSD.ORG Cc: nik@FreeBSD.ORG, ru@FreeBSD.ORG, audit@FreeBSD.ORG, arch@FreeBSD.ORG Subject: Re: Integrating new scrshot(1) utility into vidcontrol(1) [patch for review] Message-ID: <20010520140747.B25841@catkin.nothing-going-on.org> References: <20010519194435.A22224@catkin.nothing-going-on.org> <200105191939.f4JJdjr00870@mail.uic-in.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="b5gNqxB1S1yM7hjW" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200105191939.f4JJdjr00870@mail.uic-in.net>; from sobomax@mail-in.net on Sat, May 19, 2001 at 10:39:47PM +0300 Organization: FreeBSD Project Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --b5gNqxB1S1yM7hjW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 19, 2001 at 10:39:47PM +0300, Maxim Sobolev wrote: > BTW, I think that the kernel's part of this feature has > to be extended to dump not only visible portion of the > screen buffer, but the whole history buffer as well. What > do you think? Shouldn't be too hard.=20 (a) It should be optional, either as a flag to the existing ioctl, or as a new ioctl. (b) CONS_GETINFO will need to be extended (or we need a new ioctl for the scrollback) to include information about how big the scrollback buffer is. (c) It might be worth providing a mechanism to let the application specify a rectangular window that it wants to grab from the buffer. I'm a bit busy most of this week, but I might be able to do this toward the end of the week. N --=20 FreeBSD: The Power to Serve http://www.freebsd.org/ FreeBSD Documentation Project http://www.freebsd.org/docproj/ --- 15B8 3FFC DDB4 34B0 AA5F 94B7 93A8 0764 2C37 E375 --- --b5gNqxB1S1yM7hjW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.5 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjsHwaMACgkQk6gHZCw343W2jwCeKrsTl/RAQLL0rPfCXMH5xQAW YmgAnR1jKRr+kt1eFZeqx5Wr5lWRr2Ub =BHUD -----END PGP SIGNATURE----- --b5gNqxB1S1yM7hjW-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun May 20 10:57:15 2001 Delivered-To: freebsd-audit@freebsd.org Received: from gw.nectar.com (gw.nectar.com [208.42.49.153]) by hub.freebsd.org (Postfix) with ESMTP id 830A237B424 for ; Sun, 20 May 2001 10:57:13 -0700 (PDT) (envelope-from nectar@nectar.com) Received: by gw.nectar.com (Postfix, from userid 1001) id 0869518C93; Sun, 20 May 2001 12:57:12 -0500 (CDT) Date: Sun, 20 May 2001 12:57:12 -0500 From: "Jacques A. Vidrine" To: Kris Kennaway Cc: audit@FreeBSD.org Subject: Re: dd BDECFLAGS cleanup Message-ID: <20010520125712.B22932@spawn.nectar.com> References: <20010519213137.A13195@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010519213137.A13195@xor.obsecurity.org>; from kris@obsecurity.org on Sat, May 19, 2001 at 09:31:37PM -0700 X-Url: http://www.nectar.com/ Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, May 19, 2001 at 09:31:37PM -0700, Kris Kennaway wrote: > =================================================================== > RCS file: /home/ncvs/src/bin/dd/args.c,v > retrieving revision 1.27 > diff -u -r1.27 args.c > --- args.c 2000/10/22 23:00:32 1.27 > +++ args.c 2001/05/20 04:22:30 > @@ -168,8 +168,8 @@ > /* > * Bail out if the calculation of a file offset would overflow. > */ > - if (in.offset > QUAD_MAX / in.dbsz || out.offset > QUAD_MAX / out.dbsz) > - errx(1, "seek offsets cannot be larger than %qd", QUAD_MAX); > + if ((unsigned long long)in.offset > QUAD_MAX / in.dbsz || (unsigned long long)out.offset > QUAD_MAX / out.dbsz) > + errx(1, "seek offsets cannot be larger than %lld", (long long)QUAD_MAX); > } > > static int How about `(off_t)in.dbsz' and so on instead? There is no `long long' in C89, though there is in C99. Are we leaving C89 compatibility already? On the other hand, I don't know what to do with the format strings. Cheers, -- Jacques Vidrine / n@nectar.com / jvidrine@verio.net / nectar@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun May 20 13:16:39 2001 Delivered-To: freebsd-audit@freebsd.org Received: from kalaid.f2f.com.ua (kalaid.f2f.com.ua [62.149.0.33]) by hub.freebsd.org (Postfix) with ESMTP id 1685B37B42C; Sun, 20 May 2001 13:16:29 -0700 (PDT) (envelope-from sobomax@mail-in.net) Received: from mail.uic-in.net (root@[212.35.189.4]) by kalaid.f2f.com.ua (8.11.3/8.11.1) with ESMTP id f4KKHpa98928; Sun, 20 May 2001 23:17:52 +0300 (EEST) (envelope-from sobomax@mail-in.net) Received: from notebook.vega.com (das0-l77.uic-in.net [212.35.189.204]) by mail.uic-in.net (8.11.3/8.11.3) with ESMTP id f4KKGDS00936; Sun, 20 May 2001 23:16:14 +0300 (EEST) (envelope-from sobomax@mail-in.net) Date: Sun, 20 May 2001 23:16:14 +0300 (EEST) Message-Id: <200105202016.f4KKGDS00936@mail.uic-in.net> To: nik@FreeBSD.ORG Cc: nik@FreeBSD.ORG, ru@FreeBSD.ORG, audit@FreeBSD.ORG, arch@FreeBSD.ORG From: Maxim Sobolev Reply-To: sobomax@FreeBSD.ORG Subject: Re: Integrating new scrshot(1) utility into vidcontrol(1) [patch for review] X-Mailer: Pygmy (v0.5.8) In-Reply-To: <20010520140747.B25841@catkin.nothing-going-on.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 20 May 2001 14:07:47 +0100, Nik Clayton wrote: > On Sat, May 19, 2001 at 10:39:47PM +0300, Maxim Sobolev wrote: > > BTW, I think that the kernel's part of this feature has > > to be extended to dump not only visible portion of the > > screen buffer, but the whole history buffer as well. What > > do you think? > > Shouldn't be too hard. > > (a) It should be optional, either as a flag to the existing ioctl, or > as a new ioctl. I would vote for the former. In fact, it could be merged with (c) below, i.e. ioctl extended to allow application fill in a dimension of a rectangular window that it want to grab, so for example, specifying 80x24 for 80x24 text mode will give you current content of the terminal, while 80x25 - current content of the terminal plus one line from the history buffer and so on. This would prevent unnecessary API cluter. > (b) CONS_GETINFO will need to be extended (or we need a new ioctl for > the scrollback) to include information about how big the scrollback > buffer is. I am voting for extending. We already have quite large number of syscons specific ioctls and probably don't really need a new one in this case. I also would like to extend information returned by this ioctl to include information about font size used by the current video mode, which AFAIK currently is not possible to get from userland. Perhaps we could co-ordinate somehow to minimise cosequences of ABI breakage. > (c) It might be worth providing a mechanism to let the application > specify a rectangular window that it wants to grab from the buffer. -Maxim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun May 20 13:37: 3 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id C6BFE37B424 for ; Sun, 20 May 2001 13:37:01 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from spike.unixfreak.org (spike [63.198.170.139]) by bazooka.unixfreak.org (Postfix) with ESMTP id 7C6143E0B for ; Sun, 20 May 2001 13:37:01 -0700 (PDT) To: audit@freebsd.org Subject: Re: Short patch to id(1) In-Reply-To: <71618.990185166@axl.fw.uunet.co.za>; from sheldonh@uunet.co.za on "Fri, 18 May 2001 13:26:06 +0200" Date: Sun, 20 May 2001 13:37:01 -0700 From: Dima Dorfman Message-Id: <20010520203701.7C6143E0B@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Sheldon Hearn writes: > > > On Thu, 17 May 2001 22:26:35 MST, Dima Dorfman wrote: > > > - fmt = " %u"; > > + fmt = ", %u"; > > Doesn't need a security audit. Thanks, but I wanted to check here just in case someone thinks this would be the end of the world. I've seen week-long threads erupt out of something like this, and if it had to happen I'd rather it be here than cvs-all. Besides, I'm not officially a src/ committer, so anything I commit there other than man pages should be reviewed or approved by someone else. Thanks again, Dima Dorfman dima@unixfreak.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun May 20 14:32:51 2001 Delivered-To: freebsd-audit@freebsd.org Received: from nothing-going-on.demon.co.uk (pc-62-31-42-140-hy.blueyonder.co.uk [62.31.42.140]) by hub.freebsd.org (Postfix) with ESMTP id 7BB5C37B424; Sun, 20 May 2001 14:32:44 -0700 (PDT) (envelope-from nik@nothing-going-on.demon.co.uk) Received: (from nik@localhost) by nothing-going-on.demon.co.uk (8.11.3/8.11.3) id f4KLQ7N29751; Sun, 20 May 2001 22:26:07 +0100 (BST) (envelope-from nik) Date: Sun, 20 May 2001 22:26:07 +0100 From: Nik Clayton To: Nik Clayton Cc: sobomax@FreeBSD.ORG, ru@FreeBSD.ORG, audit@FreeBSD.ORG, arch@FreeBSD.ORG Subject: Re: Integrating new scrshot(1) utility into vidcontrol(1) [patch for review] Message-ID: <20010520222607.A29709@catkin.nothing-going-on.org> References: <20010519194435.A22224@catkin.nothing-going-on.org> <200105191939.f4JJdjr00870@mail.uic-in.net> <20010520140747.B25841@catkin.nothing-going-on.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="17pEHd4RhPHOinZp" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010520140747.B25841@catkin.nothing-going-on.org>; from nik@freebsd.org on Sun, May 20, 2001 at 02:07:47PM +0100 Organization: FreeBSD Project Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, May 20, 2001 at 02:07:47PM +0100, Nik Clayton wrote: > Shouldn't be too hard.=20 I forgot one. (d) It should be documented. Unless I'm missing something, the=20 syscons ioctls aren't documented anywhere except the source code. N --=20 FreeBSD: The Power to Serve http://www.freebsd.org/ FreeBSD Documentation Project http://www.freebsd.org/docproj/ --- 15B8 3FFC DDB4 34B0 AA5F 94B7 93A8 0764 2C37 E375 --- --17pEHd4RhPHOinZp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.5 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjsINm0ACgkQk6gHZCw343Wm5QCbBdh2aQsa2STawBolb85uO5JQ dzEAnAkihwF71HXz75O+MMIgMucNdUEG =jhoT -----END PGP SIGNATURE----- --17pEHd4RhPHOinZp-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun May 20 15:15:40 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailb.telia.com (mailb.telia.com [194.22.194.6]) by hub.freebsd.org (Postfix) with ESMTP id EF63337B422 for ; Sun, 20 May 2001 15:15:35 -0700 (PDT) (envelope-from watchman@ludd.luth.se) Received: from d1o907.telia.com (d1o907.telia.com [195.252.38.241]) by mailb.telia.com (8.9.3/8.9.3) with ESMTP id AAA06516 for ; Mon, 21 May 2001 00:15:34 +0200 (CEST) Received: from ludd.luth.se (h55n1fls21o907.telia.com [212.181.140.55]) by d1o907.telia.com (8.8.8/8.8.8) with ESMTP id AAA10645 for ; Mon, 21 May 2001 00:15:33 +0200 (CEST) Message-ID: <3B0841FB.188D5933@ludd.luth.se> Date: Mon, 21 May 2001 00:15:23 +0200 From: Joachim =?iso-8859-1?Q?Str=F6mbergson?= Organization: Acne X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.3-STABLE i386) X-Accept-Language: en-US MIME-Version: 1.0 To: FreeBSD-Audit Subject: Patch to add nic-se to whois Content-Type: multipart/mixed; boundary="------------E55DE6CBF8C63374DF5E313E" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------E55DE6CBF8C63374DF5E313E Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Aloha! Trying my hands at contributing and hacking FreeBSD again. This is an adaption of a patch from OpenBSD that adds nic-se as one of the databases whois knows about. Could someone look at the patch and see if it's an ok patch? Also is this something we should add to the system? Thanks! -- Med vänlig hälsning, Cheers! Joachim Strömbergson ============================================================================ Joachim Strömbergson - ASIC designer, nice to *cute* animals. snail: phone: mail & web: Sävenäsgatan 5A +46 31 - 27 98 47 watchman@ludd.luth.se 416 72 Göteborg +46 733 75 97 02 www.ludd.luth.se/~watchman ============================================================================ --------------E55DE6CBF8C63374DF5E313E Content-Type: text/plain; charset=us-ascii; name="whois_patch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="whois_patch.diff" --- whois.c.old Sun May 20 22:44:19 2001 +++ whois.c Mon May 21 00:04:43 2001 @@ -67,6 +67,7 @@ #define RUNICHOST "whois.ripn.net" #define MNICHOST "whois.ra.net" #define QNICHOST_TAIL ".whois-servers.net" +#define SENICHOST "whois.nic-se.se" #define SNICHOST "whois.6bone.net" #define WHOIS_PORT 43 @@ -96,7 +97,7 @@ qnichost = NULL; flags = 0; use_qnichost = 0; - while ((ch = getopt(argc, argv, "adgh:impQrR6")) != -1) { + while ((ch = getopt(argc, argv, "adghsi:mpQrR6")) != -1) { switch((char)ch) { case 'a': host = ANICHOST; @@ -128,6 +129,9 @@ case 'R': host = RUNICHOST; break; + case 's': + host = SENICHOST; + break; case '6': host = SNICHOST; break; @@ -292,6 +296,6 @@ usage() { (void)fprintf(stderr, - "usage: whois [-adgimpQrR6] [-h hostname] name ...\n"); + "usage: whois [-adgsimpQrR6] [-h hostname] name ...\n"); exit(EX_USAGE); } --------------E55DE6CBF8C63374DF5E313E-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun May 20 16:18:10 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 15A3937B424 for ; Sun, 20 May 2001 16:17:56 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from spike.unixfreak.org (spike [63.198.170.139]) by bazooka.unixfreak.org (Postfix) with ESMTP id 10A2B3E0B for ; Sun, 20 May 2001 16:17:52 -0700 (PDT) To: audit@freebsd.org Subject: Patch to remove setgid bit from ipcs(1) Date: Sun, 20 May 2001 16:17:51 -0700 From: Dima Dorfman Message-Id: <20010520231752.10A2B3E0B@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi folks, Please review the attached patch to convert ipcs(1) to use sysctl's to get the information it needs. The patch also adds a number of sysctl's to kern/sysv*.c in order to facilitate ipcs' needs. This patch is identical to the one I sent to -hackers except for changing the new -y flag to be more consistent with the rest of the world. As before, the patch maintains ipcs' ability to use kvm to get the information it needs. Please review. Thanks in advance, Dima Dorfman dima@unixfreak.org Index: sys/kern/sysv_msg.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/sysv_msg.c,v retrieving revision 1.30 diff -u -r1.30 sysv_msg.c --- sys/kern/sysv_msg.c 2001/02/21 06:39:54 1.30 +++ sys/kern/sysv_msg.c 2001/05/20 22:54:55 @@ -1166,3 +1166,17 @@ p->p_retval[0] = msgsz; return(0); } + +static int +sysctl_msqids(SYSCTL_HANDLER_ARGS) +{ + + return (SYSCTL_OUT(req, msqids, + sizeof(struct msqid_ds) * msginfo.msgmni)); +} + +SYSCTL_DECL(_kern_ipc); +SYSCTL_STRUCT(_kern_ipc, OID_AUTO, msginfo, CTLFLAG_RD, &msginfo, msginfo, + "System V message info"); +SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_ANYBODY | CTLFLAG_RD, + NULL, 0, sysctl_msqids, "", "Message queue IDs"); Index: sys/kern/sysv_sem.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/sysv_sem.c,v retrieving revision 1.32 diff -u -r1.32 sysv_sem.c --- sys/kern/sysv_sem.c 2001/02/21 06:39:54 1.32 +++ sys/kern/sysv_sem.c 2001/05/20 22:54:55 @@ -28,6 +28,7 @@ static int sysvsem_modload __P((struct module *, int, void *)); static int semunload __P((void)); static void semexit_myhook __P((struct proc *p)); +static int sysctl_sema __P((SYSCTL_HANDLER_ARGS)); #ifndef _SYS_SYSPROTO_H_ struct __semctl_args; @@ -148,6 +149,9 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, semusz, CTLFLAG_RD, &seminfo.semusz, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, semvmx, CTLFLAG_RW, &seminfo.semvmx, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RW, &seminfo.semaem, 0, ""); +SYSCTL_STRUCT(_kern_ipc, OID_AUTO, seminfo, CTLFLAG_RD, &seminfo, seminfo, ""); +SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, CTLFLAG_RD | CTLFLAG_ANYBODY, + NULL, 0, sysctl_sema, "", ""); #if 0 RO seminfo.semmap /* SEMMAP unused */ @@ -1065,4 +1069,12 @@ #endif suptr->un_proc = NULL; *supptr = suptr->un_next; +} + +static int +sysctl_sema(SYSCTL_HANDLER_ARGS) +{ + + return (SYSCTL_OUT(req, sema, + sizeof(struct semid_ds) * seminfo.semmni)); } Index: sys/kern/sysv_shm.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/sysv_shm.c,v retrieving revision 1.56 diff -u -r1.56 sysv_shm.c --- sys/kern/sysv_shm.c 2001/05/19 01:28:03 1.56 +++ sys/kern/sysv_shm.c 2001/05/20 22:54:55 @@ -102,6 +102,7 @@ static int shmunload __P((void)); static void shmexit_myhook __P((struct proc *p)); static void shmfork_myhook __P((struct proc *p1, struct proc *p2)); +static int sysctl_shmsegs __P((SYSCTL_HANDLER_ARGS)); /* * Tuneable values @@ -142,6 +143,9 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, shmseg, CTLFLAG_RD, &shminfo.shmseg, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, shm_use_phys, CTLFLAG_RW, &shm_use_phys, 0, ""); +SYSCTL_STRUCT(_kern_ipc, OID_AUTO, shminfo, CTLFLAG_RD, &shminfo, shminfo, ""); +SYSCTL_PROC(_kern_ipc, OID_AUTO, shmsegs, CTLFLAG_ANYBODY | CTLFLAG_RD, + NULL, 0, sysctl_shmsegs, "", ""); static int shm_find_segment_by_key(key) @@ -708,6 +716,13 @@ shm_committed = 0; shmexit_hook = &shmexit_myhook; shmfork_hook = &shmfork_myhook; +} + +static int +sysctl_shmsegs(SYSCTL_HANDLER_ARGS) +{ + + return (SYSCTL_OUT(req, shmsegs, shmalloced * sizeof(shmsegs[0]))); } static int Index: usr.bin/ipcs/ipcs.1 =================================================================== RCS file: /stl/src/FreeBSD/src/usr.bin/ipcs/ipcs.1,v retrieving revision 1.11 diff -u -r1.11 ipcs.1 --- usr.bin/ipcs/ipcs.1 2000/12/14 11:49:46 1.11 +++ usr.bin/ipcs/ipcs.1 2001/05/20 22:54:55 @@ -37,7 +37,7 @@ .Nd report System V interprocess communication facilities status .Sh SYNOPSIS .Nm -.Op Fl abcmopqstMQST +.Op Fl abcmopqstMQSTy .Op Fl C Ar system .Op Fl N Ar core .Sh DESCRIPTION @@ -101,12 +101,16 @@ Extract the name list from the specified system instead of the default .Dq Pa /kernel . +Implies +.Fl y . .It Fl M Display system information about shared memory. .It Fl N Ar core Extract values associated with the name list from the specified core instead of the default .Dq Pa /dev/kmem . +Implies +.Fl y . .It Fl Q Display system information about messages queues. .It Fl S @@ -114,6 +118,19 @@ .It Fl T Display system information about shared memory, message queues and semaphores. +.It Fl y +Use the +.Xr kvm 3 +interface instead of the +.Xr sysctl 3 +interface to extract the required information. +If +.Nm +is to operate on the running system, +using +.Xr kvm 3 +will require read privileges to +.Pa /dev/kmem . .El .Pp If none of the Index: usr.bin/ipcs/ipcs.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.bin/ipcs/ipcs.c,v retrieving revision 1.14 diff -u -r1.14 ipcs.c --- usr.bin/ipcs/ipcs.c 2000/05/01 10:49:41 1.14 +++ usr.bin/ipcs/ipcs.c 2001/05/20 22:54:55 @@ -30,6 +30,7 @@ "$FreeBSD: src/usr.bin/ipcs/ipcs.c,v 1.14 2000/05/01 10:49:41 peter Exp $"; #endif /* not lint */ +#include #include #include #include @@ -43,12 +44,14 @@ #include #include #include +#include #define _KERNEL #include #include #include #include +int use_sysctl = 1; struct semid_ds *sema; struct seminfo seminfo; struct msginfo msginfo; @@ -56,6 +59,7 @@ struct shminfo shminfo; struct shmid_ds *shmsegs; +void kget __P((int idx, void *addr, size_t size)); void usage __P((void)); static struct nlist symbols[] = { @@ -63,16 +67,14 @@ #define X_SEMA 0 {"_seminfo"}, #define X_SEMINFO 1 - {"_semu"}, -#define X_SEMU 2 {"_msginfo"}, -#define X_MSGINFO 3 +#define X_MSGINFO 2 {"_msqids"}, -#define X_MSQIDS 4 +#define X_MSQIDS 3 {"_shminfo"}, -#define X_SHMINFO 5 +#define X_SHMINFO 4 {"_shmsegs"}, -#define X_SHMSEGS 6 +#define X_SHMSEGS 5 {NULL} }; @@ -137,7 +139,7 @@ char *core = NULL, *namelist = NULL; int i; - while ((i = getopt(argc, argv, "MmQqSsabC:cN:optT")) != -1) + while ((i = getopt(argc, argv, "MmQqSsabC:cN:optTy")) != -1) switch (i) { case 'M': display = SHMTOTAL; @@ -184,39 +186,45 @@ case 't': option |= TIME; break; + case 'y': + use_sysctl = 0; + break; default: usage(); } /* - * Discard setgid privileges if not the running kernel so that bad - * guys can't print interesting stuff from kernel memory. + * If paths to the exec file or core file were specified, we + * aren't operating on the running kernel, so we can't use + * sysctl. */ if (namelist != NULL || core != NULL) - setgid(getgid()); + use_sysctl = 0; - if ((kd = kvm_open(namelist, core, NULL, O_RDONLY, "ipcs")) == NULL) - exit(1); + if (!use_sysctl) { + if ((kd = kvm_open(namelist, core, NULL, O_RDONLY, "ipcs")) + == NULL) + exit(1); - switch (kvm_nlist(kd, symbols)) { - case 0: - break; - case -1: - errx(1, "unable to read kernel symbol table"); - default: + switch (kvm_nlist(kd, symbols)) { + case 0: + break; + case -1: + errx(1, "unable to read kernel symbol table"); + default: #ifdef notdef /* they'll be told more civilly later */ - warnx("nlist failed"); - for (i = 0; symbols[i].n_name != NULL; i++) - if (symbols[i].n_value == 0) - warnx("symbol %s not found", - symbols[i].n_name); - break; + warnx("nlist failed"); + for (i = 0; symbols[i].n_name != NULL; i++) + if (symbols[i].n_value == 0) + warnx("symbol %s not found", + symbols[i].n_name); + break; #endif + } } - if ((display & (MSGINFO | MSGTOTAL)) && - kvm_read(kd, symbols[X_MSGINFO].n_value, &msginfo, sizeof(msginfo))== sizeof(msginfo)) { - + kget(X_MSGINFO, &msginfo, sizeof(msginfo)); + if ((display & (MSGINFO | MSGTOTAL))) { if (display & MSGTOTAL) { printf("msginfo:\n"); printf("\tmsgmax: %6d\t(max characters in a message)\n", @@ -234,10 +242,12 @@ } if (display & MSGINFO) { struct msqid_ds *xmsqids; + size_t xmsqids_len; + - kvm_read(kd, symbols[X_MSQIDS].n_value, &msqids, sizeof(msqids)); - xmsqids = malloc(sizeof(struct msqid_ds) * msginfo.msgmni); - kvm_read(kd, (u_long) msqids, xmsqids, sizeof(struct msqid_ds) * msginfo.msgmni); + xmsqids_len = sizeof(struct msqid_ds) * msginfo.msgmni; + xmsqids = malloc(xmsqids_len); + kget(X_MSQIDS, xmsqids, xmsqids_len); printf("Message Queues:\n"); printf("T ID KEY MODE OWNER GROUP"); @@ -304,8 +314,9 @@ fprintf(stderr, "SVID messages facility not configured in the system\n"); } - if ((display & (SHMINFO | SHMTOTAL)) && - kvm_read(kd, symbols[X_SHMINFO].n_value, &shminfo, sizeof(shminfo))) { + + kget(X_SHMINFO, &shminfo, sizeof(shminfo)); + if ((display & (SHMINFO | SHMTOTAL))) { if (display & SHMTOTAL) { printf("shminfo:\n"); printf("\tshmmax: %7d\t(max shared memory segment size)\n", @@ -321,11 +332,11 @@ } if (display & SHMINFO) { struct shmid_ds *xshmids; + size_t xshmids_len; - kvm_read(kd, symbols[X_SHMSEGS].n_value, &shmsegs, sizeof(shmsegs)); - xshmids = malloc(sizeof(struct shmid_ds) * shminfo.shmmni); - kvm_read(kd, (u_long) shmsegs, xshmids, sizeof(struct shmid_ds) * - shminfo.shmmni); + xshmids_len = sizeof(struct shmid_ds) * shminfo.shmmni; + xshmids = malloc(xshmids_len); + kget(X_SHMSEGS, xshmids, xshmids_len); printf("Shared Memory:\n"); printf("T ID KEY MODE OWNER GROUP"); @@ -391,9 +402,11 @@ fprintf(stderr, "SVID shared memory facility not configured in the system\n"); } - if ((display & (SEMINFO | SEMTOTAL)) && - kvm_read(kd, symbols[X_SEMINFO].n_value, &seminfo, sizeof(seminfo))) { + + kget(X_SEMINFO, &seminfo, sizeof(seminfo)); + if ((display & (SEMINFO | SEMTOTAL))) { struct semid_ds *xsema; + size_t xsema_len; if (display & SEMTOTAL) { printf("seminfo:\n"); @@ -419,9 +432,9 @@ seminfo.semaem); } if (display & SEMINFO) { - kvm_read(kd, symbols[X_SEMA].n_value, &sema, sizeof(sema)); - xsema = malloc(sizeof(struct semid_ds) * seminfo.semmni); - kvm_read(kd, (u_long) sema, xsema, sizeof(struct semid_ds) * seminfo.semmni); + xsema_len = sizeof(struct semid_ds) * seminfo.semmni; + xsema = malloc(xsema_len); + kget(X_SEMA, xsema, xsema_len); printf("Semaphores:\n"); printf("T ID KEY MODE OWNER GROUP"); @@ -471,16 +484,82 @@ if (display & (SEMINFO | SEMTOTAL)) { fprintf(stderr, "SVID semaphores facility not configured in the system\n"); } - kvm_close(kd); + if (!use_sysctl) + kvm_close(kd); exit(0); } void +kget(idx, addr, size) + int idx; + void *addr; + size_t size; +{ + char *symn; /* symbol name */ + int rv, tsiz; + unsigned long kaddr; + char *sym2sysctl[] = { /* symbol to sysctl name table */ + "kern.ipc.sema", + "kern.ipc.seminfo", + "kern.ipc.msginfo", + "kern.ipc.msqids", + "kern.ipc.shminfo", + "kern.ipc.shmsegs" }; + + assert(idx <= sizeof(sym2sysctl) / sizeof(*sym2sysctl)); + if (!use_sysctl) { + symn = symbols[idx].n_name; + if (*symn == '_') + symn++; + if (symbols[idx].n_type == 0 || symbols[idx].n_value == 0) + errx(1, "symbol %s undefined", symn); + /* + * For some symbols, the value we retreieve is + * actually a pointer; since we want the actual value, + * we have to manually dereference it. + */ + switch (idx) { + case X_MSQIDS: + tsiz = sizeof(msqids); + rv = kvm_read(kd, symbols[idx].n_value, + &msqids, tsiz); + kaddr = (u_long)msqids; + break; + case X_SHMSEGS: + tsiz = sizeof(shmsegs); + rv = kvm_read(kd, symbols[idx].n_value, + &shmsegs, tsiz); + kaddr = (u_long)shmsegs; + break; + case X_SEMA: + tsiz = sizeof(sema); + rv = kvm_read(kd, symbols[idx].n_value, + &sema, tsiz); + kaddr = (u_long)sema; + break; + default: + rv = tsiz = 0; + kaddr = symbols[idx].n_value; + break; + } + if (rv != tsiz) + errx(1, "%s: %s", symn, kvm_geterr(kd)); + if (kvm_read(kd, kaddr, addr, size) != size) + errx(1, "%s: %s", symn, kvm_geterr(kd)); + } else { + tsiz = size; + if (sysctlbyname(sym2sysctl[idx], addr, &tsiz, NULL, 0) + == -1) + err(1, "sysctlbyname: %s", sym2sysctl[idx]); + } +} + +void usage() { fprintf(stderr, - "usage: ipcs [-abcmopqst] [-C corefile] [-N namelist]\n"); + "usage: ipcs [-abcmopqsty] [-C corefile] [-N namelist]\n"); exit(1); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun May 20 19:19:51 2001 Delivered-To: freebsd-audit@freebsd.org Received: from casimir.physics.purdue.edu (casimir.physics.purdue.edu [128.210.146.111]) by hub.freebsd.org (Postfix) with ESMTP id 80B3537B422 for ; Sun, 20 May 2001 19:19:49 -0700 (PDT) (envelope-from will@physics.purdue.edu) Received: by casimir.physics.purdue.edu (Postfix, from userid 1000) id 2E1B318A47; Sun, 20 May 2001 21:14:28 -0500 (EST) Date: Sun, 20 May 2001 21:14:28 -0500 From: Will Andrews To: Joachim Str?mbergson Cc: FreeBSD-Audit Subject: Re: Patch to add nic-se to whois Message-ID: <20010520211427.M1198@casimir.physics.purdue.edu> Reply-To: Will Andrews Mail-Followup-To: Will Andrews , Joachim Str?mbergson , FreeBSD-Audit References: <3B0841FB.188D5933@ludd.luth.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.15i In-Reply-To: <3B0841FB.188D5933@ludd.luth.se>; from watchman@ludd.luth.se on Mon, May 21, 2001 at 12:15:23AM +0200 X-Operating-System: Linux 2.2.18 sparc64 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, May 21, 2001 at 12:15:23AM +0200, Joachim Str?mbergson wrote: > - while ((ch = getopt(argc, argv, "adgh:impQrR6")) != -1) { > + while ((ch = getopt(argc, argv, "adghsi:mpQrR6")) != -1) { [...] > - "usage: whois [-adgimpQrR6] [-h hostname] name ...\n"); > + "usage: whois [-adgsimpQrR6] [-h hostname] name ...\n"); You've introduced a bug. Look closely. :-) -- wca To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 0:25:15 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailc.telia.com (mailc.telia.com [194.22.190.4]) by hub.freebsd.org (Postfix) with ESMTP id 59D6037B42C for ; Mon, 21 May 2001 00:25:11 -0700 (PDT) (envelope-from watchman@ludd.luth.se) Received: from d1o907.telia.com (d1o907.telia.com [195.252.38.241]) by mailc.telia.com (8.11.2/8.11.0) with ESMTP id f4L7P9L15372; Mon, 21 May 2001 09:25:09 +0200 (CEST) Received: from ludd.luth.se (h55n1fls21o907.telia.com [212.181.140.55]) by d1o907.telia.com (8.8.8/8.8.8) with ESMTP id JAA12713; Mon, 21 May 2001 09:25:08 +0200 (CEST) Message-ID: <3B08C2CB.2ABF2EF2@ludd.luth.se> Date: Mon, 21 May 2001 09:24:59 +0200 From: Joachim =?iso-8859-1?Q?Str=F6mbergson?= Organization: Acne X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.3-STABLE i386) X-Accept-Language: en-US MIME-Version: 1.0 To: Mike Heffner Cc: FreeBSD-Audit Subject: Re: Patch to add nic-se to whois References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Aloha! Mike Heffner wrote: > Except for breaking style(9) (spaces instead of tabs), it looks alright. Also, > don't forget to update whois.1. Ok, fixed. Thanks! Next stop will be the man page. When talking about style here, I tried to insert the addition in alphabetical order. Looking at the source for whois, some of the defines for the other databases seems to have been added without taking care of this: #define NICHOST "whois.crsnic.net" #define INICHOST "whois.networksolutions.com" #define DNICHOST "whois.nic.mil" #define GNICHOST "whois.nic.gov" #define ANICHOST "whois.arin.net" #define RNICHOST "whois.ripe.net" #define PNICHOST "whois.apnic.net" #define RUNICHOST "whois.ripn.net" #define MNICHOST "whois.ra.net" #define QNICHOST_TAIL ".whois-servers.net" #define SENICHOST "whois.nic-se.se" #define SNICHOST "whois.6bone.net" Is this important and/or something we want? I checked man style(9) and it seems to recommend sorting rules for includes and variables. I could sort these if that would seem appropriate while I'm at it. > | this something we should add to the system? > > Sure. Does this option, `s', conflict with any of the other BSDs? Well the OpenBSD patch used 's' for this option. Dunno about NetBSD and BSDi. I'll check. -- Med vänlig hälsning, Cheers! Joachim Strömbergson ============================================================================ Joachim Strömbergson - ASIC designer, nice to *cute* animals. snail: phone: mail & web: Sävenäsgatan 5A +46 31 - 27 98 47 watchman@ludd.luth.se 416 72 Göteborg +46 733 75 97 02 www.ludd.luth.se/~watchman ============================================================================ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 0:30:19 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id A55A537B42C for ; Mon, 21 May 2001 00:30:10 -0700 (PDT) (envelope-from roam@ringworld.nanolink.com) Received: (qmail 4913 invoked by uid 1000); 21 May 2001 07:29:22 -0000 Date: Mon, 21 May 2001 10:29:22 +0300 From: Peter Pentchev To: Joachim Strombergson Cc: FreeBSD-Audit Subject: Re: Patch to add nic-se to whois Message-ID: <20010521102922.E2781@ringworld.oblivion.bg> Mail-Followup-To: Joachim Strombergson , FreeBSD-Audit References: <3B0841FB.188D5933@ludd.luth.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3B0841FB.188D5933@ludd.luth.se>; from watchman@ludd.luth.se on Mon, May 21, 2001 at 12:15:23AM +0200 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, May 21, 2001 at 12:15:23AM +0200, Joachim Strombergson wrote: > Aloha! > > Trying my hands at contributing and hacking FreeBSD again. > > This is an adaption of a patch from OpenBSD that adds nic-se as one of > the databases whois knows about. > > Could someone look at the patch and see if it's an ok patch? Also is > this something we should add to the system? > > Thanks! Hi, Attached is a slightly modified version of your patch, which preserves whitespace (tabs), and follows style(9) guidelines in ordering function arguments (as pointed out by Will :) This patch also adds a description for the -s flag in the manpage, as well as several -mdoc style fixes to the manpage. Actually, the -s flag documentation is only 6 lines of the whois.1 patch, all the rest are style fixes :) Your efforts at contributing are appreciated! G'luck, Peter -- I am the meaning of this sentence. Index: src/usr.bin/whois/whois.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/whois/whois.1,v retrieving revision 1.16 diff -u -r1.16 whois.1 --- src/usr.bin/whois/whois.1 2000/11/20 19:21:19 1.16 +++ src/usr.bin/whois/whois.1 2001/05/21 07:09:58 @@ -40,7 +40,7 @@ .Nd Internet domain name and network number directory service .Sh SYNOPSIS .Nm -.Op Fl adgimpQrR6 +.Op Fl adgimpQrRs6 .Op Fl h Ar host .Ar name ... .Sh DESCRIPTION @@ -54,8 +54,8 @@ .It Fl a Use the American Registry for Internet Numbers .Pq Tn ARIN -database. It contains network numbers used in those parts of the world -covered neither by +database. +It contains network numbers used in those parts of the world covered neither by .Tn APNIC nor by .Tn RIPE . Contact (handle) information should be looked up by appending "-ARIN" to the @@ -65,7 +65,8 @@ .Pp .It Fl d Use the US Department of Defense -database. It contains points of contact for subdomains of +database. +It contains points of contact for subdomains of .Tn \&.MIL . .It Fl g Use the US non-military federal government database, which contains points of @@ -87,22 +88,28 @@ .It Fl i Use the Network Solutions Registry for Internet Numbers .Pq Tn whois.networksolutions.com -database. It contains network numbers and domain contact information -for most of +database. +It contains network numbers and domain contact information for most of .Tn \&.COM , .Tn \&.NET , .Tn \&.ORG and .Tn \&.EDU domains. -NOTE! The registration of these domains is now done by a number of +.Pp +.Sy NOTE! +The registration of these domains is now done by a number of independent and competing registrars and this database holds no information -on the domains registered by organizations other than Network Solutions, Inc. -Also, note that the InterNIC database +on the domains registered by organizations other than Network Solutions, Inc. +Also, note that the +.Tn InterNIC +database .Pq Tn whois.internic.net -is no longer handled by Network Solutions, Inc. -For details, see: -http://www.internic.net/. +is no longer handled by +.Tn Network Solutions, Inc . +For details, see +.Pa http://www.internic.net/ . +.Pp Contact (handle) information should be looked up by prefixing "handle " to the NIC handle in the querry: .Pp @@ -117,29 +124,40 @@ .It Fl p Use the Asia/Pacific Network Information Center .Pq Tn APNIC -database. It contains network numbers used in East Asia, Australia, +database. +It contains network numbers used in East Asia, Australia, New Zealand, and the Pacific islands. .It Fl Q Do a quick lookup. This means that .Nm will not attempt to lookup the name in the authoritative whois server (if one is listed) nor will it contact InterNic if a lookup -fails. This flag has no effect when combined with any other flag. +fails. +This flag has no effect when combined with any other flag. .It Fl r Use the R\(aaeseaux IP Europ\(aaeens .Pq Tn RIPE -database. It contains network numbers and domain contact information +database. +It contains network numbers and domain contact information for Europe. .It Fl R Use the Russia Network Information Center .Pq Tn RIPN -database. It contains network numbers and domain contact information +database. +It contains network numbers and domain contact information for subdomains of .Tn \&.RU . +.It Fl s +Use the Network Information Center Sweden AB +.Pq Tn NIC-SE +database. +It contains network numbers and domain contact information for subdomains of +.Tn \&.SE . .It Fl 6 Use the IPv6 Resource Center .Pq Tn 6bone -database. It contains network names and addresses for the IPv6 network. +database. +It contains network names and addresses for the IPv6 network. .El .Pp The operands specified to Index: src/usr.bin/whois/whois.c =================================================================== RCS file: /home/ncvs/src/usr.bin/whois/whois.c,v retrieving revision 1.16 diff -u -r1.16 whois.c --- src/usr.bin/whois/whois.c 2000/07/07 07:52:21 1.16 +++ src/usr.bin/whois/whois.c 2001/05/21 07:09:58 @@ -67,6 +67,7 @@ #define RUNICHOST "whois.ripn.net" #define MNICHOST "whois.ra.net" #define QNICHOST_TAIL ".whois-servers.net" +#define SENICHOST "whois.nic-se.se" #define SNICHOST "whois.6bone.net" #define WHOIS_PORT 43 @@ -96,7 +97,7 @@ qnichost = NULL; flags = 0; use_qnichost = 0; - while ((ch = getopt(argc, argv, "adgh:impQrR6")) != -1) { + while ((ch = getopt(argc, argv, "adghi:mpQrRs6")) != -1) { switch((char)ch) { case 'a': host = ANICHOST; @@ -128,6 +129,9 @@ case 'R': host = RUNICHOST; break; + case 's': + host = SENICHOST; + break; case '6': host = SNICHOST; break; @@ -292,6 +296,6 @@ usage() { (void)fprintf(stderr, - "usage: whois [-adgimpQrR6] [-h hostname] name ...\n"); + "usage: whois [-adgimpQrRs6] [-h hostname] name ...\n"); exit(EX_USAGE); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 0:36:32 2001 Delivered-To: freebsd-audit@freebsd.org Received: from casimir.physics.purdue.edu (casimir.physics.purdue.edu [128.210.146.111]) by hub.freebsd.org (Postfix) with ESMTP id CB3D937B424 for ; Mon, 21 May 2001 00:36:29 -0700 (PDT) (envelope-from will@physics.purdue.edu) Received: by casimir.physics.purdue.edu (Postfix, from userid 1000) id 1897418A47; Mon, 21 May 2001 02:31:06 -0500 (EST) Date: Mon, 21 May 2001 02:31:06 -0500 From: Will Andrews To: Peter Pentchev Cc: Joachim Strombergson , FreeBSD-Audit Subject: Re: Patch to add nic-se to whois Message-ID: <20010521023106.S1198@casimir.physics.purdue.edu> Reply-To: Will Andrews Mail-Followup-To: Will Andrews , Peter Pentchev , Joachim Strombergson , FreeBSD-Audit References: <3B0841FB.188D5933@ludd.luth.se> <20010521102922.E2781@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.15i In-Reply-To: <20010521102922.E2781@ringworld.oblivion.bg>; from roam@orbitel.bg on Mon, May 21, 2001 at 10:29:22AM +0300 X-Operating-System: Linux 2.2.18 sparc64 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, May 21, 2001 at 10:29:22AM +0300, Peter Pentchev wrote: > Attached is a slightly modified version of your patch, which preserves > whitespace (tabs), and follows style(9) guidelines in ordering function > arguments (as pointed out by Will :) Actually, no... I was saying he introduced a functional bug (but as you pointed out, also a style(9) bug). Look at your own patch: [...] > - while ((ch = getopt(argc, argv, "adgh:impQrR6")) != -1) { > + while ((ch = getopt(argc, argv, "adghi:mpQrRs6")) != -1) { [...] > - "usage: whois [-adgimpQrR6] [-h hostname] name ...\n"); > + "usage: whois [-adgimpQrRs6] [-h hostname] name ...\n"); For goodness sakes, people, test your patches! ;-) -- wca To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 0:40:25 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id CFB4B37B422 for ; Mon, 21 May 2001 00:40:15 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 4995 invoked by uid 1000); 21 May 2001 07:39:26 -0000 Date: Mon, 21 May 2001 10:39:26 +0300 From: Peter Pentchev To: Will Andrews Cc: Joachim Strombergson , FreeBSD-Audit Subject: Re: Patch to add nic-se to whois Message-ID: <20010521103926.F2781@ringworld.oblivion.bg> Mail-Followup-To: Will Andrews , Joachim Strombergson , FreeBSD-Audit References: <3B0841FB.188D5933@ludd.luth.se> <20010521102922.E2781@ringworld.oblivion.bg> <20010521023106.S1198@casimir.physics.purdue.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010521023106.S1198@casimir.physics.purdue.edu>; from will@physics.purdue.edu on Mon, May 21, 2001 at 02:31:06AM -0500 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, May 21, 2001 at 02:31:06AM -0500, Will Andrews wrote: > On Mon, May 21, 2001 at 10:29:22AM +0300, Peter Pentchev wrote: > > Attached is a slightly modified version of your patch, which preserves > > whitespace (tabs), and follows style(9) guidelines in ordering function > > arguments (as pointed out by Will :) > > Actually, no... I was saying he introduced a functional bug (but as you > pointed out, also a style(9) bug). Look at your own patch: > > [...] > > - while ((ch = getopt(argc, argv, "adgh:impQrR6")) != -1) { > > + while ((ch = getopt(argc, argv, "adghi:mpQrRs6")) != -1) { > [...] > > - "usage: whois [-adgimpQrR6] [-h hostname] name ...\n"); > > + "usage: whois [-adgimpQrRs6] [-h hostname] name ...\n"); > > For goodness sakes, people, test your patches! ;-) Er.. Oops! OK, updated patch attached... :) G'luck, Peter -- This sentence was in the past tense. Index: src/usr.bin/whois/whois.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/whois/whois.1,v retrieving revision 1.16 diff -u -r1.16 whois.1 --- src/usr.bin/whois/whois.1 2000/11/20 19:21:19 1.16 +++ src/usr.bin/whois/whois.1 2001/05/21 07:09:58 @@ -40,7 +40,7 @@ .Nd Internet domain name and network number directory service .Sh SYNOPSIS .Nm -.Op Fl adgimpQrR6 +.Op Fl adgimpQrRs6 .Op Fl h Ar host .Ar name ... .Sh DESCRIPTION @@ -54,8 +54,8 @@ .It Fl a Use the American Registry for Internet Numbers .Pq Tn ARIN -database. It contains network numbers used in those parts of the world -covered neither by +database. +It contains network numbers used in those parts of the world covered neither by .Tn APNIC nor by .Tn RIPE . Contact (handle) information should be looked up by appending "-ARIN" to the @@ -65,7 +65,8 @@ .Pp .It Fl d Use the US Department of Defense -database. It contains points of contact for subdomains of +database. +It contains points of contact for subdomains of .Tn \&.MIL . .It Fl g Use the US non-military federal government database, which contains points of @@ -87,22 +88,28 @@ .It Fl i Use the Network Solutions Registry for Internet Numbers .Pq Tn whois.networksolutions.com -database. It contains network numbers and domain contact information -for most of +database. +It contains network numbers and domain contact information for most of .Tn \&.COM , .Tn \&.NET , .Tn \&.ORG and .Tn \&.EDU domains. -NOTE! The registration of these domains is now done by a number of +.Pp +.Sy NOTE! +The registration of these domains is now done by a number of independent and competing registrars and this database holds no information -on the domains registered by organizations other than Network Solutions, Inc. -Also, note that the InterNIC database +on the domains registered by organizations other than Network Solutions, Inc. +Also, note that the +.Tn InterNIC +database .Pq Tn whois.internic.net -is no longer handled by Network Solutions, Inc. -For details, see: -http://www.internic.net/. +is no longer handled by +.Tn Network Solutions, Inc . +For details, see +.Pa http://www.internic.net/ . +.Pp Contact (handle) information should be looked up by prefixing "handle " to the NIC handle in the querry: .Pp @@ -117,29 +124,40 @@ .It Fl p Use the Asia/Pacific Network Information Center .Pq Tn APNIC -database. It contains network numbers used in East Asia, Australia, +database. +It contains network numbers used in East Asia, Australia, New Zealand, and the Pacific islands. .It Fl Q Do a quick lookup. This means that .Nm will not attempt to lookup the name in the authoritative whois server (if one is listed) nor will it contact InterNic if a lookup -fails. This flag has no effect when combined with any other flag. +fails. +This flag has no effect when combined with any other flag. .It Fl r Use the R\(aaeseaux IP Europ\(aaeens .Pq Tn RIPE -database. It contains network numbers and domain contact information +database. +It contains network numbers and domain contact information for Europe. .It Fl R Use the Russia Network Information Center .Pq Tn RIPN -database. It contains network numbers and domain contact information +database. +It contains network numbers and domain contact information for subdomains of .Tn \&.RU . +.It Fl s +Use the Network Information Center Sweden AB +.Pq Tn NIC-SE +database. +It contains network numbers and domain contact information for subdomains of +.Tn \&.SE . .It Fl 6 Use the IPv6 Resource Center .Pq Tn 6bone -database. It contains network names and addresses for the IPv6 network. +database. +It contains network names and addresses for the IPv6 network. .El .Pp The operands specified to Index: src/usr.bin/whois/whois.c =================================================================== RCS file: /home/ncvs/src/usr.bin/whois/whois.c,v retrieving revision 1.16 diff -u -r1.16 whois.c --- src/usr.bin/whois/whois.c 2000/07/07 07:52:21 1.16 +++ src/usr.bin/whois/whois.c 2001/05/21 07:09:58 @@ -67,6 +67,7 @@ #define RUNICHOST "whois.ripn.net" #define MNICHOST "whois.ra.net" #define QNICHOST_TAIL ".whois-servers.net" +#define SENICHOST "whois.nic-se.se" #define SNICHOST "whois.6bone.net" #define WHOIS_PORT 43 @@ -96,7 +97,7 @@ qnichost = NULL; flags = 0; use_qnichost = 0; - while ((ch = getopt(argc, argv, "adgh:impQrR6")) != -1) { + while ((ch = getopt(argc, argv, "adgh:impQrRs6")) != -1) { switch((char)ch) { case 'a': host = ANICHOST; @@ -128,6 +129,9 @@ case 'R': host = RUNICHOST; break; + case 's': + host = SENICHOST; + break; case '6': host = SNICHOST; break; @@ -292,6 +296,6 @@ usage() { (void)fprintf(stderr, - "usage: whois [-adgimpQrR6] [-h hostname] name ...\n"); + "usage: whois [-adgimpQrRs6] [-h hostname] name ...\n"); exit(EX_USAGE); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 0:43:48 2001 Delivered-To: freebsd-audit@freebsd.org Received: from casimir.physics.purdue.edu (casimir.physics.purdue.edu [128.210.146.111]) by hub.freebsd.org (Postfix) with ESMTP id B7E0337B422 for ; Mon, 21 May 2001 00:43:46 -0700 (PDT) (envelope-from will@physics.purdue.edu) Received: by casimir.physics.purdue.edu (Postfix, from userid 1000) id 1087718A47; Mon, 21 May 2001 02:38:24 -0500 (EST) Date: Mon, 21 May 2001 02:38:23 -0500 From: Will Andrews To: Will Andrews , Joachim Strombergson , FreeBSD-Audit Subject: Re: Patch to add nic-se to whois Message-ID: <20010521023823.T1198@casimir.physics.purdue.edu> Reply-To: Will Andrews Mail-Followup-To: Will Andrews , Joachim Strombergson , FreeBSD-Audit References: <3B0841FB.188D5933@ludd.luth.se> <20010521102922.E2781@ringworld.oblivion.bg> <20010521023106.S1198@casimir.physics.purdue.edu> <20010521103926.F2781@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.15i In-Reply-To: <20010521103926.F2781@ringworld.oblivion.bg>; from roam@orbitel.bg on Mon, May 21, 2001 at 10:39:26AM +0300 X-Operating-System: Linux 2.2.18 sparc64 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, May 21, 2001 at 10:39:26AM +0300, Peter Pentchev wrote: > Er.. Oops! > > OK, updated patch attached... :) Looks good now, but I didn't review the mdoc(7) Black Magic (tm). -- wca To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 0:50: 8 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 51C4237B424; Mon, 21 May 2001 00:50:06 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from spike.unixfreak.org (spike [63.198.170.139]) by bazooka.unixfreak.org (Postfix) with ESMTP id 876AB3E28; Mon, 21 May 2001 00:50:05 -0700 (PDT) To: Will Andrews Cc: Joachim Strombergson , FreeBSD-Audit , roam@freebsd.org Subject: Re: Patch to add nic-se to whois In-Reply-To: <20010521023823.T1198@casimir.physics.purdue.edu>; from will@physics.purdue.edu on "Mon, 21 May 2001 02:38:23 -0500" Date: Mon, 21 May 2001 00:50:05 -0700 From: Dima Dorfman Message-Id: <20010521075005.876AB3E28@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [ reply intended more for Peter than anyone else ] Will Andrews writes: > On Mon, May 21, 2001 at 10:39:26AM +0300, Peter Pentchev wrote: > > Er.. Oops! > > > > OK, updated patch attached... :) > > Looks good now, but I didn't review the mdoc(7) Black Magic (tm). The mdoc "Black Magic" looks good, except for a few lines over 80 characters (which should be fixed). That said, I think you should make the markup fixes separate from the addition of -s. > > -- > wca > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-audit" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 0:55:35 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 3D9B837B440 for ; Mon, 21 May 2001 00:55:32 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 5130 invoked by uid 1000); 21 May 2001 07:54:44 -0000 Date: Mon, 21 May 2001 10:54:44 +0300 From: Peter Pentchev To: Dima Dorfman Cc: Will Andrews , Joachim Strombergson , FreeBSD-Audit Subject: Re: Patch to add nic-se to whois Message-ID: <20010521105444.G2781@ringworld.oblivion.bg> Mail-Followup-To: Dima Dorfman , Will Andrews , Joachim Strombergson , FreeBSD-Audit References: <20010521023823.T1198@casimir.physics.purdue.edu> <20010521075005.876AB3E28@bazooka.unixfreak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010521075005.876AB3E28@bazooka.unixfreak.org>; from dima@unixfreak.org on Mon, May 21, 2001 at 12:50:05AM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, May 21, 2001 at 12:50:05AM -0700, Dima Dorfman wrote: > [ reply intended more for Peter than anyone else ] > > Will Andrews writes: > > On Mon, May 21, 2001 at 10:39:26AM +0300, Peter Pentchev wrote: > > > Er.. Oops! > > > > > > OK, updated patch attached... :) > > > > Looks good now, but I didn't review the mdoc(7) Black Magic (tm). > > The mdoc "Black Magic" looks good, except for a few lines over 80 > characters (which should be fixed). That said, I think you should > make the markup fixes separate from the addition of -s. Hrm? I did not see any lines longer than 80 characters. There is one line which is exactly 79 chars in length in the new whois.1 file, and the '+' in front in the patch made it 80 :) And about the separation of markup and features - yes, you have a point there. G'luck, Peter -- The rest of this sentence is written in Thailand, on To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 4:33: 8 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail5.svr.pol.co.uk (mail5.svr.pol.co.uk [195.92.193.20]) by hub.freebsd.org (Postfix) with ESMTP id AB5CF37B443 for ; Mon, 21 May 2001 04:33:05 -0700 (PDT) (envelope-from jeroen@vangelderen.org) Received: from modem-41.cerium.dialup.pol.co.uk ([62.136.48.169] helo=vangelderen.org) by mail5.svr.pol.co.uk with esmtp (Exim 3.13 #0) id 151nvo-0000Ab-00; Mon, 21 May 2001 12:33:00 +0100 Message-ID: <3B08EEA8.1C54CA16@vangelderen.org> Date: Mon, 21 May 2001 11:32:08 +0100 From: "Jeroen C. van Gelderen" X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Joachim =?iso-8859-1?Q?Str=F6mbergson?= Cc: FreeBSD-Audit Subject: Re: Patch to add nic-se to whois References: <3B0841FB.188D5933@ludd.luth.se> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Joachim Strömbergson wrote: > Trying my hands at contributing and hacking FreeBSD again. > > This is an adaption of a patch from OpenBSD that adds nic-se as one of > the databases whois knows about. > > Could someone look at the patch and see if it's an ok patch? Also is > this something we should add to the system? This sounds like a welcome addition except for the fact that I'm wondering what will happen if 20 other countries need to have their servers added to whois. We cannot really use the same strategy without adopting a bigger alphabet :-) Wouldn't a more scalable solution be to accept the -s flag followed by a country code like so: whois -s SE whois -s BE whois -s DE whois -s NL ? The '-s' would than stand for 'server'. Cheers, Jeroen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 4:41:33 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 47C9F37B422 for ; Mon, 21 May 2001 04:41:30 -0700 (PDT) (envelope-from roam@ringworld.nanolink.com) Received: (qmail 9895 invoked by uid 1000); 21 May 2001 11:40:41 -0000 Date: Mon, 21 May 2001 14:40:41 +0300 From: Peter Pentchev To: "Jeroen C. van Gelderen" Cc: Joachim Strombergson , FreeBSD-Audit Subject: Re: Patch to add nic-se to whois Message-ID: <20010521144041.L2781@ringworld.oblivion.bg> Mail-Followup-To: "Jeroen C. van Gelderen" , Joachim Strombergson , FreeBSD-Audit References: <3B0841FB.188D5933@ludd.luth.se> <3B08EEA8.1C54CA16@vangelderen.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3B08EEA8.1C54CA16@vangelderen.org>; from jeroen@vangelderen.org on Mon, May 21, 2001 at 11:32:08AM +0100 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, May 21, 2001 at 11:32:08AM +0100, Jeroen C. van Gelderen wrote: > Joachim Strombergson wrote: > > Trying my hands at contributing and hacking FreeBSD again. > > > > This is an adaption of a patch from OpenBSD that adds nic-se as one of > > the databases whois knows about. > > > > Could someone look at the patch and see if it's an ok patch? Also is > > this something we should add to the system? > > This sounds like a welcome addition except for > the fact that I'm wondering what will happen if > 20 other countries need to have their servers > added to whois. We cannot really use the same > strategy without adopting a bigger alphabet :-) > > Wouldn't a more scalable solution be to accept > the -s flag followed by a country code like so: > whois -s SE > whois -s BE > whois -s DE > whois -s NL > ? > > The '-s' would than stand for 'server'. Sounds like a great idea! Joachim, are you interested in revamping whois(1) this way? :) If not, I could take it up.. There could be several issues here: does whois(1) work with hard-coded server names, or does it take the country code -> server name mappings from a file, or both? I guess the best way would be to check a file if it exists, then if no match was found, use a hardcoded table. This would render the -R (RIPN, .ru) switch obsolete, but I do not think that the global, non-country-specific registries should be removed (not that Jeroen has proposed this, just to make it clear :) G'luck, Peter -- .siht ekil ti gnidaer eb d'uoy ,werbeH ni erew ecnetnes siht fI To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 4:57:26 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailb.telia.com (mailb.telia.com [194.22.194.6]) by hub.freebsd.org (Postfix) with ESMTP id F3F9D37B43C for ; Mon, 21 May 2001 04:57:22 -0700 (PDT) (envelope-from watchman@ludd.luth.se) Received: from d1o907.telia.com (d1o907.telia.com [195.252.38.241]) by mailb.telia.com (8.9.3/8.9.3) with ESMTP id NAA00264; Mon, 21 May 2001 13:57:13 +0200 (CEST) Received: from ludd.luth.se (h55n1fls21o907.telia.com [212.181.140.55]) by d1o907.telia.com (8.8.8/8.8.8) with ESMTP id NAA12810; Mon, 21 May 2001 13:57:09 +0200 (CEST) Message-ID: <3B09028C.3F32D178@ludd.luth.se> Date: Mon, 21 May 2001 13:57:00 +0200 From: Joachim =?iso-8859-1?Q?Str=F6mbergson?= Organization: Acne X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.3-STABLE i386) X-Accept-Language: en-US MIME-Version: 1.0 To: Peter Pentchev Cc: "Jeroen C. van Gelderen" , FreeBSD-Audit Subject: Re: Patch to add nic-se to whois References: <3B0841FB.188D5933@ludd.luth.se> <3B08EEA8.1C54CA16@vangelderen.org> <20010521144041.L2781@ringworld.oblivion.bg> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Aloha! Peter Pentchev wrote: > On Mon, May 21, 2001 at 11:32:08AM +0100, Jeroen C. van Gelderen wrote: > > Wouldn't a more scalable solution be to accept > > the -s flag followed by a country code like so: > > whois -s SE > > whois -s BE > > whois -s DE > > whois -s NL > > ? > > > > The '-s' would than stand for 'server'. > > Sounds like a great idea! Joachim, are you interested in revamping whois(1) > this way? :) If not, I could take it up.. Sure, I'd like to have a go at it later today. I get back if I (a) get stuck or (b) have a patch for review. -- Med vänlig hälsning, Cheers! Joachim Strömbergson ============================================================================ Joachim Strömbergson - ASIC designer, nice to *cute* animals. snail: phone: mail & web: Sävenäsgatan 5A +46 31 - 27 98 47 watchman@ludd.luth.se 416 72 Göteborg +46 733 75 97 02 www.ludd.luth.se/~watchman ============================================================================ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 6:59:34 2001 Delivered-To: freebsd-audit@freebsd.org Received: from aifhs8.alcatel.fr (aifhs8.alcatel.fr [212.208.74.153]) by hub.freebsd.org (Postfix) with ESMTP id 2AB2137B422; Mon, 21 May 2001 06:59:29 -0700 (PDT) (envelope-from Thierry.Herbelot@alcatel.fr) Received: from frmta003.netfr.alcatel.fr (frmta003.netfr.alcatel.fr [155.132.251.32]) by aifhs8.alcatel.fr (ALCANET/SMTP2) with SMTP id PAA20501; Mon, 21 May 2001 15:59:40 +0200 (MET DST) Received: by frmta003.netfr.alcatel.fr(Lotus SMTP MTA v4.6.7 (934.1 12-30-1999)) id C1256A53.004CE463 ; Mon, 21 May 2001 15:59:52 +0200 X-Lotus-FromDomain: ALCATEL From: Thierry.Herbelot@alcatel.fr To: hackers@freebsd.org, Audit@freebsd.org Message-ID: Date: Mon, 21 May 2001 15:59:15 +0200 Subject: memory leak in libfetch ? (with patch) Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG hello, [this is using a 4.3-Release machine] I'm using libfetch for automated file transfers from a program (via ftp). The program is running for long periods of time, and seems to be leaking memory (at least it's SIZE in top(1) just grows and grows - the swap is also increasingly used). As there is no dynamically allocated memory in my program, one suspect could be libfetch(3). Indeed, there are 5 calls to malloc(3) in the source code of the lib : - in common.c, line 263, which should not cause a leak as the pointer is stored in buf, which is later saved, - in common.c, line 362, in a function which is not used in my app (the file name is known) - in fetch.c, line 377, in a function which is used only for http/https transfers, thus not in my app, - in http.c, line 517, in a function which is used only for http/https transfers, thus not in my app, - finally in ftp.c, line 434, in a suspicious manner : the "io" variable is located on the stack, thus visible only from this function, gets a pointer to a newly allocated ftpio struct and disappears after _ftp_setup() returns. The comparison between usr.bin/compress/zopen.c:zclose() and lib/libfetch/ftp.c:_ftp_close() shows a missing free(cookie) at the end of the function. the following patch seems to cure the memory leak : ----------------------------------------- --- ftp.c.ori Sat Apr 7 19:30:48 2001 +++ ftp.c Mon May 21 15:26:42 2001 @@ -422,7 +422,9 @@ io->err = 0; close(io->csd); io->csd = -1; - return io->err ? -1 : 0; + r = io->err ? -1 : 0; + free(io); + return (r); } static FILE * ----------------------------------------- TfH To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon May 21 22:38:48 2001 Delivered-To: freebsd-audit@freebsd.org Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by hub.freebsd.org (Postfix) with ESMTP id 4790537B424; Mon, 21 May 2001 22:38:44 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.3/8.11.3) with ESMTP id f4M5cZL67529; Tue, 22 May 2001 07:38:35 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: current@freebsd.org, audit@freebsd.org Subject: devfs patch for deleted devices handling From: Poul-Henning Kamp Date: Tue, 22 May 2001 07:38:35 +0200 Message-ID: <67527.990509915@critter> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://phk.freebsd.dk/patch/devfs.patch 20010522 devfs.patch This patch changes the way deletes are managed in DEVFS. This fixes a number of warnings relating to removed cloned devices. It also makes it possible to recreate deleted devices with mknod(2). The major/minor arguments are ignored. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue May 22 16:19:45 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.gmx.net (pop.gmx.net [194.221.183.20]) by hub.freebsd.org (Postfix) with SMTP id 92D8337B422 for ; Tue, 22 May 2001 16:19:40 -0700 (PDT) (envelope-from tmoestl@gmx.net) Received: (qmail 13921 invoked by uid 0); 22 May 2001 23:19:38 -0000 Received: from pd900c63b.dip.t-dialin.net (HELO forge.local) (217.0.198.59) by mail.gmx.net (mail01) with SMTP; 22 May 2001 23:19:38 -0000 Received: from tmm by forge.local with local (Exim 3.20 #1) id 152LRC-0002Ti-00; Wed, 23 May 2001 01:19:38 +0200 Date: Wed, 23 May 2001 01:19:38 +0200 From: Thomas Moestl To: audit@freebsd.org Cc: Dima Dorfman Subject: Re: Patch to remove setgid bit from ipcs(1) Message-ID: <20010523011938.A8824@crow.dom2ip.de> Mail-Followup-To: Thomas Moestl , audit@freebsd.org, Dima Dorfman References: <20010520231752.10A2B3E0B@bazooka.unixfreak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010520231752.10A2B3E0B@bazooka.unixfreak.org>; from dima@unixfreak.org on Sun, May 20, 2001 at 04:17:51PM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 2001/05/20 at 16:17:51 -0700, Dima Dorfman wrote: > Index: sys/kern/sysv_msg.c > =================================================================== > [...] > +SYSCTL_DECL(_kern_ipc); > +SYSCTL_STRUCT(_kern_ipc, OID_AUTO, msginfo, CTLFLAG_RD, &msginfo, msginfo, > + "System V message info"); > +SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_ANYBODY | CTLFLAG_RD, > + NULL, 0, sysctl_msqids, "", "Message queue IDs"); CTLFLAG_ANYBODY is pointless here since this variable is not writable. Reading is allowed for all users (unless the handler implements special restrictions). > Index: sys/kern/sysv_sem.c > =================================================================== > RCS file: /stl/src/FreeBSD/src/sys/kern/sysv_sem.c,v > retrieving revision 1.32 > diff -u -r1.32 sysv_sem.c > --- sys/kern/sysv_sem.c 2001/02/21 06:39:54 1.32 > +++ sys/kern/sysv_sem.c 2001/05/20 22:54:55 > @@ -28,6 +28,7 @@ > static int sysvsem_modload __P((struct module *, int, void *)); > static int semunload __P((void)); > static void semexit_myhook __P((struct proc *p)); > +static int sysctl_sema __P((SYSCTL_HANDLER_ARGS)); > > #ifndef _SYS_SYSPROTO_H_ > struct __semctl_args; > @@ -148,6 +149,9 @@ > SYSCTL_INT(_kern_ipc, OID_AUTO, semusz, CTLFLAG_RD, &seminfo.semusz, 0, ""); > SYSCTL_INT(_kern_ipc, OID_AUTO, semvmx, CTLFLAG_RW, &seminfo.semvmx, 0, ""); > SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RW, &seminfo.semaem, 0, ""); > +SYSCTL_STRUCT(_kern_ipc, OID_AUTO, seminfo, CTLFLAG_RD, &seminfo, seminfo, ""); Hmm, it seems to me that we export all members of this structure, so why export it again as a whole? While it might be better to pack things into a structure (which may however introduce problems when the structure changes), I'm not sure whether should really export this more than once just because of that. This also seems to apply to shared memory part. > Index: usr.bin/ipcs/ipcs.c > =================================================================== > [...] > static struct nlist symbols[] = { > @@ -63,16 +67,14 @@ > #define X_SEMA 0 > {"_seminfo"}, > #define X_SEMINFO 1 > - {"_semu"}, > -#define X_SEMU 2 > {"_msginfo"}, > -#define X_MSGINFO 3 > +#define X_MSGINFO 2 > {"_msqids"}, > -#define X_MSQIDS 4 > +#define X_MSQIDS 3 > {"_shminfo"}, > -#define X_SHMINFO 5 > +#define X_SHMINFO 4 > {"_shmsegs"}, > -#define X_SHMSEGS 6 > +#define X_SHMSEGS 5 > {NULL} > }; I think you can safely remove the underscores, they are not needed any more. > void > +kget(idx, addr, size) > + int idx; > + void *addr; > + size_t size; > +{ > [...] > + if (rv != tsiz) > + errx(1, "%s: %s", symn, kvm_geterr(kd)); > + if (kvm_read(kd, kaddr, addr, size) != size) > + errx(1, "%s: %s", symn, kvm_geterr(kd)); I think the error message is redundant here, since you have passed an error string to kvm_open (which causes kvm library routines to print errors to stderr). Maybe printing the symbol name and just exiting should be sufficient. The error buffer seems not even to be filled when that string is set. > + } else { > + tsiz = size; > + if (sysctlbyname(sym2sysctl[idx], addr, &tsiz, NULL, 0) > + == -1) > + err(1, "sysctlbyname: %s", sym2sysctl[idx]); > + } > +} I think you should check that the size that we read is actually the one we expected (if (tsiz != size) barf();). Apart from these few nits, nice work! It's really cool to have one less of those setgid beasts, especially a non-trivial one. - thomas To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue May 22 20:29:30 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 8DD1737B424 for ; Tue, 22 May 2001 20:29:24 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from spike.unixfreak.org (spike [63.198.170.139]) by bazooka.unixfreak.org (Postfix) with ESMTP id 3878C3E7D; Tue, 22 May 2001 20:29:24 -0700 (PDT) To: Thomas Moestl , audit@freebsd.org Subject: Re: Patch to remove setgid bit from ipcs(1) In-Reply-To: <20010523011938.A8824@crow.dom2ip.de>; from tmoestl@gmx.net on "Wed, 23 May 2001 01:19:38 +0200" Date: Tue, 22 May 2001 20:29:24 -0700 From: Dima Dorfman Message-Id: <20010523032924.3878C3E7D@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thomas Moestl writes: > On Sun, 2001/05/20 at 16:17:51 -0700, Dima Dorfman wrote: > > Index: sys/kern/sysv_msg.c > > =================================================================== > > [...] > > +SYSCTL_DECL(_kern_ipc); > > +SYSCTL_STRUCT(_kern_ipc, OID_AUTO, msginfo, CTLFLAG_RD, &msginfo, msginfo, > > + "System V message info"); > > +SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_ANYBODY | CTLFLAG_RD, > > + NULL, 0, sysctl_msqids, "", "Message queue IDs"); > > CTLFLAG_ANYBODY is pointless here since this variable is not > writable. Reading is allowed for all users (unless the handler > implements special restrictions). Indeed. I'll get rid of that. > > > Index: sys/kern/sysv_sem.c > > =================================================================== > > RCS file: /stl/src/FreeBSD/src/sys/kern/sysv_sem.c,v > > retrieving revision 1.32 > > diff -u -r1.32 sysv_sem.c > > --- sys/kern/sysv_sem.c 2001/02/21 06:39:54 1.32 > > +++ sys/kern/sysv_sem.c 2001/05/20 22:54:55 > > @@ -28,6 +28,7 @@ > > static int sysvsem_modload __P((struct module *, int, void *)); > > static int semunload __P((void)); > > static void semexit_myhook __P((struct proc *p)); > > +static int sysctl_sema __P((SYSCTL_HANDLER_ARGS)); > > > > #ifndef _SYS_SYSPROTO_H_ > > struct __semctl_args; > > @@ -148,6 +149,9 @@ > > SYSCTL_INT(_kern_ipc, OID_AUTO, semusz, CTLFLAG_RD, &seminfo.semusz, 0, "" > ); > > SYSCTL_INT(_kern_ipc, OID_AUTO, semvmx, CTLFLAG_RW, &seminfo.semvmx, 0, "" > ); > > SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RW, &seminfo.semaem, 0, "" > ); > > +SYSCTL_STRUCT(_kern_ipc, OID_AUTO, seminfo, CTLFLAG_RD, &seminfo, seminfo, > ""); > > Hmm, it seems to me that we export all members of this structure, so > why export it again as a whole? While it might be better to pack things > into a structure (which may however introduce problems when the > structure changes), I'm not sure whether should really export this > more than once just because of that. > This also seems to apply to shared memory part. It's a compromise between exorting the entire structure or complicating the userland part to do sysctl on all the different fields and construct the structure itself. This was the simpler approach, which is why I chose it. Do you think it's worth complicating the kget() routine instead? > > > Index: usr.bin/ipcs/ipcs.c > > =================================================================== > > [...] > > static struct nlist symbols[] = { > > @@ -63,16 +67,14 @@ > > #define X_SEMA 0 > > {"_seminfo"}, > > #define X_SEMINFO 1 > > - {"_semu"}, > > -#define X_SEMU 2 > > {"_msginfo"}, > > -#define X_MSGINFO 3 > > +#define X_MSGINFO 2 > > {"_msqids"}, > > -#define X_MSQIDS 4 > > +#define X_MSQIDS 3 > > {"_shminfo"}, > > -#define X_SHMINFO 5 > > +#define X_SHMINFO 4 > > {"_shmsegs"}, > > -#define X_SHMSEGS 6 > > +#define X_SHMSEGS 5 > > {NULL} > > }; > > I think you can safely remove the underscores, they are not needed any > more. Fair enough. I tried to leave alone as many things as I could, but I guess this is the best time to do that. > > > void > > +kget(idx, addr, size) > > + int idx; > > + void *addr; > > + size_t size; > > +{ > > [...] > > + if (rv != tsiz) > > + errx(1, "%s: %s", symn, kvm_geterr(kd)); > > + if (kvm_read(kd, kaddr, addr, size) != size) > > + errx(1, "%s: %s", symn, kvm_geterr(kd)); > > I think the error message is redundant here, since you have passed an > error string to kvm_open (which causes kvm library routines to print > errors to stderr). Maybe printing the symbol name and just exiting > should be sufficient. The error buffer seems not even to be filled > when that string is set. This is indeed the documented behavior, but this isn't how the libkvm code behaves. If I stick a "kaddr = 0;" right above that block, I get the expected output: dima@spike% sudo ./ipcs -y ipcs: msginfo: kvm_read: Bad address I can confirm that it is indeed the errx that is printing that. Am I missing something, or is libkvm doing the wrong thing here? > > > + } else { > > + tsiz = size; > > + if (sysctlbyname(sym2sysctl[idx], addr, &tsiz, NULL, 0) > > + == -1) > > + err(1, "sysctlbyname: %s", sym2sysctl[idx]); > > + } > > +} > > I think you should check that the size that we read is actually the > one we expected (if (tsiz != size) barf();). Good idea. I'll do that. I'll send an updated patch when I/we figure out what to with regards to the sysctl's and the libkvm stuff. Thanks for the input, Dima Dorfman dima@unixfreak.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue May 22 23:31:56 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id A435037B42C for ; Tue, 22 May 2001 23:31:51 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 13222 invoked by uid 1000); 23 May 2001 06:31:00 -0000 Date: Wed, 23 May 2001 09:31:00 +0300 From: Peter Pentchev To: Dima Dorfman Cc: Thomas Moestl , audit@freebsd.org Subject: Re: Patch to remove setgid bit from ipcs(1) Message-ID: <20010523093100.B12889@ringworld.oblivion.bg> Mail-Followup-To: Dima Dorfman , Thomas Moestl , audit@freebsd.org References: <20010523011938.A8824@crow.dom2ip.de> <20010523032924.3878C3E7D@bazooka.unixfreak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010523032924.3878C3E7D@bazooka.unixfreak.org>; from dima@unixfreak.org on Tue, May 22, 2001 at 08:29:24PM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, May 22, 2001 at 08:29:24PM -0700, Dima Dorfman wrote: > > > > > Index: sys/kern/sysv_sem.c > > > =================================================================== > > > RCS file: /stl/src/FreeBSD/src/sys/kern/sysv_sem.c,v > > > retrieving revision 1.32 > > > diff -u -r1.32 sysv_sem.c > > > --- sys/kern/sysv_sem.c 2001/02/21 06:39:54 1.32 > > > +++ sys/kern/sysv_sem.c 2001/05/20 22:54:55 > > > @@ -28,6 +28,7 @@ > > > static int sysvsem_modload __P((struct module *, int, void *)); > > > static int semunload __P((void)); > > > static void semexit_myhook __P((struct proc *p)); > > > +static int sysctl_sema __P((SYSCTL_HANDLER_ARGS)); > > > > > > #ifndef _SYS_SYSPROTO_H_ > > > struct __semctl_args; > > > @@ -148,6 +149,9 @@ > > > SYSCTL_INT(_kern_ipc, OID_AUTO, semusz, CTLFLAG_RD, &seminfo.semusz, 0, "" > > ); > > > SYSCTL_INT(_kern_ipc, OID_AUTO, semvmx, CTLFLAG_RW, &seminfo.semvmx, 0, "" > > ); > > > SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RW, &seminfo.semaem, 0, "" > > ); > > > +SYSCTL_STRUCT(_kern_ipc, OID_AUTO, seminfo, CTLFLAG_RD, &seminfo, seminfo, > > ""); > > > > Hmm, it seems to me that we export all members of this structure, so > > why export it again as a whole? While it might be better to pack things > > into a structure (which may however introduce problems when the > > structure changes), I'm not sure whether should really export this > > more than once just because of that. > > This also seems to apply to shared memory part. > > It's a compromise between exorting the entire structure or > complicating the userland part to do sysctl on all the different > fields and construct the structure itself. This was the simpler > approach, which is why I chose it. Do you think it's worth > complicating the kget() routine instead? Wouldn't exporting the whole structure lead to one more of those userland dependencies on the kernel? Not that I expect the shm kernel structs to change way too often, but still, exporting a whole structure does require that the userland program know the exact structure layout. Have you looked at another way - an opaque sysctl with contents generated on-the-fly by a reader function? This sysctl would contain all the userland-needed data, and only that data, and its format would not change when the kernel structure layout is changed. It could even have some kind of version/size tag at the start - or maybe that would be overkill.. Just random thoughts.. :) G'luck, Peter -- because I didn't think of a good beginning of it. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed May 23 8:48: 2 2001 Delivered-To: freebsd-audit@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 9D7A137B424; Wed, 23 May 2001 08:47:52 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.2/8.11.2) id f4NFlnR31340; Wed, 23 May 2001 18:47:49 +0300 (EEST) (envelope-from ru) Date: Wed, 23 May 2001 18:47:49 +0300 From: Ruslan Ermilov To: audit@FreeBSD.org Cc: dg@FreeBSD.org Subject: last(1) patch Message-ID: <20010523184749.A30464@sunbay.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi! The last(1) chokes if there are two successive "login" marks found in wtmp(5) (for the same tty) without in-between "logout" mark. This may be demonstrated by executing /usr/bin/login (not the built-in shell's ``login''), logging in, and watching the last(1) output for this tty. Then exit _twice_, and watch the last(1) output again. The patch merely takes the second "login" mark as the end for the first "login" mark, if there is no "logout" mark in-between. This restores the behavior of last.c, revision 1.2. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: last.c =================================================================== RCS file: /home/ncvs/src/usr.bin/last/last.c,v retrieving revision 1.10.6.2 diff -u -p -r1.10.6.2 last.c --- last.c 2001/03/04 08:39:25 1.10.6.2 +++ last.c 2001/05/21 10:10:35 @@ -309,13 +309,10 @@ wtmp() delta / 86400, width, width, ct + 11); } } - LIST_REMOVE(tt, list); - free(tt); if (maxrec != -1 && !--maxrec) return; - } else { - tt->logout = bp->ut_time; } + tt->logout = bp->ut_time; } } } --k1lZvvs/B4yU6o8G-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed May 23 8:52:27 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.gmx.net (pop.gmx.net [194.221.183.20]) by hub.freebsd.org (Postfix) with SMTP id C680737B423 for ; Wed, 23 May 2001 08:52:23 -0700 (PDT) (envelope-from tmoestl@gmx.net) Received: (qmail 3127 invoked by uid 0); 23 May 2001 15:52:22 -0000 Received: from p3e9d4529.dip.t-dialin.net (HELO forge.local) (62.157.69.41) by mail.gmx.net (mp002-rz3) with SMTP; 23 May 2001 15:52:22 -0000 Received: from tmm by forge.local with local (Exim 3.20 #1) id 152avt-0000Uk-00; Wed, 23 May 2001 17:52:21 +0200 Date: Wed, 23 May 2001 17:52:21 +0200 From: Thomas Moestl To: audit@freebsd.org Cc: Dima Dorfman Subject: Re: Patch to remove setgid bit from ipcs(1) Message-ID: <20010523175221.C594@crow.dom2ip.de> Mail-Followup-To: Thomas Moestl , audit@freebsd.org, Dima Dorfman References: <20010523033507.47C433E6B@bazooka.unixfreak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010523033507.47C433E6B@bazooka.unixfreak.org>; from dima@unixfreak.org on Tue, May 22, 2001 at 08:35:07PM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 2001/05/22 at 20:35:07 -0700, Dima Dorfman wrote: > > Hmm, it seems to me that we export all members of this structure, so > > why export it again as a whole? While it might be better to pack things > > into a structure (which may however introduce problems when the > > structure changes), I'm not sure whether should really export this > > more than once just because of that. > > This also seems to apply to shared memory part. > > It's a compromise between exorting the entire structure or > complicating the userland part to do sysctl on all the different > fields and construct the structure itself. This was the simpler > approach, which is why I chose it. Do you think it's worth > complicating the kget() routine instead? Hmm. I don't really know. On any case, the separate sysctls need to stay because some of them are writable. Some message queue parameters might become tunable too some day, so if you decide to gather the information from separate variables, it might be better to export the message queue ones this way, too. I don't really like having duplicate data in the sysctl tree, OTOH it is a valid point that many applications would want to know all data at once and would thus need to do many more syscalls. Still... I don't like that ;) Anybody else having an opinion on this? > > I think the error message is redundant here, since you have passed an > > error string to kvm_open (which causes kvm library routines to print > > errors to stderr). Maybe printing the symbol name and just exiting > > should be sufficient. The error buffer seems not even to be filled > > when that string is set. > > This is indeed the documented behavior, but this isn't how the libkvm > code behaves. If I stick a "kaddr = 0;" right above that block, I get > the expected output: > > dima@spike% sudo ./ipcs -y > ipcs: msginfo: kvm_read: Bad address > > I can confirm that it is indeed the errx that is printing that. Am I > missing something, or is libkvm doing the wrong thing here? kvm_read seems to call kvm_[sys]err sometimes with the error string provided by the function, and sometimes with 0 as the program argument (where the 0 causes nothing to be written to stderr and the internal error string to be set). I'm not entirely sure why it is this way; it might be for Sun compatability as indicated by the manual page. I would suggest to use kvm_openfiles instead of kvm_open and always do explicit error reporting (which would only mean to add an errx() to kvm_openfiles(), as anything else already seems to do this). I'm sorry I got this wrong originally; although I had looked at the libkvm source, I missed it. - thomas To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed May 23 16:29:57 2001 Delivered-To: freebsd-audit@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 9A56937B422; Wed, 23 May 2001 16:29:53 -0700 (PDT) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.11.3/8.11.3) id f4NNTXV76734; Thu, 24 May 2001 03:29:34 +0400 (MSD) (envelope-from ache) Date: Thu, 24 May 2001 03:29:27 +0400 From: "Andrey A. Chernov" To: Noriyuki Soda Cc: i18n@FreeBSD.ORG, audit@FreeBSD.ORG, bsd-locale@hauN.org Subject: Re: CFR: ISO_* -> ISO-* locale renaming Message-ID: <20010524032926.A76116@nagual.pp.ru> References: <20010518203702.B79058@nagual.pp.ru> <20010519050946U.tshiozak@din.or.jp> <200105182238.HAA29872@srapc342.sra.co.jp> <20010519031612.B83245@nagual.pp.ru> <200105182356.IAA00242@srapc342.sra.co.jp> <200105190022.JAA00323@srapc342.sra.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200105190022.JAA00323@srapc342.sra.co.jp>; from soda@sra.co.jp on Sat, May 19, 2001 at 09:22:08AM +0900 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, May 19, 2001 at 09:22:08 +0900, Noriyuki Soda wrote: > Please use the Citrus project as the 3rd party which maintains > codeset name. Actually, that is the reason why citrus project > maintains unified source tree for both FreeBSD, NetBSD and OpenBSD. > We, Citrus project, are trying to keep consistency between > all BSDs, and trying to keep consistency with rest of the > world, if it is possible. Could you please point me to current Citrus codeset registry? In few words, what it have in common with other systems and what are the differences? How someone can submit new codeset there? -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed May 23 16:31:58 2001 Delivered-To: freebsd-audit@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id A893137B422; Wed, 23 May 2001 16:31:53 -0700 (PDT) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.11.3/8.11.3) id f4NNVjf78072; Thu, 24 May 2001 03:31:47 +0400 (MSD) (envelope-from ache) Date: Thu, 24 May 2001 03:31:39 +0400 From: "Andrey A. Chernov" To: Noriyuki Soda Cc: i18n@FreeBSD.ORG, audit@FreeBSD.ORG, bsd-locale@hauN.org Subject: Re: CFR: ISO_* -> ISO-* locale renaming Message-ID: <20010524033139.B76116@nagual.pp.ru> References: <20010518203702.B79058@nagual.pp.ru> <20010519050946U.tshiozak@din.or.jp> <200105182238.HAA29872@srapc342.sra.co.jp> <20010519031612.B83245@nagual.pp.ru> <200105182356.IAA00242@srapc342.sra.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200105182356.IAA00242@srapc342.sra.co.jp>; from soda@sra.co.jp on Sat, May 19, 2001 at 08:56:54AM +0900 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, May 19, 2001 at 08:56:54 +0900, Noriyuki Soda wrote: > : At this point, I don't know the answer to your question, > : but am trying to see if someone else within The Open Group > : can help you. > : > : We will get back to you within the next couple of days. > > How about waiting for her answer for a while? > Do you got an answer from OpenGroup at this moment? -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed May 23 19:41:12 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id B2A1B37B424; Wed, 23 May 2001 19:40:52 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from spike.unixfreak.org (spike [63.198.170.139]) by bazooka.unixfreak.org (Postfix) with ESMTP id A40E83E8E; Wed, 23 May 2001 19:40:51 -0700 (PDT) To: Thomas Moestl , audit@freebsd.org Subject: Re: Patch to remove setgid bit from ipcs(1) In-Reply-To: <20010523175221.C594@crow.dom2ip.de>; from tmm@freebsd.org on "Wed, 23 May 2001 17:52:21 +0200" Date: Wed, 23 May 2001 19:40:51 -0700 From: Dima Dorfman Message-Id: <20010524024051.A40E83E8E@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thomas Moestl writes: > On Tue, 2001/05/22 at 20:35:07 -0700, Dima Dorfman wrote: > > > Hmm, it seems to me that we export all members of this structure, so > > > why export it again as a whole? While it might be better to pack things > > > into a structure (which may however introduce problems when the > > > structure changes), I'm not sure whether should really export this > > > more than once just because of that. > > > This also seems to apply to shared memory part. > > > > It's a compromise between exorting the entire structure or > > complicating the userland part to do sysctl on all the different > > fields and construct the structure itself. This was the simpler > > approach, which is why I chose it. Do you think it's worth > > complicating the kget() routine instead? > > Hmm. I don't really know. On any case, the separate sysctls need to > stay because some of them are writable. Some message queue parameters > might become tunable too some day, so if you decide to gather the > information from separate variables, it might be better to export > the message queue ones this way, too. > I don't really like having duplicate data in the sysctl tree, OTOH it > is a valid point that many applications would want to know all data > at once and would thus need to do many more syscalls. Still... I don't > like that ;) I wasn't terribly concerned with performance; rather, I was concerned with maintainability. And I didn't particuarly like it, either. All that said, I think I might've found a happy medium. With a little preprocessor magic in ipcs(1), I can make it maintainable without having to export the data as a structure. Essentially, the new function sysctlgatherstruct() takes a pointer to the structure to fill in, the size, and an array of "vectors"; one for every field that needs to be filled in. The latter has information on which sysctl to use to get the information, the size, and where in the structure it should be put. One thing I don't really like is that the code in the userland is now quite a bit bigger (and, since I tried to make sysctlgatherstruct generic so it can potentially be used in another program, it's probably a little bigger than it could've been), but I think it's worth it to lose the setgid bit; once that's done, it is no longer much of a threat to security. I've attached an updated patch. It incorporates all of your suggestions, including exporting the individual fields rather than the structure as described above. Comments? Suggestions? Thanks, Dima Dorfman dima@unixfreak.org Index: sys/kern/sysv_msg.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sysv_msg.c,v retrieving revision 1.30 diff -u -r1.30 sysv_msg.c --- sys/kern/sysv_msg.c 2001/02/21 06:39:54 1.30 +++ sys/kern/sysv_msg.c 2001/05/24 02:37:42 @@ -1166,3 +1166,21 @@ p->p_retval[0] = msgsz; return(0); } + +static int +sysctl_msqids(SYSCTL_HANDLER_ARGS) +{ + + return (SYSCTL_OUT(req, msqids, + sizeof(struct msqid_ds) * msginfo.msgmni)); +} + +SYSCTL_DECL(_kern_ipc); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgmax, CTLFLAG_RD, &msginfo.msgmax, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgmni, CTLFLAG_RD, &msginfo.msgmni, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgmnb, CTLFLAG_RD, &msginfo.msgmnb, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgtql, CTLFLAG_RD, &msginfo.msgtql, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgssz, CTLFLAG_RD, &msginfo.msgssz, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgseg, CTLFLAG_RD, &msginfo.msgseg, 0, "") +SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_ANYBODY | CTLFLAG_RD, + NULL, 0, sysctl_msqids, "", "Message queue IDs"); Index: sys/kern/sysv_sem.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sysv_sem.c,v retrieving revision 1.32 diff -u -r1.32 sysv_sem.c --- sys/kern/sysv_sem.c 2001/02/21 06:39:54 1.32 +++ sys/kern/sysv_sem.c 2001/05/24 02:37:42 @@ -28,6 +28,7 @@ static int sysvsem_modload __P((struct module *, int, void *)); static int semunload __P((void)); static void semexit_myhook __P((struct proc *p)); +static int sysctl_sema __P((SYSCTL_HANDLER_ARGS)); #ifndef _SYS_SYSPROTO_H_ struct __semctl_args; @@ -148,6 +149,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, semusz, CTLFLAG_RD, &seminfo.semusz, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, semvmx, CTLFLAG_RW, &seminfo.semvmx, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RW, &seminfo.semaem, 0, ""); +SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, CTLFLAG_RD | CTLFLAG_ANYBODY, + NULL, 0, sysctl_sema, "", ""); #if 0 RO seminfo.semmap /* SEMMAP unused */ @@ -1065,4 +1068,12 @@ #endif suptr->un_proc = NULL; *supptr = suptr->un_next; +} + +static int +sysctl_sema(SYSCTL_HANDLER_ARGS) +{ + + return (SYSCTL_OUT(req, sema, + sizeof(struct semid_ds) * seminfo.semmni)); } Index: sys/kern/sysv_shm.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sysv_shm.c,v retrieving revision 1.60 diff -u -r1.60 sysv_shm.c --- sys/kern/sysv_shm.c 2001/05/23 23:38:05 1.60 +++ sys/kern/sysv_shm.c 2001/05/24 02:37:42 @@ -104,6 +104,7 @@ static int shmunload __P((void)); static void shmexit_myhook __P((struct proc *p)); static void shmfork_myhook __P((struct proc *p1, struct proc *p2)); +static int sysctl_shmsegs __P((SYSCTL_HANDLER_ARGS)); /* * Tuneable values. @@ -145,6 +146,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, shm_use_phys, CTLFLAG_RW, &shm_use_phys, 0, ""); +SYSCTL_PROC(_kern_ipc, OID_AUTO, shmsegs, CTLFLAG_RD, + NULL, 0, sysctl_shmsegs, "", ""); static int shm_find_segment_by_key(key) @@ -740,6 +743,13 @@ shmexit_hook = NULL; shmfork_hook = NULL; return (0); +} + +static int +sysctl_shmsegs(SYSCTL_HANDLER_ARGS) +{ + + return (SYSCTL_OUT(req, shmsegs, shmalloced * sizeof(shmsegs[0]))); } static int Index: usr.bin/ipcs/ipcs.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/ipcs/ipcs.1,v retrieving revision 1.11 diff -u -r1.11 ipcs.1 --- usr.bin/ipcs/ipcs.1 2000/12/14 11:49:46 1.11 +++ usr.bin/ipcs/ipcs.1 2001/05/24 02:37:43 @@ -37,7 +37,7 @@ .Nd report System V interprocess communication facilities status .Sh SYNOPSIS .Nm -.Op Fl abcmopqstMQST +.Op Fl abcmopqstMQSTy .Op Fl C Ar system .Op Fl N Ar core .Sh DESCRIPTION @@ -101,12 +101,16 @@ Extract the name list from the specified system instead of the default .Dq Pa /kernel . +Implies +.Fl y . .It Fl M Display system information about shared memory. .It Fl N Ar core Extract values associated with the name list from the specified core instead of the default .Dq Pa /dev/kmem . +Implies +.Fl y . .It Fl Q Display system information about messages queues. .It Fl S @@ -114,6 +118,19 @@ .It Fl T Display system information about shared memory, message queues and semaphores. +.It Fl y +Use the +.Xr kvm 3 +interface instead of the +.Xr sysctl 3 +interface to extract the required information. +If +.Nm +is to operate on the running system, +using +.Xr kvm 3 +will require read privileges to +.Pa /dev/kmem . .El .Pp If none of the Index: usr.bin/ipcs/ipcs.c =================================================================== RCS file: /home/ncvs/src/usr.bin/ipcs/ipcs.c,v retrieving revision 1.14 diff -u -r1.14 ipcs.c --- usr.bin/ipcs/ipcs.c 2000/05/01 10:49:41 1.14 +++ usr.bin/ipcs/ipcs.c 2001/05/24 02:37:43 @@ -30,11 +30,14 @@ "$FreeBSD: src/usr.bin/ipcs/ipcs.c,v 1.14 2000/05/01 10:49:41 peter Exp $"; #endif /* not lint */ +#include #include #include #include #include +#include #include +#include #include #include #include @@ -43,12 +46,21 @@ #include #include #include +#include #define _KERNEL #include #include #include #include +/* SysCtlGatherStruct structure. */ +struct scgs_vector { + char *sysctl; + off_t offset; + size_t size; +}; + +int use_sysctl = 1; struct semid_ds *sema; struct seminfo seminfo; struct msginfo msginfo; @@ -56,26 +68,66 @@ struct shminfo shminfo; struct shmid_ds *shmsegs; +void sysctlgatherstruct __P((void *addr, size_t size, + struct scgs_vector *vec)); +void kget __P((int idx, void *addr, size_t size)); void usage __P((void)); static struct nlist symbols[] = { - {"_sema"}, + {"sema"}, #define X_SEMA 0 - {"_seminfo"}, + {"seminfo"}, #define X_SEMINFO 1 - {"_semu"}, -#define X_SEMU 2 - {"_msginfo"}, -#define X_MSGINFO 3 - {"_msqids"}, -#define X_MSQIDS 4 - {"_shminfo"}, -#define X_SHMINFO 5 - {"_shmsegs"}, -#define X_SHMSEGS 6 + {"msginfo"}, +#define X_MSGINFO 2 + {"msqids"}, +#define X_MSQIDS 3 + {"shminfo"}, +#define X_SHMINFO 4 + {"shmsegs"}, +#define X_SHMSEGS 5 {NULL} }; +#define SHMINFO_XVEC \ +X(shmmax, sizeof(int)) \ +X(shmmin, sizeof(int)) \ +X(shmmni, sizeof(int)) \ +X(shmseg, sizeof(int)) \ +X(shmall, sizeof(int)) + +#define SEMINFO_XVEC \ +X(semmap, sizeof(int)) \ +X(semmni, sizeof(int)) \ +X(semmns, sizeof(int)) \ +X(semmnu, sizeof(int)) \ +X(semmsl, sizeof(int)) \ +X(semopm, sizeof(int)) \ +X(semume, sizeof(int)) \ +X(semusz, sizeof(int)) \ +X(semvmx, sizeof(int)) \ +X(semaem, sizeof(int)) + +#define MSGINFO_XVEC \ +X(msgmax, sizeof(int)) \ +X(msgmni, sizeof(int)) \ +X(msgmnb, sizeof(int)) \ +X(msgtql, sizeof(int)) \ +X(msgssz, sizeof(int)) \ +X(msgseg, sizeof(int)) + +#define X(a, b) { "kern.ipc." #a, offsetof(TYPEC, a), (b) }, +#define TYPEC struct shminfo +struct scgs_vector shminfo_scgsv[] = { SHMINFO_XVEC { NULL } }; +#undef TYPEC +#define TYPEC struct seminfo +struct scgs_vector seminfo_scgsv[] = { SEMINFO_XVEC { NULL } }; +#undef TYPEC +#define TYPEC struct msginfo +struct scgs_vector msginfo_scgsv[] = { MSGINFO_XVEC { NULL } }; +#undef TYPEC +#undef X + static kvm_t *kd; char * @@ -135,9 +187,10 @@ int display = SHMINFO | MSGINFO | SEMINFO; int option = 0; char *core = NULL, *namelist = NULL; + char kvmoferr[_POSIX2_LINE_MAX]; /* Error buf for kvm_openfiles. */ int i; - while ((i = getopt(argc, argv, "MmQqSsabC:cN:optT")) != -1) + while ((i = getopt(argc, argv, "MmQqSsabC:cN:optTy")) != -1) switch (i) { case 'M': display = SHMTOTAL; @@ -184,39 +237,44 @@ case 't': option |= TIME; break; + case 'y': + use_sysctl = 0; + break; default: usage(); } /* - * Discard setgid privileges if not the running kernel so that bad - * guys can't print interesting stuff from kernel memory. + * If paths to the exec file or core file were specified, we + * aren't operating on the running kernel, so we can't use + * sysctl. */ if (namelist != NULL || core != NULL) - setgid(getgid()); - - if ((kd = kvm_open(namelist, core, NULL, O_RDONLY, "ipcs")) == NULL) - exit(1); + use_sysctl = 0; - switch (kvm_nlist(kd, symbols)) { - case 0: - break; - case -1: - errx(1, "unable to read kernel symbol table"); - default: + if (!use_sysctl) { + kd = kvm_openfiles(namelist, core, NULL, O_RDONLY, kvmoferr); + if (kd == NULL) + errx(1, "kvm_openfiles: %s", kvmoferr); + switch (kvm_nlist(kd, symbols)) { + case 0: + break; + case -1: + errx(1, "unable to read kernel symbol table"); + default: #ifdef notdef /* they'll be told more civilly later */ - warnx("nlist failed"); - for (i = 0; symbols[i].n_name != NULL; i++) - if (symbols[i].n_value == 0) - warnx("symbol %s not found", - symbols[i].n_name); - break; + warnx("nlist failed"); + for (i = 0; symbols[i].n_name != NULL; i++) + if (symbols[i].n_value == 0) + warnx("symbol %s not found", + symbols[i].n_name); + break; #endif + } } - if ((display & (MSGINFO | MSGTOTAL)) && - kvm_read(kd, symbols[X_MSGINFO].n_value, &msginfo, sizeof(msginfo))== sizeof(msginfo)) { - + kget(X_MSGINFO, &msginfo, sizeof(msginfo)); + if ((display & (MSGINFO | MSGTOTAL))) { if (display & MSGTOTAL) { printf("msginfo:\n"); printf("\tmsgmax: %6d\t(max characters in a message)\n", @@ -234,10 +292,12 @@ } if (display & MSGINFO) { struct msqid_ds *xmsqids; + size_t xmsqids_len; + - kvm_read(kd, symbols[X_MSQIDS].n_value, &msqids, sizeof(msqids)); - xmsqids = malloc(sizeof(struct msqid_ds) * msginfo.msgmni); - kvm_read(kd, (u_long) msqids, xmsqids, sizeof(struct msqid_ds) * msginfo.msgmni); + xmsqids_len = sizeof(struct msqid_ds) * msginfo.msgmni; + xmsqids = malloc(xmsqids_len); + kget(X_MSQIDS, xmsqids, xmsqids_len); printf("Message Queues:\n"); printf("T ID KEY MODE OWNER GROUP"); @@ -304,8 +364,9 @@ fprintf(stderr, "SVID messages facility not configured in the system\n"); } - if ((display & (SHMINFO | SHMTOTAL)) && - kvm_read(kd, symbols[X_SHMINFO].n_value, &shminfo, sizeof(shminfo))) { + + kget(X_SHMINFO, &shminfo, sizeof(shminfo)); + if ((display & (SHMINFO | SHMTOTAL))) { if (display & SHMTOTAL) { printf("shminfo:\n"); printf("\tshmmax: %7d\t(max shared memory segment size)\n", @@ -321,11 +382,11 @@ } if (display & SHMINFO) { struct shmid_ds *xshmids; + size_t xshmids_len; - kvm_read(kd, symbols[X_SHMSEGS].n_value, &shmsegs, sizeof(shmsegs)); - xshmids = malloc(sizeof(struct shmid_ds) * shminfo.shmmni); - kvm_read(kd, (u_long) shmsegs, xshmids, sizeof(struct shmid_ds) * - shminfo.shmmni); + xshmids_len = sizeof(struct shmid_ds) * shminfo.shmmni; + xshmids = malloc(xshmids_len); + kget(X_SHMSEGS, xshmids, xshmids_len); printf("Shared Memory:\n"); printf("T ID KEY MODE OWNER GROUP"); @@ -391,9 +452,11 @@ fprintf(stderr, "SVID shared memory facility not configured in the system\n"); } - if ((display & (SEMINFO | SEMTOTAL)) && - kvm_read(kd, symbols[X_SEMINFO].n_value, &seminfo, sizeof(seminfo))) { + + kget(X_SEMINFO, &seminfo, sizeof(seminfo)); + if ((display & (SEMINFO | SEMTOTAL))) { struct semid_ds *xsema; + size_t xsema_len; if (display & SEMTOTAL) { printf("seminfo:\n"); @@ -419,9 +482,9 @@ seminfo.semaem); } if (display & SEMINFO) { - kvm_read(kd, symbols[X_SEMA].n_value, &sema, sizeof(sema)); - xsema = malloc(sizeof(struct semid_ds) * seminfo.semmni); - kvm_read(kd, (u_long) sema, xsema, sizeof(struct semid_ds) * seminfo.semmni); + xsema_len = sizeof(struct semid_ds) * seminfo.semmni; + xsema = malloc(xsema_len); + kget(X_SEMA, xsema, xsema_len); printf("Semaphores:\n"); printf("T ID KEY MODE OWNER GROUP"); @@ -471,16 +534,122 @@ if (display & (SEMINFO | SEMTOTAL)) { fprintf(stderr, "SVID semaphores facility not configured in the system\n"); } - kvm_close(kd); + if (!use_sysctl) + kvm_close(kd); exit(0); } void +sysctlgatherstruct(addr, size, vecarr) + void *addr; + size_t size; + struct scgs_vector *vecarr; +{ + struct scgs_vector *xp; + int tsiz, rv; + + for (xp = vecarr; xp->sysctl != NULL; xp++) { + assert(xp->offset <= size); + tsiz = xp->size; + rv = sysctlbyname(xp->sysctl, addr + xp->offset, &tsiz, + NULL, 0); + if (rv == -1) + errx(1, "sysctlbyname: %s", xp->sysctl); + if (tsiz != xp->size) + errx(1, "%s size mismatch (expected %d, got %d)", + xp->sysctl, xp->size, tsiz); + } +} + +void +kget(idx, addr, size) + int idx; + void *addr; + size_t size; +{ + char *symn; /* symbol name */ + int rv, tsiz; + unsigned long kaddr; + char *sym2sysctl[] = { /* symbol to sysctl name table */ + "kern.ipc.sema", + "kern.ipc.seminfo", + "kern.ipc.msginfo", + "kern.ipc.msqids", + "kern.ipc.shminfo", + "kern.ipc.shmsegs" }; + + assert(idx <= sizeof(sym2sysctl) / sizeof(*sym2sysctl)); + if (!use_sysctl) { + symn = symbols[idx].n_name; + if (*symn == '_') + symn++; + if (symbols[idx].n_type == 0 || symbols[idx].n_value == 0) + errx(1, "symbol %s undefined", symn); + /* + * For some symbols, the value we retreieve is + * actually a pointer; since we want the actual value, + * we have to manually dereference it. + */ + switch (idx) { + case X_MSQIDS: + tsiz = sizeof(msqids); + rv = kvm_read(kd, symbols[idx].n_value, + &msqids, tsiz); + kaddr = (u_long)msqids; + break; + case X_SHMSEGS: + tsiz = sizeof(shmsegs); + rv = kvm_read(kd, symbols[idx].n_value, + &shmsegs, tsiz); + kaddr = (u_long)shmsegs; + break; + case X_SEMA: + tsiz = sizeof(sema); + rv = kvm_read(kd, symbols[idx].n_value, + &sema, tsiz); + kaddr = (u_long)sema; + break; + default: + rv = tsiz = 0; + kaddr = symbols[idx].n_value; + break; + } + if (rv != tsiz) + errx(1, "%s: %s", symn, kvm_geterr(kd)); + if (kvm_read(kd, kaddr, addr, size) != size) + errx(1, "%s: %s", symn, kvm_geterr(kd)); + } else { + switch (idx) { + case X_SHMINFO: + sysctlgatherstruct(addr, size, shminfo_scgsv); + break; + case X_SEMINFO: + sysctlgatherstruct(addr, size, seminfo_scgsv); + break; + case X_MSGINFO: + sysctlgatherstruct(addr, size, msginfo_scgsv); + break; + default: + tsiz = size; + rv = sysctlbyname(sym2sysctl[idx], addr, &tsiz, + NULL, 0); + if (rv == -1) + err(1, "sysctlbyname: %s", sym2sysctl[idx]); + if (tsiz != size) + errx(1, "%s size mismatch " + "(expected %d, got %d)", + sym2sysctl[idx], size, tsiz); + break; + } + } +} + +void usage() { fprintf(stderr, - "usage: ipcs [-abcmopqst] [-C corefile] [-N namelist]\n"); + "usage: ipcs [-abcmopqsty] [-C corefile] [-N namelist]\n"); exit(1); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu May 24 6:36:24 2001 Delivered-To: freebsd-audit@freebsd.org Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by hub.freebsd.org (Postfix) with ESMTP id 6B77437B616; Thu, 24 May 2001 06:36:18 -0700 (PDT) (envelope-from soda@sra.co.jp) Received: from sranhf.sra.co.jp (sranhf [133.137.28.3]) by sraigw.sra.co.jp (8.8.7/3.7W-sraigw) with ESMTP id WAA26253; Thu, 24 May 2001 22:36:12 +0900 (JST) Received: from srapc342.sra.co.jp (root@srapc342 [133.137.28.111]) by sranhf.sra.co.jp (8.8.7/3.6Wbeta7-srambox) with ESMTP id WAA19681; Thu, 24 May 2001 22:36:12 +0900 (JST) Received: (from soda@localhost) by srapc342.sra.co.jp (8.8.8/3.4W-sra) id WAA15144; Thu, 24 May 2001 22:36:11 +0900 (JST) Date: Thu, 24 May 2001 22:36:11 +0900 (JST) Message-Id: <200105241336.WAA15144@srapc342.sra.co.jp> From: Noriyuki Soda To: i18n@FreeBSD.ORG, audit@FreeBSD.ORG Cc: bsd-locale@hauN.org Subject: Re: CFR: ISO_* -> ISO-* locale renaming In-Reply-To: <20010524032926.A76116@nagual.pp.ru> References: <20010518203702.B79058@nagual.pp.ru> <20010519050946U.tshiozak@din.or.jp> <200105182238.HAA29872@srapc342.sra.co.jp> <20010519031612.B83245@nagual.pp.ru> <200105182356.IAA00242@srapc342.sra.co.jp> <200105190022.JAA00323@srapc342.sra.co.jp> <20010524032926.A76116@nagual.pp.ru> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >>>>> On Thu, 24 May 2001 08:29:56 +0900, "Andrey A. Chernov" said: >> Please use the Citrus project as the 3rd party which maintains >> codeset name. Actually, that is the reason why citrus project >> maintains unified source tree for both FreeBSD, NetBSD and OpenBSD. > Could you please point me to current Citrus codeset registry? Please look at xpg4dl/FreeBSD/share/*.src of citrus repository. How to get sources from citrus repository: http://www.haun.org/ml/b-l/a/0/28.html > In few words, what it have in common with other systems and what are the > differences? Citrus use same codeset name with X11's lib/X11/locale/locale.dir. And that is almost completely compatible with existing commercial UNIX implementations. > How someone can submit new codeset there? Please mail to bsd-locale@bsdclub.org. The way to subscribe this list and the achive of this list is described in the following URL: http://www.haun.org/ml/b-l/index.html.en The language used in this mailing list is English. -- soda To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu May 24 6:49: 0 2001 Delivered-To: freebsd-audit@freebsd.org Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by hub.freebsd.org (Postfix) with ESMTP id E4EFF37B422; Thu, 24 May 2001 06:48:55 -0700 (PDT) (envelope-from soda@sra.co.jp) Received: from sranhf.sra.co.jp (sranhf [133.137.28.3]) by sraigw.sra.co.jp (8.8.7/3.7W-sraigw) with ESMTP id WAA26893; Thu, 24 May 2001 22:48:54 +0900 (JST) Received: from srapc342.sra.co.jp (root@srapc342 [133.137.28.111]) by sranhf.sra.co.jp (8.8.7/3.6Wbeta7-srambox) with ESMTP id WAA19705; Thu, 24 May 2001 22:48:53 +0900 (JST) Received: (from soda@localhost) by srapc342.sra.co.jp (8.8.8/3.4W-sra) id WAA15211; Thu, 24 May 2001 22:48:53 +0900 (JST) Date: Thu, 24 May 2001 22:48:53 +0900 (JST) Message-Id: <200105241348.WAA15211@srapc342.sra.co.jp> From: Noriyuki Soda To: i18n@FreeBSD.ORG, audit@FreeBSD.ORG Cc: bsd-locale@hauN.org Subject: Re: CFR: ISO_* -> ISO-* locale renaming In-Reply-To: <20010524033139.B76116@nagual.pp.ru> References: <20010518203702.B79058@nagual.pp.ru> <20010519050946U.tshiozak@din.or.jp> <200105182238.HAA29872@srapc342.sra.co.jp> <20010519031612.B83245@nagual.pp.ru> <200105182356.IAA00242@srapc342.sra.co.jp> <20010524033139.B76116@nagual.pp.ru> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >>>>> On Thu, 24 May 2001 08:31:55 +0900, "Andrey A. Chernov" said: >> : At this point, I don't know the answer to your question, >> : but am trying to see if someone else within The Open Group >> : can help you. >> : >> : We will get back to you within the next couple of days. >> How about waiting for her answer for a while? > Do you got an answer from OpenGroup at this moment? No, not yet. But according to other reliable source, only Japanese codeset names are officialy registered in OpenGroup. BTW, the message from Bruno Haible, which said "the X11 name registry stopped being maintained a few years ago", is simply false as I supposed. You can see that the file is updated in Dec 12, 2000 via the following URL: http://ftp.x.org/pub/R6.6/xc/nls/locale.dir -- soda To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu May 24 12:49:27 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.gmx.net (pop.gmx.net [194.221.183.20]) by hub.freebsd.org (Postfix) with SMTP id 2A42137B42C for ; Thu, 24 May 2001 12:49:23 -0700 (PDT) (envelope-from tmoestl@gmx.net) Received: (qmail 7913 invoked by uid 0); 24 May 2001 19:48:56 -0000 Received: from p3e9bc37e.dip.t-dialin.net (HELO forge.local) (62.155.195.126) by mail.gmx.net (mp004-rz3) with SMTP; 24 May 2001 19:48:56 -0000 Received: from tmm by forge.local with local (Exim 3.20 #1) id 15316k-0000x1-00; Thu, 24 May 2001 21:49:18 +0200 Date: Thu, 24 May 2001 21:49:18 +0200 From: Thomas Moestl To: Dima Dorfman Cc: audit@freebsd.org Subject: Re: Patch to remove setgid bit from ipcs(1) Message-ID: <20010524214918.A2640@crow.dom2ip.de> Mail-Followup-To: Thomas Moestl , Dima Dorfman , audit@freebsd.org References: <20010523175221.C594@crow.dom2ip.de> <20010524024051.A40E83E8E@bazooka.unixfreak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010524024051.A40E83E8E@bazooka.unixfreak.org>; from dima@unixfreak.org on Wed, May 23, 2001 at 07:40:51PM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 2001/05/23 at 19:40:51 -0700, Dima Dorfman wrote: > Thomas Moestl writes: > > All that said, I think I might've found a happy medium. With a little > preprocessor magic in ipcs(1), I can make it maintainable without > having to export the data as a structure. Essentially, the new > function sysctlgatherstruct() takes a pointer to the structure to fill > in, the size, and an array of "vectors"; one for every field that > needs to be filled in. The latter has information on which sysctl to > use to get the information, the size, and where in the structure it > should be put. > > One thing I don't really like is that the code in the userland is now > quite a bit bigger (and, since I tried to make sysctlgatherstruct > generic so it can potentially be used in another program, it's > probably a little bigger than it could've been), but I think it's > worth it to lose the setgid bit; once that's done, it is no longer > much of a threat to security. Yeah. I've found a few more things, most by compiling with BDECFLAGS. Most do not affect functionality in any way, so they are not really important. I just thought I would mention them... > I've attached an updated patch. It incorporates all of your > suggestions, including exporting the individual fields rather than the > structure as described above. > > +SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_ANYBODY | CTLFLAG_RD, > + NULL, 0, sysctl_msqids, "", "Message queue IDs"); There are some occurances of CTLFLAG_ANYBODY still. > void > +sysctlgatherstruct(addr, size, vecarr) > + void *addr; > + size_t size; > + struct scgs_vector *vecarr; > +{ > + struct scgs_vector *xp; > + int tsiz, rv; tsiz must be a size_t. I made the same error in one of my earlier setgid removal patches and broke things on the alpha due to passing it as a pointer to sysctlbyname() ;) > + > + for (xp = vecarr; xp->sysctl != NULL; xp++) { > + assert(xp->offset <= size); > + tsiz = xp->size; > + rv = sysctlbyname(xp->sysctl, addr + xp->offset, &tsiz, > + NULL, 0); Strict CFLAGS settings will complain about void pointer arithmetic. Granted, this is nitpicky, because with gcc it will work right. > +void > +kget(idx, addr, size) > + int idx; > + void *addr; > + size_t size; > +{ > + char *symn; /* symbol name */ > + int rv, tsiz; Again, tsiz should be size_t. There will be some warnings about format arguments when using err with %d and a size_t alpha. I'm not entirely sure to what type to cast to best (my guess would be unsinged long, but you'd probably better ask bde on this). There are some occurances of this around in src/ I think, some produced by me, I'm afraid (will fix those soon ;). - thomas To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu May 24 16:53:47 2001 Delivered-To: freebsd-audit@freebsd.org Received: from chmls06.mediaone.net (chmls06.mediaone.net [24.147.1.144]) by hub.freebsd.org (Postfix) with ESMTP id 8755537B423; Thu, 24 May 2001 16:53:42 -0700 (PDT) (envelope-from tadayuki@mediaone.net) Received: from photoniii (h0005025b549e.ne.mediaone.net [24.147.67.188]) by chmls06.mediaone.net (8.11.1/8.11.1) with SMTP id f4ONrK811724; Thu, 24 May 2001 19:53:21 -0400 (EDT) Date: Thu, 24 May 2001 19:52:44 -0400 From: Tadayuki OKADA To: Noriyuki Soda Cc: i18n@FreeBSD.ORG, audit@FreeBSD.ORG, bsd-locale@hauN.org Subject: Re: CFR: ISO_* -> ISO-* locale renaming Message-Id: <20010524195244.2b678172.tadayuki@mediaone.net> In-Reply-To: <200105241348.WAA15211@srapc342.sra.co.jp> References: <20010518203702.B79058@nagual.pp.ru> <20010519050946U.tshiozak@din.or.jp> <200105182238.HAA29872@srapc342.sra.co.jp> <20010519031612.B83245@nagual.pp.ru> <200105182356.IAA00242@srapc342.sra.co.jp> <20010524033139.B76116@nagual.pp.ru> <200105241348.WAA15211@srapc342.sra.co.jp> X-Mailer: Sylpheed version 0.4.66 (GTK+ 1.2.10; i386--freebsd4.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 24 May 2001 22:48:53 +0900 (JST) Noriyuki Soda wrote: > BTW, the message from Bruno Haible, which said "the X11 name registry > stopped being maintained a few years ago", is simply false as > I supposed. You can see that the file is updated in Dec 12, 2000 via > the following URL: > http://ftp.x.org/pub/R6.6/xc/nls/locale.dir It seems he did the registration request to the unmaintained registry. :-b See: http://www.xfree86.org/pipermail/i18n/2001-May/001890.html -- Tadayuki OKADA To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu May 24 17:20:11 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id ACFAC37B423; Thu, 24 May 2001 17:19:35 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from spike.unixfreak.org (spike [63.198.170.139]) by bazooka.unixfreak.org (Postfix) with ESMTP id D1C663E28; Thu, 24 May 2001 17:19:34 -0700 (PDT) To: Thomas Moestl , audit@freebsd.org Subject: Re: Patch to remove setgid bit from ipcs(1) In-Reply-To: <20010524214918.A2640@crow.dom2ip.de>; from tmm@freebsd.org on "Thu, 24 May 2001 21:49:18 +0200" Date: Thu, 24 May 2001 17:19:34 -0700 From: Dima Dorfman Message-Id: <20010525001934.D1C663E28@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thomas Moestl writes: > On Wed, 2001/05/23 at 19:40:51 -0700, Dima Dorfman wrote: > > > > +SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_ANYBODY | CTLFLAG_RD, > > + NULL, 0, sysctl_msqids, "", "Message queue IDs"); > > > There are some occurances of CTLFLAG_ANYBODY still. > Doh, I thought I'd gotten rid of all of those.. :-/ Thanks! > [ tsiz should be size_t ] > [ void pointer arith ] Fixed. I also fixed some other warnings you didn't mention, again by compiling with BDECFLAS. Updated patch attached. Dima Dorfman dima@unixfreak.org Index: sys/kern/sysv_msg.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/sysv_msg.c,v retrieving revision 1.30 diff -u -r1.30 sysv_msg.c --- sys/kern/sysv_msg.c 2001/02/21 06:39:54 1.30 +++ sys/kern/sysv_msg.c 2001/05/25 00:15:10 @@ -1166,3 +1166,21 @@ p->p_retval[0] = msgsz; return(0); } + +static int +sysctl_msqids(SYSCTL_HANDLER_ARGS) +{ + + return (SYSCTL_OUT(req, msqids, + sizeof(struct msqid_ds) * msginfo.msgmni)); +} + +SYSCTL_DECL(_kern_ipc); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgmax, CTLFLAG_RD, &msginfo.msgmax, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgmni, CTLFLAG_RD, &msginfo.msgmni, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgmnb, CTLFLAG_RD, &msginfo.msgmnb, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgtql, CTLFLAG_RD, &msginfo.msgtql, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgssz, CTLFLAG_RD, &msginfo.msgssz, 0, ""); +SYSCTL_INT(_kern_ipc, OID_AUTO, msgseg, CTLFLAG_RD, &msginfo.msgseg, 0, "") +SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_RD, + NULL, 0, sysctl_msqids, "", "Message queue IDs"); Index: sys/kern/sysv_sem.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/sysv_sem.c,v retrieving revision 1.32 diff -u -r1.32 sysv_sem.c --- sys/kern/sysv_sem.c 2001/02/21 06:39:54 1.32 +++ sys/kern/sysv_sem.c 2001/05/25 00:15:10 @@ -28,6 +28,7 @@ static int sysvsem_modload __P((struct module *, int, void *)); static int semunload __P((void)); static void semexit_myhook __P((struct proc *p)); +static int sysctl_sema __P((SYSCTL_HANDLER_ARGS)); #ifndef _SYS_SYSPROTO_H_ struct __semctl_args; @@ -148,6 +149,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, semusz, CTLFLAG_RD, &seminfo.semusz, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, semvmx, CTLFLAG_RW, &seminfo.semvmx, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RW, &seminfo.semaem, 0, ""); +SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, CTLFLAG_RD, + NULL, 0, sysctl_sema, "", ""); #if 0 RO seminfo.semmap /* SEMMAP unused */ @@ -1065,4 +1068,12 @@ #endif suptr->un_proc = NULL; *supptr = suptr->un_next; +} + +static int +sysctl_sema(SYSCTL_HANDLER_ARGS) +{ + + return (SYSCTL_OUT(req, sema, + sizeof(struct semid_ds) * seminfo.semmni)); } Index: sys/kern/sysv_shm.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/sysv_shm.c,v retrieving revision 1.60 diff -u -r1.60 sysv_shm.c --- sys/kern/sysv_shm.c 2001/05/23 23:38:05 1.60 +++ sys/kern/sysv_shm.c 2001/05/25 00:15:10 @@ -104,6 +104,7 @@ static int shmunload __P((void)); static void shmexit_myhook __P((struct proc *p)); static void shmfork_myhook __P((struct proc *p1, struct proc *p2)); +static int sysctl_shmsegs __P((SYSCTL_HANDLER_ARGS)); /* * Tuneable values. @@ -145,6 +146,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0, ""); SYSCTL_INT(_kern_ipc, OID_AUTO, shm_use_phys, CTLFLAG_RW, &shm_use_phys, 0, ""); +SYSCTL_PROC(_kern_ipc, OID_AUTO, shmsegs, CTLFLAG_RD, + NULL, 0, sysctl_shmsegs, "", ""); static int shm_find_segment_by_key(key) @@ -740,6 +743,13 @@ shmexit_hook = NULL; shmfork_hook = NULL; return (0); +} + +static int +sysctl_shmsegs(SYSCTL_HANDLER_ARGS) +{ + + return (SYSCTL_OUT(req, shmsegs, shmalloced * sizeof(shmsegs[0]))); } static int Index: usr.bin/ipcs/ipcs.1 =================================================================== RCS file: /stl/src/FreeBSD/src/usr.bin/ipcs/ipcs.1,v retrieving revision 1.11 diff -u -r1.11 ipcs.1 --- usr.bin/ipcs/ipcs.1 2000/12/14 11:49:46 1.11 +++ usr.bin/ipcs/ipcs.1 2001/05/25 00:15:10 @@ -37,7 +37,7 @@ .Nd report System V interprocess communication facilities status .Sh SYNOPSIS .Nm -.Op Fl abcmopqstMQST +.Op Fl abcmopqstMQSTy .Op Fl C Ar system .Op Fl N Ar core .Sh DESCRIPTION @@ -101,12 +101,16 @@ Extract the name list from the specified system instead of the default .Dq Pa /kernel . +Implies +.Fl y . .It Fl M Display system information about shared memory. .It Fl N Ar core Extract values associated with the name list from the specified core instead of the default .Dq Pa /dev/kmem . +Implies +.Fl y . .It Fl Q Display system information about messages queues. .It Fl S @@ -114,6 +118,19 @@ .It Fl T Display system information about shared memory, message queues and semaphores. +.It Fl y +Use the +.Xr kvm 3 +interface instead of the +.Xr sysctl 3 +interface to extract the required information. +If +.Nm +is to operate on the running system, +using +.Xr kvm 3 +will require read privileges to +.Pa /dev/kmem . .El .Pp If none of the Index: usr.bin/ipcs/ipcs.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.bin/ipcs/ipcs.c,v retrieving revision 1.14 diff -u -r1.14 ipcs.c --- usr.bin/ipcs/ipcs.c 2000/05/01 10:49:41 1.14 +++ usr.bin/ipcs/ipcs.c 2001/05/25 00:15:10 @@ -30,11 +30,14 @@ "$FreeBSD: src/usr.bin/ipcs/ipcs.c,v 1.14 2000/05/01 10:49:41 peter Exp $"; #endif /* not lint */ +#include #include #include #include #include +#include #include +#include #include #include #include @@ -43,12 +46,21 @@ #include #include #include +#include #define _KERNEL #include #include #include #include +/* SysCtlGatherStruct structure. */ +struct scgs_vector { + const char *sysctl; + off_t offset; + size_t size; +}; + +int use_sysctl = 1; struct semid_ds *sema; struct seminfo seminfo; struct msginfo msginfo; @@ -56,26 +68,66 @@ struct shminfo shminfo; struct shmid_ds *shmsegs; +void sysctlgatherstruct __P((void *addr, size_t size, + struct scgs_vector *vec)); +void kget __P((int idx, void *addr, size_t size)); void usage __P((void)); static struct nlist symbols[] = { - {"_sema"}, + {"sema"}, #define X_SEMA 0 - {"_seminfo"}, + {"seminfo"}, #define X_SEMINFO 1 - {"_semu"}, -#define X_SEMU 2 - {"_msginfo"}, -#define X_MSGINFO 3 - {"_msqids"}, -#define X_MSQIDS 4 - {"_shminfo"}, -#define X_SHMINFO 5 - {"_shmsegs"}, -#define X_SHMSEGS 6 + {"msginfo"}, +#define X_MSGINFO 2 + {"msqids"}, +#define X_MSQIDS 3 + {"shminfo"}, +#define X_SHMINFO 4 + {"shmsegs"}, +#define X_SHMSEGS 5 {NULL} }; +#define SHMINFO_XVEC \ +X(shmmax, sizeof(int)) \ +X(shmmin, sizeof(int)) \ +X(shmmni, sizeof(int)) \ +X(shmseg, sizeof(int)) \ +X(shmall, sizeof(int)) + +#define SEMINFO_XVEC \ +X(semmap, sizeof(int)) \ +X(semmni, sizeof(int)) \ +X(semmns, sizeof(int)) \ +X(semmnu, sizeof(int)) \ +X(semmsl, sizeof(int)) \ +X(semopm, sizeof(int)) \ +X(semume, sizeof(int)) \ +X(semusz, sizeof(int)) \ +X(semvmx, sizeof(int)) \ +X(semaem, sizeof(int)) + +#define MSGINFO_XVEC \ +X(msgmax, sizeof(int)) \ +X(msgmni, sizeof(int)) \ +X(msgmnb, sizeof(int)) \ +X(msgtql, sizeof(int)) \ +X(msgssz, sizeof(int)) \ +X(msgseg, sizeof(int)) + +#define X(a, b) { "kern.ipc." #a, offsetof(TYPEC, a), (b) }, +#define TYPEC struct shminfo +struct scgs_vector shminfo_scgsv[] = { SHMINFO_XVEC { NULL } }; +#undef TYPEC +#define TYPEC struct seminfo +struct scgs_vector seminfo_scgsv[] = { SEMINFO_XVEC { NULL } }; +#undef TYPEC +#define TYPEC struct msginfo +struct scgs_vector msginfo_scgsv[] = { MSGINFO_XVEC { NULL } }; +#undef TYPEC +#undef X + static kvm_t *kd; char * @@ -135,9 +187,10 @@ int display = SHMINFO | MSGINFO | SEMINFO; int option = 0; char *core = NULL, *namelist = NULL; + char kvmoferr[_POSIX2_LINE_MAX]; /* Error buf for kvm_openfiles. */ int i; - while ((i = getopt(argc, argv, "MmQqSsabC:cN:optT")) != -1) + while ((i = getopt(argc, argv, "MmQqSsabC:cN:optTy")) != -1) switch (i) { case 'M': display = SHMTOTAL; @@ -184,39 +237,44 @@ case 't': option |= TIME; break; + case 'y': + use_sysctl = 0; + break; default: usage(); } /* - * Discard setgid privileges if not the running kernel so that bad - * guys can't print interesting stuff from kernel memory. + * If paths to the exec file or core file were specified, we + * aren't operating on the running kernel, so we can't use + * sysctl. */ if (namelist != NULL || core != NULL) - setgid(getgid()); - - if ((kd = kvm_open(namelist, core, NULL, O_RDONLY, "ipcs")) == NULL) - exit(1); + use_sysctl = 0; - switch (kvm_nlist(kd, symbols)) { - case 0: - break; - case -1: - errx(1, "unable to read kernel symbol table"); - default: + if (!use_sysctl) { + kd = kvm_openfiles(namelist, core, NULL, O_RDONLY, kvmoferr); + if (kd == NULL) + errx(1, "kvm_openfiles: %s", kvmoferr); + switch (kvm_nlist(kd, symbols)) { + case 0: + break; + case -1: + errx(1, "unable to read kernel symbol table"); + default: #ifdef notdef /* they'll be told more civilly later */ - warnx("nlist failed"); - for (i = 0; symbols[i].n_name != NULL; i++) - if (symbols[i].n_value == 0) - warnx("symbol %s not found", - symbols[i].n_name); - break; + warnx("nlist failed"); + for (i = 0; symbols[i].n_name != NULL; i++) + if (symbols[i].n_value == 0) + warnx("symbol %s not found", + symbols[i].n_name); + break; #endif + } } - if ((display & (MSGINFO | MSGTOTAL)) && - kvm_read(kd, symbols[X_MSGINFO].n_value, &msginfo, sizeof(msginfo))== sizeof(msginfo)) { - + kget(X_MSGINFO, &msginfo, sizeof(msginfo)); + if ((display & (MSGINFO | MSGTOTAL))) { if (display & MSGTOTAL) { printf("msginfo:\n"); printf("\tmsgmax: %6d\t(max characters in a message)\n", @@ -234,10 +292,12 @@ } if (display & MSGINFO) { struct msqid_ds *xmsqids; + size_t xmsqids_len; + - kvm_read(kd, symbols[X_MSQIDS].n_value, &msqids, sizeof(msqids)); - xmsqids = malloc(sizeof(struct msqid_ds) * msginfo.msgmni); - kvm_read(kd, (u_long) msqids, xmsqids, sizeof(struct msqid_ds) * msginfo.msgmni); + xmsqids_len = sizeof(struct msqid_ds) * msginfo.msgmni; + xmsqids = malloc(xmsqids_len); + kget(X_MSQIDS, xmsqids, xmsqids_len); printf("Message Queues:\n"); printf("T ID KEY MODE OWNER GROUP"); @@ -304,8 +364,9 @@ fprintf(stderr, "SVID messages facility not configured in the system\n"); } - if ((display & (SHMINFO | SHMTOTAL)) && - kvm_read(kd, symbols[X_SHMINFO].n_value, &shminfo, sizeof(shminfo))) { + + kget(X_SHMINFO, &shminfo, sizeof(shminfo)); + if ((display & (SHMINFO | SHMTOTAL))) { if (display & SHMTOTAL) { printf("shminfo:\n"); printf("\tshmmax: %7d\t(max shared memory segment size)\n", @@ -321,11 +382,11 @@ } if (display & SHMINFO) { struct shmid_ds *xshmids; + size_t xshmids_len; - kvm_read(kd, symbols[X_SHMSEGS].n_value, &shmsegs, sizeof(shmsegs)); - xshmids = malloc(sizeof(struct shmid_ds) * shminfo.shmmni); - kvm_read(kd, (u_long) shmsegs, xshmids, sizeof(struct shmid_ds) * - shminfo.shmmni); + xshmids_len = sizeof(struct shmid_ds) * shminfo.shmmni; + xshmids = malloc(xshmids_len); + kget(X_SHMSEGS, xshmids, xshmids_len); printf("Shared Memory:\n"); printf("T ID KEY MODE OWNER GROUP"); @@ -391,9 +452,11 @@ fprintf(stderr, "SVID shared memory facility not configured in the system\n"); } - if ((display & (SEMINFO | SEMTOTAL)) && - kvm_read(kd, symbols[X_SEMINFO].n_value, &seminfo, sizeof(seminfo))) { + + kget(X_SEMINFO, &seminfo, sizeof(seminfo)); + if ((display & (SEMINFO | SEMTOTAL))) { struct semid_ds *xsema; + size_t xsema_len; if (display & SEMTOTAL) { printf("seminfo:\n"); @@ -419,9 +482,9 @@ seminfo.semaem); } if (display & SEMINFO) { - kvm_read(kd, symbols[X_SEMA].n_value, &sema, sizeof(sema)); - xsema = malloc(sizeof(struct semid_ds) * seminfo.semmni); - kvm_read(kd, (u_long) sema, xsema, sizeof(struct semid_ds) * seminfo.semmni); + xsema_len = sizeof(struct semid_ds) * seminfo.semmni; + xsema = malloc(xsema_len); + kget(X_SEMA, xsema, xsema_len); printf("Semaphores:\n"); printf("T ID KEY MODE OWNER GROUP"); @@ -471,16 +534,124 @@ if (display & (SEMINFO | SEMTOTAL)) { fprintf(stderr, "SVID semaphores facility not configured in the system\n"); } - kvm_close(kd); + if (!use_sysctl) + kvm_close(kd); exit(0); } void +sysctlgatherstruct(addr, size, vecarr) + void *addr; + size_t size; + struct scgs_vector *vecarr; +{ + struct scgs_vector *xp; + size_t tsiz; + int rv; + + for (xp = vecarr; xp->sysctl != NULL; xp++) { + assert(xp->offset <= size); + tsiz = xp->size; + rv = sysctlbyname(xp->sysctl, (char *)addr + xp->offset, + &tsiz, NULL, 0); + if (rv == -1) + errx(1, "sysctlbyname: %s", xp->sysctl); + if (tsiz != xp->size) + errx(1, "%s size mismatch (expected %d, got %d)", + xp->sysctl, xp->size, tsiz); + } +} + +void +kget(idx, addr, size) + int idx; + void *addr; + size_t size; +{ + char *symn; /* symbol name */ + size_t tsiz; + int rv; + unsigned long kaddr; + const char *sym2sysctl[] = { /* symbol to sysctl name table */ + "kern.ipc.sema", + "kern.ipc.seminfo", + "kern.ipc.msginfo", + "kern.ipc.msqids", + "kern.ipc.shminfo", + "kern.ipc.shmsegs" }; + + assert((unsigned)idx <= sizeof(sym2sysctl) / sizeof(*sym2sysctl)); + if (!use_sysctl) { + symn = symbols[idx].n_name; + if (*symn == '_') + symn++; + if (symbols[idx].n_type == 0 || symbols[idx].n_value == 0) + errx(1, "symbol %s undefined", symn); + /* + * For some symbols, the value we retreieve is + * actually a pointer; since we want the actual value, + * we have to manually dereference it. + */ + switch (idx) { + case X_MSQIDS: + tsiz = sizeof(msqids); + rv = kvm_read(kd, symbols[idx].n_value, + &msqids, tsiz); + kaddr = (u_long)msqids; + break; + case X_SHMSEGS: + tsiz = sizeof(shmsegs); + rv = kvm_read(kd, symbols[idx].n_value, + &shmsegs, tsiz); + kaddr = (u_long)shmsegs; + break; + case X_SEMA: + tsiz = sizeof(sema); + rv = kvm_read(kd, symbols[idx].n_value, + &sema, tsiz); + kaddr = (u_long)sema; + break; + default: + rv = tsiz = 0; + kaddr = symbols[idx].n_value; + break; + } + if ((unsigned)rv != tsiz) + errx(1, "%s: %s", symn, kvm_geterr(kd)); + if ((unsigned)kvm_read(kd, kaddr, addr, size) != size) + errx(1, "%s: %s", symn, kvm_geterr(kd)); + } else { + switch (idx) { + case X_SHMINFO: + sysctlgatherstruct(addr, size, shminfo_scgsv); + break; + case X_SEMINFO: + sysctlgatherstruct(addr, size, seminfo_scgsv); + break; + case X_MSGINFO: + sysctlgatherstruct(addr, size, msginfo_scgsv); + break; + default: + tsiz = size; + rv = sysctlbyname(sym2sysctl[idx], addr, &tsiz, + NULL, 0); + if (rv == -1) + err(1, "sysctlbyname: %s", sym2sysctl[idx]); + if (tsiz != size) + errx(1, "%s size mismatch " + "(expected %d, got %d)", + sym2sysctl[idx], size, tsiz); + break; + } + } +} + +void usage() { fprintf(stderr, - "usage: ipcs [-abcmopqst] [-C corefile] [-N namelist]\n"); + "usage: ipcs [-abcmopqsty] [-C corefile] [-N namelist]\n"); exit(1); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri May 25 6:51: 4 2001 Delivered-To: freebsd-audit@freebsd.org Received: from critter.freebsd.dk (beachchick.freebsd.dk [212.242.34.253]) by hub.freebsd.org (Postfix) with ESMTP id ADEEC37B422; Fri, 25 May 2001 06:50:58 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.3/8.11.3) with ESMTP id f4PDoom86457; Fri, 25 May 2001 15:50:50 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: audit@freebsd.org, current@freebsd.org Subject: http://phk.freebsd.dk/patch/disk.patch From: Poul-Henning Kamp Date: Fri, 25 May 2001 15:50:50 +0200 Message-ID: <86455.990798650@critter> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Edging closer to making major device numbers a pesky compatibility detail and generally bring the new DEVFS based world order closer: 20010525 disk.patch Create a general facility for making dev_t's depend on another dev_t. The dev_depends(dev_t, dev_t) function is for tying them to each other. When destroy_dev() is called on a dev_t, all dev_t's depending on it will also be destroyed (depth first order). Rewrite the make_dev_alias() to use this dependency facility. kern/subr_disk.c Make the disk mini-layer use dependencies to make sure all relevant dev_t's are removed when the disk disappears. Make the disk mini-layer precreate some magic sub devices which the disk/slice/label code expects to be there. kern/subr_disklabel.c Remove some now unneeded variables. kern/subr_diskmbr.c Remove some ancient, commented out code. kern/subr_diskslice.c Minor cleanup. Use name from dev_t instead of dsname() Not for commit yet: Panic if the cdevsw of a non make_dev()'ed dev_t is accessed. Warn about drivers calling cdevsw_add() -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri May 25 8:48: 6 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id A864837B42C; Fri, 25 May 2001 08:47:55 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id BAA25097; Sat, 26 May 2001 01:47:51 +1000 Date: Sat, 26 May 2001 01:46:21 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Ruslan Ermilov Cc: Kris Kennaway , audit@FreeBSD.ORG Subject: Re: ping6 fixes In-Reply-To: <20010510151241.A44027@sunbay.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [I'm replying publicly only to the last reply in this thread] On Thu, 10 May 2001, Ruslan Ermilov wrote: > On Thu, May 10, 2001 at 08:52:50PM +1000, Bruce Evans wrote: > > On Thu, 10 May 2001, Ruslan Ermilov wrote: > > > > > On Wed, May 09, 2001 at 08:37:40PM -0700, Kris Kennaway wrote: > > > > On Wed, May 09, 2001 at 04:20:44AM +1000, Bruce Evans wrote: > > > > > > > > > I think I now understand the purpose of seteuid() before seteuid(). > > > > > > > > Me too. Thanks, all. > > > > > > > /me still doesn't. > > > > > > As I said, this would only be meaningful if: > > > > > > 1) we follow POSIX.1-200x > > > > I'm stll not sure about this (haven't seen POSIX.any-200x...). > > > Don't you know that the drafts are available on > www.opengroup.com/austin-l ? No I do. It's actually www.opengroup.org/somewhere (www.opengroup.com is completely different). For setuid(), draft POSIX.1-200x is essentially the same as POSIX.1.1996 except it requires _POSIX_SAVED_IDS, so we don't follow it. For seteuid(), draft POSIX.1-200x seems to be essentially the same as 4.4BSD (I didn't check this carefully). I don't see how this can work right with _POSIX_SAVED_IDS. It works right in 4.4BSD, but with _POSIX_SAVED_IDS there seems to be no way to give up the saved id except for processes with "appropriate privilege". The rationale for setuid() in Draft POSIX.1-200x has a lot to say about this problem. Its solution of adding the 4.4BSD seteuid() is incomplete IMO. > > > - and - > > > > > > 2) the process doesn't have "appropriate privilege" initially, > > > i.e., it's not setuid root (not the case here). > > > > It saves you from having to know much about the current ids. (Not a > > good reason, since you really should understand the current ids in > > set*id programs. And you really should check that set*id() succeeded...) > > > But the comment in the code assumes that the current IDs are that of > root. OK. There is no problem for setuid root programs like ping* provided they give up their privilege when their euid is root. They then have "appropriate privilge", so setuid() works right. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat May 26 12:11:47 2001 Delivered-To: freebsd-audit@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 99AE537B422; Sat, 26 May 2001 12:11:42 -0700 (PDT) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.11.3/8.11.3) id f4QJBKD48723; Sat, 26 May 2001 23:11:20 +0400 (MSD) (envelope-from ache) Date: Sat, 26 May 2001 23:11:15 +0400 From: "Andrey A. Chernov" To: Noriyuki Soda Cc: i18n@FreeBSD.ORG, audit@FreeBSD.ORG, bsd-locale@hauN.org Subject: Re: CFR: ISO_* -> ISO-* locale renaming Message-ID: <20010526231113.A48637@nagual.pp.ru> References: <20010518203702.B79058@nagual.pp.ru> <20010519050946U.tshiozak@din.or.jp> <200105182238.HAA29872@srapc342.sra.co.jp> <20010519031612.B83245@nagual.pp.ru> <200105182356.IAA00242@srapc342.sra.co.jp> <200105190022.JAA00323@srapc342.sra.co.jp> <20010524032926.A76116@nagual.pp.ru> <200105241336.WAA15144@srapc342.sra.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200105241336.WAA15144@srapc342.sra.co.jp>; from soda@sra.co.jp on Thu, May 24, 2001 at 10:36:11PM +0900 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, May 24, 2001 at 22:36:11 +0900, Noriyuki Soda wrote: > Please look at xpg4dl/FreeBSD/share/*.src of citrus repository. > Hmm. I not find any type of 'registry' there, only wild mix of old (and partially obsoleted) FreeBSD names and X11 ones. [You attempt to provide backward-compatible aliases, why? It makes programs LANG parsing and X11 locale sense harder]. It looks for me that Citrus not maintain any registry as official catalog with sources and responsible persons pointed, so we can't use it. We have only choice left between IANA and X11. I tend to agree with X11 registry. Could someone post CVS rename scheme for FreeBSD-current files? ISO_* -> ISO* is obvious, but I have no knowledge about Asian charset names. -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message