From owner-freebsd-audit Wed Jan 22 9:55:39 2003 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1A63037B401 for ; Wed, 22 Jan 2003 09:55:37 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1BA2343ED8 for ; Wed, 22 Jan 2003 09:55:36 -0800 (PST) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-b161.otenet.gr [212.205.244.169]) by mailsrv.otenet.gr (8.12.6/8.12.6) with ESMTP id h0MHtV58022306 for ; Wed, 22 Jan 2003 19:55:32 +0200 (EET) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.6/8.12.6) with ESMTP id h0MHtVxu002108 for ; Wed, 22 Jan 2003 19:55:31 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.12.6/8.12.6/Submit) id h0MHtUPj002107 for freebsd-audit@FreeBSD.ORG; Wed, 22 Jan 2003 19:55:30 +0200 (EET) (envelope-from keramida@freebsd.org) Date: Wed, 22 Jan 2003 19:55:30 +0200 From: Giorgos Keramidas To: freebsd-audit@freebsd.org Subject: Re: hopefully, a fix for an old uncompress(1) bug Message-ID: <20030122175530.GA2026@gothmog.gr> References: <20030106062309.GA37109@gothmog.gr> <20030106080949.GA382@straylight.oblivion.bg> <20030106082154.GE1094@gothmog.gr> <20030107040216.GB4071@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030107040216.GB4071@gothmog.gr> 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 have tested the patch in the post quoted below and it seems to work around the bugs in uncompress(1). What do I need to do to get approval for commiting this or a "no, this is not good because [foo]" type of review? - Giorgos On 2003-01-07 06:02, Giorgos Keramidas wrote: > [...] > The first problem is that decompress() tries to open the output file > first and then notice that its input file (foo.Z) fails to zopen(). > When this happens, it promptly goes ahead and tries to unlink `foo' > which is supposed to be the outfile. If a file happens to be named > `foo' it is unconditionally removed. This is the behavior shown > below: > > % ls -l > -rw-rw-r-- 1 giorgos wheel - 0 Jan 6 08:04 lala > % uncompress -f lala > uncompress: lala.Z: No such file or directory > % ls -l > % > > Reversing the order of `in' and `out' file opening fixes this problem, > but there is one more which is a bit more difficult to notice. > > The second problem. If the input file of decompress() does exist but > is not a valid .Z file the zopen() call will work fine only to fail > later on when we try to fread() data from it. This is shown below: > > $ cp /COPYRIGHT lala.Z > $ touch lala > $ ls -l lala* > -rw-rw-r-- 1 giorgos giorgos - 0 Jan 7 05:42 lala > -r--r--r-- 1 giorgos giorgos - 4735 Jan 7 05:42 lala.Z > $ ./uncompress -f lala > uncompress: lala.Z: Inappropriate file type or format > $ ls -l lala* > -r--r--r-- 1 giorgos giorgos - 4735 Jan 7 05:42 lala.Z > $ > > I tried to solve this, by attempting to successfully read at least one > byte of data from the .Z file before even attempting to open the > output file. I also changed all the `goto err' parts before the > output file is opened to avoid unlinking() a file that we haven't > previously fopen()ed. > > Hopefully, this fixes both the problems :-/ > > %%% > Index: compress.c > =================================================================== > RCS file: /home/ncvs/src/usr.bin/compress/compress.c,v > retrieving revision 1.20 > diff -u -r1.20 compress.c > --- compress.c 28 Jul 2002 15:32:17 -0000 1.20 > +++ compress.c 7 Jan 2003 03:57:26 -0000 > @@ -300,14 +300,9 @@ > isreg = oreg = !exists || S_ISREG(sb.st_mode); > > ifp = ofp = NULL; > - if ((ofp = fopen(out, "w")) == NULL) { > - cwarn("%s", out); > - return; > - } > - > if ((ifp = zopen(in, "r", bits)) == NULL) { > cwarn("%s", in); > - goto err; > + return; > } > if (stat(in, &sb)) { > cwarn("%s", in); > @@ -315,6 +310,18 @@ > } > if (!S_ISREG(sb.st_mode)) > isreg = 0; > + > + /* > + * Try to read the first few uncompressed bytes from the input file > + * before blindly truncating the output file. > + */ > + if ((nr = fread(buf, 1, sizeof(buf), ifp)) == 0 || > + (ofp = fopen(out, "w")) == NULL || > + (nr != 0 && fwrite(buf, 1, nr, ofp) != nr)) { > + cwarn("%s", out); > + (void)fclose(ifp); > + return; > + } > > while ((nr = fread(buf, 1, sizeof(buf), ifp)) != 0) > if (fwrite(buf, 1, nr, ofp) != nr) { > %%% To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jan 22 19:40:54 2003 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 86D9937B401 for ; Wed, 22 Jan 2003 19:40:52 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A0A443F1E for ; Wed, 22 Jan 2003 19:40:51 -0800 (PST) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-b192.otenet.gr [212.205.244.200]) by mailsrv.otenet.gr (8.12.6/8.12.6) with ESMTP id h0N3eX58019757 for ; Thu, 23 Jan 2003 05:40:42 +0200 (EET) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.6/8.12.6) with ESMTP id h0N3eM7I000902 for ; Thu, 23 Jan 2003 05:40:22 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.12.6/8.12.6/Submit) id h0N3eMaK000901 for freebsd-audit@freebsd.org; Thu, 23 Jan 2003 05:40:22 +0200 (EET) (envelope-from keramida@freebsd.org) Date: Thu, 23 Jan 2003 05:40:22 +0200 From: Giorgos Keramidas To: freebsd-audit@freebsd.org Subject: (fwd) bin/47196: ipfw won't format correctly output from 'ipfw show' command Message-ID: <20030123034022.GA587@gothmog.gr> 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 Hi folks, I've sent the following 2 days ago to ipfw@ but received no reply. Does anyone feel like testing/reviewing or committing this? This change should be all we need to fix & close PR bin/47196 :-) ----- forwarded message ----- Date: Tue, 21 Jan 2003 03:33:55 +0200 From: Giorgos Keramidas Subject: bin/47196: ipfw won't format correctly output from 'ipfw show' command To: ipfw@freebsd.org The attached patch changes ipfw2 to print packet and byte counts with a wider format, that fixes the problem described in PR bin/47196. Do you think it's ok to commit this to CURRENT? --- patch start --- Index: ipfw2.c =================================================================== RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v retrieving revision 1.21 diff -u -r1.21 ipfw2.c --- ipfw2.c 12 Jan 2003 03:31:10 -0000 1.21 +++ ipfw2.c 21 Jan 2003 01:30:03 -0000 @@ -823,7 +823,7 @@ printf("%05u ", rule->rulenum); if (do_acct) - printf("%10qu %10qu ", rule->pcnt, rule->bcnt); + printf("%20qu %20qu ", rule->pcnt, rule->bcnt); if (do_time) { char timestr[30]; @@ -1212,7 +1212,7 @@ return; } - printf("%05d %10qu %10qu (%ds)", + printf("%05d %20qu %20qu (%ds)", d->rulenum, d->pcnt, d->bcnt, d->expire); switch (d->dyn_type) { case O_LIMIT_PARENT: --- patch end --- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jan 23 8:10:52 2003 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 87E0E37B405; Thu, 23 Jan 2003 08:10:49 -0800 (PST) Received: from relay1.macomnet.ru (relay1.macomnet.ru [195.128.64.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4952343F18; Thu, 23 Jan 2003 08:10:47 -0800 (PST) (envelope-from maxim@FreeBSD.org) Received: from news1.macomnet.ru (news1.macomnet.ru [195.128.64.14]) by relay1.macomnet.ru (8.11.6/8.11.6) with ESMTP id h0NGAka9573524; Thu, 23 Jan 2003 19:10:46 +0300 (MSK) Date: Thu, 23 Jan 2003 19:10:46 +0300 (MSK) From: Maxim Konovalov To: Giorgos Keramidas Cc: freebsd-audit@FreeBSD.org, "" , "" Subject: Re: (fwd) bin/47196: ipfw won't format correctly output from 'ipfw show' command In-Reply-To: <20030123034022.GA587@gothmog.gr> Message-ID: <20030123184329.T77556@news1.macomnet.ru> References: <20030123034022.GA587@gothmog.gr> 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 Hi Giorgos, On 05:40+0200, Jan 23, 2003, Giorgos Keramidas wrote: > Hi folks, > > I've sent the following 2 days ago to ipfw@ but received no reply. > Does anyone feel like testing/reviewing or committing this? This > change should be all we need to fix & close PR bin/47196 :-) Formatting was broken in rev. 1.103 ipfw.c in -CURRENT and ipfw2 in -CURRENT and -STABLE inherited the bug later. I think we should rever this part of rev. 1.103 of ipfw.c in ipfw2.c: Index: ipfw/ipfw2.c =================================================================== RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v retrieving revision 1.21 diff -u -r1.21 ipfw2.c --- ipfw/ipfw2.c 12 Jan 2003 03:31:10 -0000 1.21 +++ ipfw/ipfw2.c 23 Jan 2003 16:07:09 -0000 @@ -823,7 +823,7 @@ printf("%05u ", rule->rulenum); if (do_acct) - printf("%10qu %10qu ", rule->pcnt, rule->bcnt); + printf("%*qu %*qu ", rule->pcnt, rule->bcnt); if (do_time) { char timestr[30]; @@ -1212,7 +1212,7 @@ return; } - printf("%05d %10qu %10qu (%ds)", + printf("%05d %*qu %*qu (%ds)", d->rulenum, d->pcnt, d->bcnt, d->expire); switch (d->dyn_type) { case O_LIMIT_PARENT: %%% > ----- forwarded message ----- > > Date: Tue, 21 Jan 2003 03:33:55 +0200 > From: Giorgos Keramidas > Subject: bin/47196: ipfw won't format correctly output from 'ipfw show' command > To: ipfw@freebsd.org > > The attached patch changes ipfw2 to print packet and byte counts with > a wider format, that fixes the problem described in PR bin/47196. Do > you think it's ok to commit this to CURRENT? > > --- patch start --- > Index: ipfw2.c > =================================================================== > RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v > retrieving revision 1.21 > diff -u -r1.21 ipfw2.c > --- ipfw2.c 12 Jan 2003 03:31:10 -0000 1.21 > +++ ipfw2.c 21 Jan 2003 01:30:03 -0000 > @@ -823,7 +823,7 @@ > printf("%05u ", rule->rulenum); > > if (do_acct) > - printf("%10qu %10qu ", rule->pcnt, rule->bcnt); > + printf("%20qu %20qu ", rule->pcnt, rule->bcnt); > > if (do_time) { > char timestr[30]; > @@ -1212,7 +1212,7 @@ > return; > } > > - printf("%05d %10qu %10qu (%ds)", > + printf("%05d %20qu %20qu (%ds)", > d->rulenum, d->pcnt, d->bcnt, d->expire); > switch (d->dyn_type) { > case O_LIMIT_PARENT: > --- patch end --- > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-audit" in the body of the message > -- Maxim Konovalov, maxim@macomnet.ru, maxim@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jan 23 11:53:47 2003 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E1DDC37B401; Thu, 23 Jan 2003 11:53:45 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA13243EB2; Thu, 23 Jan 2003 11:53:44 -0800 (PST) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-a119.otenet.gr [212.205.215.119]) by mailsrv.otenet.gr (8.12.6/8.12.6) with ESMTP id h0NJrc3g015792; Thu, 23 Jan 2003 21:53:41 +0200 (EET) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.6/8.12.6) with ESMTP id h0NJraqN001485; Thu, 23 Jan 2003 21:53:36 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.12.6/8.12.6/Submit) id h0NJrZrE001484; Thu, 23 Jan 2003 21:53:36 +0200 (EET) (envelope-from keramida@freebsd.org) Date: Thu, 23 Jan 2003 21:53:35 +0200 From: Giorgos Keramidas To: Maxim Konovalov Cc: freebsd-audit@freebsd.org, des@freebsd.org, luigi@freebsd.org Subject: Re: (fwd) bin/47196: ipfw won't format correctly output from 'ipfw show' command Message-ID: <20030123195335.GC678@gothmog.gr> References: <20030123034022.GA587@gothmog.gr> <20030123184329.T77556@news1.macomnet.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030123184329.T77556@news1.macomnet.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 2003-01-23 19:10, Maxim Konovalov wrote: > On 05:40+0200, Jan 23, 2003, Giorgos Keramidas wrote: > > I've sent the following 2 days ago to ipfw@ but received no reply. > > Does anyone feel like testing/reviewing or committing this? This > > change should be all we need to fix & close PR bin/47196 :-) > > Formatting was broken in rev. 1.103 ipfw.c in -CURRENT and ipfw2 > in -CURRENT and -STABLE inherited the bug later. > > I think we should rever this part of rev. 1.103 of ipfw.c in ipfw2.c: Not quite. See inline comments. > Index: ipfw/ipfw2.c > =================================================================== > RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v > retrieving revision 1.21 > diff -u -r1.21 ipfw2.c > --- ipfw/ipfw2.c 12 Jan 2003 03:31:10 -0000 1.21 > +++ ipfw/ipfw2.c 23 Jan 2003 16:07:09 -0000 > @@ -823,7 +823,7 @@ > printf("%05u ", rule->rulenum); > > if (do_acct) > - printf("%10qu %10qu ", rule->pcnt, rule->bcnt); > + printf("%*qu %*qu ", rule->pcnt, rule->bcnt); The %*qu specifier needs two arguments. The first is the length, and the second should be rule->pcnt. The same for the second one. You'd have to use something like: printf("%*qu %*qu ", rule_width, rule->pcnt, byte_width, rule->bcnt); > - printf("%05d %10qu %10qu (%ds)", > + printf("%05d %*qu %*qu (%ds)", > d->rulenum, d->pcnt, d->bcnt, d->expire); Ditto. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jan 24 9: 2:45 2003 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ADAE537B401; Fri, 24 Jan 2003 09:02:41 -0800 (PST) Received: from relay1.macomnet.ru (relay1.macomnet.ru [195.128.64.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 170A343F3F; Fri, 24 Jan 2003 09:02:40 -0800 (PST) (envelope-from maxim@FreeBSD.org) Received: from news1.macomnet.ru (news1.macomnet.ru [195.128.64.14]) by relay1.macomnet.ru (8.11.6/8.11.6) with ESMTP id h0OH2cj9632235; Fri, 24 Jan 2003 20:02:38 +0300 (MSK) Date: Fri, 24 Jan 2003 20:02:38 +0300 (MSK) From: Maxim Konovalov To: Giorgos Keramidas Cc: freebsd-audit@FreeBSD.org, "" , "" Subject: Re: (fwd) bin/47196: ipfw won't format correctly output from 'ipfw show' command In-Reply-To: <20030123195335.GC678@gothmog.gr> Message-ID: <20030124194701.P19393@news1.macomnet.ru> References: <20030123034022.GA587@gothmog.gr> <20030123184329.T77556@news1.macomnet.ru> <20030123195335.GC678@gothmog.gr> 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 On 21:53+0200, Jan 23, 2003, Giorgos Keramidas wrote: > On 2003-01-23 19:10, Maxim Konovalov wrote: > > On 05:40+0200, Jan 23, 2003, Giorgos Keramidas wrote: > > > I've sent the following 2 days ago to ipfw@ but received no reply. > > > Does anyone feel like testing/reviewing or committing this? This > > > change should be all we need to fix & close PR bin/47196 :-) > > > > Formatting was broken in rev. 1.103 ipfw.c in -CURRENT and ipfw2 > > in -CURRENT and -STABLE inherited the bug later. > > > > I think we should rever this part of rev. 1.103 of ipfw.c in ipfw2.c: > > Not quite. See inline comments. Yes, you are right. Revert 1.103 a little more. Note we always show packets/bytes for dynamic rules. Index: ipfw2.c =================================================================== RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v retrieving revision 1.21 diff -u -r1.21 ipfw2.c --- ipfw2.c 12 Jan 2003 03:31:10 -0000 1.21 +++ ipfw2.c 24 Jan 2003 16:34:48 -0000 @@ -802,7 +802,7 @@ } static void -show_ipfw(struct ip_fw *rule) +show_ipfw(struct ip_fw *rule, int pcwidth, int bcwidth) { static int twidth = 0; int l; @@ -823,7 +823,7 @@ printf("%05u ", rule->rulenum); if (do_acct) - printf("%10qu %10qu ", rule->pcnt, rule->bcnt); + printf("%*qu %*qu ", pcwidth, rule->pcnt, bcwidth, rule->bcnt); if (do_time) { char timestr[30]; @@ -1202,7 +1202,7 @@ } static void -show_dyn_ipfw(ipfw_dyn_rule *d) +show_dyn_ipfw(ipfw_dyn_rule *d, int pcwidth, int bcwidth) { struct protoent *pe; struct in_addr a; @@ -1212,8 +1212,8 @@ return; } - printf("%05d %10qu %10qu (%ds)", - d->rulenum, d->pcnt, d->bcnt, d->expire); + printf("%05d %*qu %*qu (%ds)", d->rulenum, pcwidth, d->pcnt, bcwidth, + d->bcnt, d->expire); switch (d->dyn_type) { case O_LIMIT_PARENT: printf(" PARENT %d", d->count); @@ -1557,7 +1557,7 @@ ipfw_dyn_rule *dynrules, *d; void *lim, *data = NULL; - int n, nbytes, nstat, ndyn; + int bcwidth, n, nbytes, nstat, ndyn, pcwidth, width; int exitval = EX_OK; int lac; char **lav; @@ -1607,16 +1607,43 @@ n = (void *)r - data; ndyn = (nbytes - n) / sizeof *dynrules; + /* if showing stats, figure out column widths ahead of time */ + bcwidth = pcwidth = 0; + if (do_acct) { + for (n = 0, r = data; n < nstat; + n++, r = (void *)r + RULESIZE(r)) { + /* packet counter */ + width = snprintf(NULL, 0, "%qu", r->pcnt); + if (width > pcwidth) + pcwidth = width; + + /* byte counter */ + width = snprintf(NULL, 0, "%qu", r->bcnt); + if (width > bcwidth) + bcwidth = width; + } + } + if (do_dynamic && ndyn) { + for (n = 0, d = dynrules; n < ndyn; n++, d++) { + width = snprintf(NULL, 0, "%qu", d->pcnt); + if (width > pcwidth) + pcwidth = width; + + width = snprintf(NULL, 0, "%qu", d->bcnt); + if (width > bcwidth) + bcwidth = width; + } + } /* if no rule numbers were specified, list all rules */ if (ac == 0) { for (n = 0, r = data; n < nstat; n++, r = (void *)r + RULESIZE(r) ) - show_ipfw(r); + show_ipfw(r, pcwidth, bcwidth); if (do_dynamic && ndyn) { printf("## Dynamic rules (%d):\n", ndyn); for (n = 0, d = dynrules; n < ndyn; n++, d++) - show_dyn_ipfw(d); + show_dyn_ipfw(d, pcwidth, bcwidth); } goto done; } @@ -1636,7 +1663,7 @@ if (r->rulenum > rnum) break; if (r->rulenum == rnum) { - show_ipfw(r); + show_ipfw(r, pcwidth, bcwidth); seen = 1; } } @@ -1659,7 +1686,7 @@ if (d->rulenum > rnum) break; if (d->rulenum == rnum) - show_dyn_ipfw(d); + show_dyn_ipfw(d, pcwidth, bcwidth); } } } @@ -3221,7 +3248,7 @@ if (getsockopt(s, IPPROTO_IP, IP_FW_ADD, rule, &i) == -1) err(EX_UNAVAILABLE, "getsockopt(%s)", "IP_FW_ADD"); if (!do_quiet) - show_ipfw(rule); + show_ipfw(rule, 10, 10); } static void %%% -- Maxim Konovalov, maxim@macomnet.ru, maxim@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jan 24 10: 0:57 2003 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A403537B401; Fri, 24 Jan 2003 10:00:55 -0800 (PST) Received: from freebsd.org.ru (sweet.etrust.ru [194.84.67.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 75B8243F13; Fri, 24 Jan 2003 10:00:54 -0800 (PST) (envelope-from osa@freebsd.org.ru) Received: by freebsd.org.ru (Postfix, from userid 1000) id 5FD8A97; Fri, 24 Jan 2003 21:00:52 +0300 (MSK) Date: Fri, 24 Jan 2003 21:00:52 +0300 From: "Sergey A. Osokin" To: Maxim Konovalov Cc: Giorgos Keramidas , freebsd-audit@FreeBSD.org, des@FreeBSD.org, luigi@FreeBSD.org Subject: Re: (fwd) bin/47196: ipfw won't format correctly output from 'ipfw show' command Message-ID: <20030124180052.GG57203@freebsd.org.ru> Reply-To: osa@FreeBSD.org.ru References: <20030123034022.GA587@gothmog.gr> <20030123184329.T77556@news1.macomnet.ru> <20030123195335.GC678@gothmog.gr> <20030124194701.P19393@news1.macomnet.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030124194701.P19393@news1.macomnet.ru> User-Agent: Mutt/1.4i 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 Fri, Jan 24, 2003 at 08:02:38PM +0300, Maxim Konovalov wrote: > On 21:53+0200, Jan 23, 2003, Giorgos Keramidas wrote: > > > On 2003-01-23 19:10, Maxim Konovalov wrote: > > > On 05:40+0200, Jan 23, 2003, Giorgos Keramidas wrote: > > > > I've sent the following 2 days ago to ipfw@ but received no reply. > > > > Does anyone feel like testing/reviewing or committing this? This > > > > change should be all we need to fix & close PR bin/47196 :-) > > > > > > Formatting was broken in rev. 1.103 ipfw.c in -CURRENT and ipfw2 > > > in -CURRENT and -STABLE inherited the bug later. > > > > > > I think we should rever this part of rev. 1.103 of ipfw.c in ipfw2.c: > > > > Not quite. See inline comments. > > Yes, you are right. Revert 1.103 a little more. Note we always show > packets/bytes for dynamic rules. > > Index: ipfw2.c > =================================================================== > RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v > retrieving revision 1.21 > diff -u -r1.21 ipfw2.c > --- ipfw2.c 12 Jan 2003 03:31:10 -0000 1.21 > +++ ipfw2.c 24 Jan 2003 16:34:48 -0000 > @@ -802,7 +802,7 @@ > } > > @@ -1557,7 +1557,7 @@ > ipfw_dyn_rule *dynrules, *d; > > void *lim, *data = NULL; > - int n, nbytes, nstat, ndyn; > + int bcwidth, n, nbytes, nstat, ndyn, pcwidth, width; ^^^^^^^^^^^^^^^^^^ Alphabetic: bcwidth, n, nbytes, ndyn, nstat, pcwidth, width; > int exitval = EX_OK; > int lac; > char **lav; -- Rgdz, /"\ ASCII RIBBON CAMPAIGN Sergey Osokin aka oZZ, \ / AGAINST HTML MAIL http://ozz.pp.ru/ X AND NEWS / \ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jan 24 12:45:54 2003 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 57D6B37B401; Fri, 24 Jan 2003 12:45:53 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 30B7143F3F; Fri, 24 Jan 2003 12:45:52 -0800 (PST) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-a116.otenet.gr [212.205.215.116]) by mailsrv.otenet.gr (8.12.6/8.12.6) with ESMTP id h0OKjhBb010787; Fri, 24 Jan 2003 22:45:43 +0200 (EET) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.6/8.12.6) with ESMTP id h0OKjgd9049392; Fri, 24 Jan 2003 22:45:42 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.12.6/8.12.6/Submit) id h0OKYVI1049030; Fri, 24 Jan 2003 22:34:31 +0200 (EET) (envelope-from keramida@freebsd.org) Date: Fri, 24 Jan 2003 22:34:31 +0200 From: Giorgos Keramidas To: Maxim Konovalov Cc: freebsd-audit@freebsd.org, des@freebsd.org, luigi@freebsd.org Subject: Re: (fwd) bin/47196: ipfw won't format correctly output from 'ipfw show' command Message-ID: <20030124203431.GA48536@gothmog.gr> References: <20030123034022.GA587@gothmog.gr> <20030123184329.T77556@news1.macomnet.ru> <20030123195335.GC678@gothmog.gr> <20030124194701.P19393@news1.macomnet.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030124194701.P19393@news1.macomnet.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 2003-01-24 20:02, Maxim Konovalov wrote: > Yes, you are right. Revert 1.103 a little more. Note we always show > packets/bytes for dynamic rules. This looks fine and works great here: cohen# ./ipfw show 00030 2204558 10260392610 allow tcp from 127.0.0.1 to 127.0.0.1 keep-state 65535 1248 102784 deny ip from any to any ## Dynamic rules (5): 00030 114513 209251936 (300s) STATE tcp 127.0.0.1 49605 <-> 127.0.0.1 19 cohen# Note that the first line contains a rule whose bytecount has exceeded 9,999,999,999 and needs more than 10 digits to print properly :-) Please commit it and close PR bin/47196 if nobody else objects or has comments and/or corrections. - Giorgos To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Jan 25 0:41:18 2003 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F3FC437B401; Sat, 25 Jan 2003 00:41:16 -0800 (PST) Received: from mail.rpi.edu (mail.rpi.edu [128.113.2.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id A119C43F13; Sat, 25 Jan 2003 00:41:07 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.12.1/8.12.1) with ESMTP id h0P8f0Im143986; Sat, 25 Jan 2003 03:41:00 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: Date: Sat, 25 Jan 2003 03:40:58 -0500 To: freebsd-audit@freebsd.org From: Garance A Drosihn Subject: Changes to pw/pw_user.c Cc: freebsd-current@freebsd.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) 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 sent this message off about 12 hours ago, and I have not seen it appear anywhere. Since then I have received plenty of other messages on the mailing lists (including messages I sent after I sent this one). So, I'm resending this one... On Jan 24/2003, Max Khon wrote to freebsd-current: >hi, there! > >Can we enable using '$' in usernames in pw? >The patch is attached. > >Other variant is to enable using '$' only at end of user name. Here is a patch which allows a '$' as the last character of a userid or a group name. Technically this is based on a patch that Terry Lambert wrote, but by the time I was done with it I imagine it's not recognizable. This has been tested on i386 and sparc64 (beast.freebsd.org seems to be down right now, so I can't do a test-compile on alpha). This version of the patch only changes the pw_checkname() routine, and also includes the previous version of pw_checkname() so you can see how both the old and new routines behave on any given value. This also improves the error messages, and (IMO) makes the routine a lot easier to follow. Assuming there are no objections to this, I plan to rip out everything that's between the #ifdef/endif's of TESTING_PW, and commit the rest to -current sometime next week. I have no plans to MFC this change, but I'll also do that if people want it MFC'ed. Please look it over, and maybe run it through some tests, and let me know of any feedback to it. (Should this print out some kind of warning message that using '$' is generally not a good idea?) Instead of including the patch in my message (which I did the first time), I've put it up at: http://people.freebsd.org/~gad/pw/pw_user-c.diff -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message