From owner-freebsd-audit Sun Feb 17 9:37:18 2002 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 3213837B402 for ; Sun, 17 Feb 2002 09:37:15 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 17 Feb 2002 17:37:14 +0000 (GMT) To: audit@freebsd.org Cc: Chris Johnson , Brian McDonald Subject: Syslog hangong on console. X-Request-Do: Date: Sun, 17 Feb 2002 17:37:13 +0000 From: David Malone Message-ID: <200202171737.aa59770@salmon.maths.tcd.ie> 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 There have been several complaints over the years of syslogd getting stuck and then processes hanging as they try to syslog to the console. I haven't been able to reproduce syslogd hanging, but the following patch makes the problem less critical by avoiding the hang if someone calls syslog(3) and it can't talk to syslogd. This means that you can at least su and try to sort out the problem. Can anyone see any problems with this patch? (The comment dates from the CSRG days, when the console hanging would have been somewhat more serious than now, when some bloke at the co-lo might just have tipped scroll-lock...) David. Index: syslog.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/lib/libc/gen/syslog.c,v retrieving revision 1.24 diff -u -r1.24 syslog.c --- syslog.c 1 Feb 2002 01:32:19 -0000 1.24 +++ syslog.c 8 Feb 2002 21:05:17 -0000 @@ -255,12 +255,12 @@ return; /* - * Output the message to the console; don't worry about blocking, - * if console blocks everything will. Make sure the error reported - * is the one from the syslogd failure. + * Output the message to the console; try not to block + * as a blocking console should not stop other processes. + * Make sure the error reported is the one from the syslogd failure. */ if (LogStat & LOG_CONS && - (fd = _open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { + (fd = _open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK, 0)) >= 0) { struct iovec iov[2]; struct iovec *v = iov; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Feb 17 9:44: 0 2002 Delivered-To: freebsd-audit@freebsd.org Received: from xerxes.courtesan.com (courtesan.com [206.168.103.86]) by hub.freebsd.org (Postfix) with ESMTP id 9839637B404 for ; Sun, 17 Feb 2002 09:43:55 -0800 (PST) Received: from xerxes.courtesan.com (IDENT:millert@localhost.courtesan.com [127.0.0.1]) by xerxes.courtesan.com (8.12.2/8.12.1) with ESMTP id g1HHhATG025320; Sun, 17 Feb 2002 10:43:11 -0700 (MST) Message-Id: <200202171743.g1HHhATG025320@xerxes.courtesan.com> To: David Malone Cc: audit@FreeBSD.ORG, Chris Johnson , Brian McDonald Subject: Re: Syslog hangong on console. In-reply-to: Your message of "Sun, 17 Feb 2002 17:37:13 GMT." <200202171737.aa59770@salmon.maths.tcd.ie> References: <200202171737.aa59770@salmon.maths.tcd.ie> Date: Sun, 17 Feb 2002 10:43:09 -0700 From: "Todd C. Miller" 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 Below is the diff I committed to OpenBSD some time ago. It goes a bit farther and opens all files with O_NONBLOCK and then changes to blocking writes for real files. - todd ---------------------------- revision 1.43 date: 2001/08/03 20:24:16; author: millert; state: Exp; lines: +26 -11 Open files with O_NONBLOCK but turn off non-blocking mode for non-ttys. If write(2) returns EAGAIN just ignore the error and move on. This prevents a locked terminal from causing syslogd grief. If we ever want to support logging to a fifo this will probably have to be revisited. ---------------------------- Index: syslogd.c =================================================================== RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- syslogd.c 3 Aug 2001 19:09:26 -0000 1.42 +++ syslogd.c 3 Aug 2001 20:24:16 -0000 1.43 @@ -589,7 +589,7 @@ /* log the message to the particular outputs */ if (!Initialized) { f = &consfile; - f->f_file = open(ctty, O_WRONLY, 0); + f->f_file = open(ctty, O_WRONLY|O_NONBLOCK, 0); if (f->f_file >= 0) { fprintlog(f, flags, msg); @@ -758,9 +758,16 @@ /* * Check for errors on TTY's due to loss of tty */ - if ((e == EIO || e == EBADF) && f->f_type != F_FILE) { + if (e == EAGAIN) { + /* + * Silently drop messages on blocked write. + * This can happen when logging to a locked tty. + */ + break; + } else if ((e == EIO || e == EBADF) && + f->f_type != F_FILE) { f->f_file = open(f->f_un.f_fname, - O_WRONLY|O_APPEND, 0); + O_WRONLY|O_APPEND|O_NONBLOCK, 0); if (f->f_file < 0) { f->f_type = F_UNUSED; logerror(f->f_un.f_fname); @@ -1213,17 +1220,25 @@ case '/': (void)strlcpy(f->f_un.f_fname, p, sizeof(f->f_un.f_fname)); - if ((f->f_file = open(p, O_WRONLY|O_APPEND, 0)) < 0) { + f->f_file = open(p, O_WRONLY|O_APPEND|O_NONBLOCK, 0); + if (f->f_file < 0) { f->f_type = F_UNUSED; logerror(p); break; } - if (isatty(f->f_file)) - f->f_type = F_TTY; - else + if (isatty(f->f_file)) { + if (strcmp(p, ctty) == 0) + f->f_type = F_CONSOLE; + else + f->f_type = F_TTY; + } else { f->f_type = F_FILE; - if (strcmp(p, ctty) == 0) - f->f_type = F_CONSOLE; + /* Clear O_NONBLOCK flag on f->f_file */ + if ((i = fcntl(f->f_file, F_GETFL, 0)) != -1) { + i &= ~O_NONBLOCK; + fcntl(f->f_file, F_SETFL, i); + } + } break; case '*': To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Feb 17 9:59:23 2002 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id F2A0A37B400 for ; Sun, 17 Feb 2002 09:59:19 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 17 Feb 2002 17:59:19 +0000 (GMT) To: "Todd C. Miller" Cc: audit@FreeBSD.ORG, Chris Johnson , Brian McDonald Subject: Re: Syslog hangong on console. In-reply-to: Your message of "Sun, 17 Feb 2002 10:43:09 MST." <200202171743.g1HHhATG025320@xerxes.courtesan.com> X-Request-Do: Date: Sun, 17 Feb 2002 17:59:19 +0000 From: David Malone Message-ID: <200202171759.aa61427@salmon.maths.tcd.ie> 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 > Below is the diff I committed to OpenBSD some time ago. It goes a > bit farther and opens all files with O_NONBLOCK and then changes > to blocking writes for real files. Looks potentially useful - I'll see if I can drag it into our syslogd. I dunno if you want to consider the patch I posted for OpenBSD, as it could be useful if syslogd becomes unresponsive for some other reason and the console is blocking. BTW - some people seemed to be indicating that syslogd was blocking at some stage other than the open, which is what I wasn't able to reproduce. FreeBSD's syslogd uses ttymsg() to write to the tty, which should never block. The only way I could see it happening was if isatty() lied after the tty was opened. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Feb 17 19: 4:29 2002 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 0A2DF37B417 for ; Sun, 17 Feb 2002 19:04:26 -0800 (PST) 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 OAA28647; Mon, 18 Feb 2002 14:04:05 +1100 Date: Mon, 18 Feb 2002 14:04:04 +1100 (EST) From: Bruce Evans X-X-Sender: To: David Malone Cc: "Todd C. Miller" , , Chris Johnson , Brian McDonald Subject: Re: Syslog hangong on console. In-Reply-To: <200202171759.aa61427@salmon.maths.tcd.ie> Message-ID: <20020218131837.K4236-100000@gamplex.bde.org> 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 Sun, 17 Feb 2002, David Malone wrote: > > Below is the diff I committed to OpenBSD some time ago. It goes a > > bit farther and opens all files with O_NONBLOCK and then changes > > to blocking writes for real files. > ... > BTW - some people seemed to be indicating that syslogd was blocking > at some stage other than the open, which is what I wasn't able to > reproduce. FreeBSD's syslogd uses ttymsg() to write to the tty, > which should never block. The only way I could see it happening was > if isatty() lied after the tty was opened. I sent David a large private mail which was mostly about this problem. ttymsg() may block in close(2) or _exit(2) when it clears O_NONBLOCK, which is eventually the usual case if there is a blockage downstream. (Usually the first few writes go to driver buffers and write(2) and writev(2) return successfully, but the data isn't guaranteed to go out unless you do a tcdrain(3) or equivalent, and this is not practical in ttymsg() or syslog() (since it might block).) Blocking in _exit(2) is especially bad, since it gives unkillable processes. These can cause the process table to fill up in ttymsg(). I sent David some old patches related to limiting the children. Using O_NONBLOCK without using tcdrain(3) gives a different kind of brokenness. Unfortunately, David's change to syslog.c gives a perfect example of this. The changed code is essentially: fd = open(... O_NONBLOCK); write(fd, ...); close(fd); Here the write normally immediately returns successfully after copying the data to driver buffers, even when the physical device is completely blocked. Then the close flushes the data in the driver and hardware buffers because O_NONBLOCK is still set at close time. I "fixed" this in FreeBSD. In 4.4BSD-Lite, ttylclose() checks the IO_NDELAY flag to decide whether to flush the buffers. This is nonsense, since the flags passed to ttylclose are the open/fcntl flags, not those flags converted to IO_* flags. FreeBSD's ttylclose() checks FNONBLOCK instead. The result of the fix is that if the close is the last-close, code like the above drops all the data if the device is completely blocked, and writes only a few bytes even if the device is completely unblocked (only thise bytes that have reached their destination before the close flushes the buffers are sure to have gone out) Without the fix, the behaviour is worse: processes may block forever in close(2) or _exit(2) despite use of O_NONBLOCK. Perhaps multiple processess for the same device -- there are some races that may permit first-opens to complete while last-closes are blocked. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Feb 18 1:55:57 2002 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 1C8F737B402 for ; Mon, 18 Feb 2002 01:55:54 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 18 Feb 2002 09:55:53 +0000 (GMT) To: Bruce Evans Cc: "Todd C. Miller" , audit@FreeBSD.ORG, Chris Johnson , Brian McDonald Subject: Re: Syslog hangong on console. In-reply-to: Your message of "Mon, 18 Feb 2002 14:04:04 +1100." <20020218131837.K4236-100000@gamplex.bde.org> X-Request-Do: Date: Mon, 18 Feb 2002 09:55:51 +0000 From: David Malone Message-ID: <200202180955.aa37926@salmon.maths.tcd.ie> 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 > Using O_NONBLOCK without using tcdrain(3) gives a different kind of > brokenness. Unfortunately, David's change to syslog.c gives a perfect > example of this. I just explained this to Bruce in private mail. I also confused Todd, so I think I should probably explain the patch more carefully. What Bruce says about data getting lost on close with O_NONBLOCK is true, but in this case this is close to what we want... Usually, syslog messages are just written to a socket connected to syslogd. However, if this doesn't work out then syslog itself tries to write an error to the console directly (ttymsg is not used here). The bit of syslog(3) that I am patching is only this last attempt to get the message to /dev/console if everything else has failed. Before it attempts to do this it has already: 1) Made sure the socket to syslogd is open, 2) tried to log the message, 3) if that fails disconnect and reconnect to syslogd and try to send again, If all this fails, then it tries to open /dev/console, which may block indefinitely. If it blocks indefinitely, then they system is more-or-less useless because you cannot run any commands which log messages (like su). My hope is that if people can su while syslogd is confused, then someone will be able to run gdb on syslogd and find out what it is doing. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Feb 20 4: 0:16 2002 Delivered-To: freebsd-audit@freebsd.org Received: from straylight.ringlet.net (discworld.nanolink.com [217.75.135.248]) by hub.freebsd.org (Postfix) with SMTP id 690D537B404 for ; Wed, 20 Feb 2002 04:00:04 -0800 (PST) Received: (qmail 88308 invoked by uid 1000); 20 Feb 2002 11:39:33 -0000 Date: Wed, 20 Feb 2002 13:39:33 +0200 From: Peter Pentchev To: Maxim Sobolev Cc: audit@FreeBSD.org Subject: [CFR] pkg_install/pkg_create fixes Message-ID: <20020220133933.D334@straylight.oblivion.bg> Mail-Followup-To: Maxim Sobolev , audit@FreeBSD.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="da4uJneut+ArUgXk" 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 --da4uJneut+ArUgXk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, Today, while debugging a ftp/curl port install problem, I got the crazy idea of trying a 'make -dl' to see exactly what and why was executed. Of course, this was stupid, since make -dl outputs all the debug info on stdout, which kind of messes up the output of the package-depends and similar targets :) However, in the meantime, this uncovered two minor problems with pkg_create(1). The first one was a skipped pointer initialization, possibly resulting later in an uninitialized pointer dereference. When the depedencies' list is built, empty strings are skipped - but space for them is still allocated, and the corresponding pointers are not changed at all. This leads straight into a segfault when sortdeps() tries to 'sort' those uninitialized strings. The second one is a minor sortdeps() problem - an off-by-one in looping over the dependencies' list. Fortunately, the resulting null pointer dereference is done in chkifdepends()'s snprintf(), which does not blow up, but simply produces a nonexistent package dir name, so the situation here is somewhat mitigated. Still, I don't think it would hurt to fix the off-by-one :) How to repeat? Simple: cd /usr/ports/ftp/curl && make -dl clean all install You will easily notice the first problem, when sortdeps() hits the uninit'd pointer resulting from `make -dl package-depends` containing two spaces in a row. The second problem was the result of my misplacing the fault for the first one. Thanks for reading this far :) G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 This inert sentence is my body, but my soul is alive, dancing in the sparks= of your brain. Index: src/usr.sbin/pkg_install/create/perform.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/perform.c,v retrieving revision 1.62 diff -u -r1.62 perform.c --- src/usr.sbin/pkg_install/create/perform.c 17 Jan 2002 10:51:39 -0000 1.= 62 +++ src/usr.sbin/pkg_install/create/perform.c 20 Feb 2002 11:31:58 -0000 @@ -130,7 +130,10 @@ cp =3D strsep(&Pkgdeps, " \t\n"); if (*cp) deps[i] =3D cp; + else + i--; } + ndeps =3D i; deps[ndeps] =3D NULL; =20 sortdeps(deps); Index: src/usr.sbin/pkg_install/lib/deps.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/usr.sbin/pkg_install/lib/deps.c,v retrieving revision 1.5 diff -u -r1.5 deps.c --- src/usr.sbin/pkg_install/lib/deps.c 10 Oct 2001 06:58:42 -0000 1.5 +++ src/usr.sbin/pkg_install/lib/deps.c 20 Feb 2002 11:16:15 -0000 @@ -41,7 +41,10 @@ int i, j, loop_cnt; int err_cnt =3D 0; =20 - for (i =3D 0; pkgs[i]; i++) { + if (pkgs[0] =3D=3D NULL) + return (0); + + for (i =3D 0; pkgs[i + 1] !=3D NULL; i++) { /* * Check to see if any other package in pkgs[i+1:] depends * on pkgs[i] and swap those two packages if so. --da4uJneut+ArUgXk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjxzivUACgkQ7Ri2jRYZRVOlWwCeLLMMO6aoFlAyuou7uxxrOBr7 7QQAnRqsFi10uAPBRG3VZdryJ5f+Qrgm =eWi7 -----END PGP SIGNATURE----- --da4uJneut+ArUgXk-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Feb 20 5:36:38 2002 Delivered-To: freebsd-audit@freebsd.org Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15]) by hub.freebsd.org (Postfix) with ESMTP id 7954D37B404 for ; Wed, 20 Feb 2002 05:36:31 -0800 (PST) Received: from ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5]) by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id PAA65877; Wed, 20 Feb 2002 15:36:05 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from vega.vega.com (h93.229.dialup.iptcom.net [212.9.229.93]) by ipcard.iptcom.net (8.9.3/8.9.3) with ESMTP id PAA60856; Wed, 20 Feb 2002 15:35:58 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vega.vega.com (8.11.6/8.11.3) with ESMTP id g1KDZOX25438; Wed, 20 Feb 2002 15:35:24 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Message-ID: <3C73A639.11790DE9@FreeBSD.org> Date: Wed, 20 Feb 2002 15:35:53 +0200 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en,uk,ru MIME-Version: 1.0 To: Peter Pentchev Cc: audit@FreeBSD.org Subject: Re: [CFR] pkg_install/pkg_create fixes References: <20020220133933.D334@straylight.oblivion.bg> Content-Type: text/plain; charset=koi8-r 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 Peter Pentchev wrote: > > Hi, > > Today, while debugging a ftp/curl port install problem, I got the crazy > idea of trying a 'make -dl' to see exactly what and why was executed. > Of course, this was stupid, since make -dl outputs all the debug info > on stdout, which kind of messes up the output of the package-depends > and similar targets :) However, in the meantime, this uncovered two > minor problems with pkg_create(1). > > The first one was a skipped pointer initialization, possibly resulting > later in an uninitialized pointer dereference. When the depedencies' list > is built, empty strings are skipped - but space for them is still allocated, > and the corresponding pointers are not changed at all. This leads straight > into a segfault when sortdeps() tries to 'sort' those uninitialized strings. > > The second one is a minor sortdeps() problem - an off-by-one in looping over > the dependencies' list. Fortunately, the resulting null pointer dereference > is done in chkifdepends()'s snprintf(), which does not blow up, but simply > produces a nonexistent package dir name, so the situation here is somewhat > mitigated. Still, I don't think it would hurt to fix the off-by-one :) > > How to repeat? Simple: cd /usr/ports/ftp/curl && make -dl clean all install > You will easily notice the first problem, when sortdeps() hits the uninit'd > pointer resulting from `make -dl package-depends` containing two spaces > in a row. The second problem was the result of my misplacing the fault > for the first one. > > Thanks for reading this far :) The first patch is OK, but I do not see any point in the second one, because sortdeps() assumes that there are at least 2 packages in the **pkgs list, otherwise sorting is meaningless. However, if you feel like adding this anti foot shooting device - do it, though correct check at the beginning of the procedure should be as follows: if (pkgs[0] == NULL || pkgs[1] == NULL) return (0); -Maxim > > G'luck, > Peter > > -- > Peter Pentchev roam@ringlet.net roam@FreeBSD.org > PGP key: http://people.FreeBSD.org/~roam/roam.key.asc > Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 > This inert sentence is my body, but my soul is alive, dancing in the sparks of your brain. > > Index: src/usr.sbin/pkg_install/create/perform.c > =================================================================== > RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/perform.c,v > retrieving revision 1.62 > diff -u -r1.62 perform.c > --- src/usr.sbin/pkg_install/create/perform.c 17 Jan 2002 10:51:39 -0000 1.62 > +++ src/usr.sbin/pkg_install/create/perform.c 20 Feb 2002 11:31:58 -0000 > @@ -130,7 +130,10 @@ > cp = strsep(&Pkgdeps, " \t\n"); > if (*cp) > deps[i] = cp; > + else > + i--; > } > + ndeps = i; > deps[ndeps] = NULL; > > sortdeps(deps); > Index: src/usr.sbin/pkg_install/lib/deps.c > =================================================================== > RCS file: /home/ncvs/src/usr.sbin/pkg_install/lib/deps.c,v > retrieving revision 1.5 > diff -u -r1.5 deps.c > --- src/usr.sbin/pkg_install/lib/deps.c 10 Oct 2001 06:58:42 -0000 1.5 > +++ src/usr.sbin/pkg_install/lib/deps.c 20 Feb 2002 11:16:15 -0000 > @@ -41,7 +41,10 @@ > int i, j, loop_cnt; > int err_cnt = 0; > > - for (i = 0; pkgs[i]; i++) { > + if (pkgs[0] == NULL) > + return (0); > + > + for (i = 0; pkgs[i + 1] != NULL; i++) { > /* > * Check to see if any other package in pkgs[i+1:] depends > * on pkgs[i] and swap those two packages if so. > > ---------------------------------------------------------------------- > Part 1.2Type: application/pgp-signature To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Feb 22 14:25:25 2002 Delivered-To: freebsd-audit@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id D9BD137B417; Fri, 22 Feb 2002 14:25:10 -0800 (PST) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 91B445343; Fri, 22 Feb 2002 23:25:08 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: arch@freebsd.org Subject: OpenPAM From: Dag-Erling Smorgrav Date: 22 Feb 2002 23:25:07 +0100 Message-ID: Lines: 15 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 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 OpenPAM Cantaloupe is now available at along with an integration patch for FreeBSD-CURRENT. Since the two previous releases have solicited absolutely no feedback other than to point out a broken link on the project's web page, I assume that everybody is happy with the code, and that nobody will object when I import it into CVS and ditch Linux-PAM later this weekend. DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Feb 23 9:10:45 2002 Delivered-To: freebsd-audit@freebsd.org Received: from heechee.tobez.org (254.adsl0.ryv.worldonline.dk [213.237.10.254]) by hub.freebsd.org (Postfix) with ESMTP id F17CF37B402 for ; Sat, 23 Feb 2002 09:10:40 -0800 (PST) Received: by heechee.tobez.org (Postfix, from userid 1001) id EB474A93C; Sat, 23 Feb 2002 18:10:30 +0100 (CET) Date: Sat, 23 Feb 2002 18:10:30 +0100 From: Anton Berezin To: audit@FreeBSD.org Subject: [CFR] a small fix of gethostbyname2() Message-ID: <20020223171030.GA29155@heechee.tobez.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.24i 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 The bug: $ HOSTALIASES=~/.hostaliases; export HOSTALIASES $ cd ~ $ cat >.hostaliases somehost somehost.fqdn.bla ^D $ ssh somehost # <-- works $ ping somehost # <-- does no work The problem: Programs that use gethostbyname2() and do not initialize resolver themselves, will lead to the resolver operating uninitialized. Even if (I have not looked) the resolver is initialized at some point later, some parts, like HOSTALIASES support, do not work as they should. The fix: Index: gethostnamadr.c =================================================================== RCS file: /home/ncvs/src/lib/libc/net/gethostnamadr.c,v retrieving revision 1.19 diff -u -r1.19 gethostnamadr.c --- gethostnamadr.c 13 Aug 2001 14:06:25 -0000 1.19 +++ gethostnamadr.c 23 Feb 2002 16:56:46 -0000 @@ -84,6 +84,11 @@ NS_NIS_CB(_nis_gethostbyname, NULL) /* force -DHESIOD */ { 0 } }; + + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (NULL); + } rval = nsdispatch((void *)&hp, dtab, NSDB_HOSTS, "gethostbyname", default_src, name, type); Similarly, for -stable: Index: gethostnamadr.c =================================================================== RCS file: /home/ncvs/src/lib/libc/net/gethostnamadr.c,v retrieving revision 1.15.2.2 diff -u -r1.15.2.2 gethostnamadr.c --- gethostnamadr.c 5 Mar 2001 10:40:42 -0000 1.15.2.2 +++ gethostnamadr.c 23 Feb 2002 16:59:11 -0000 @@ -140,6 +140,11 @@ struct hostent *hp = 0; int nserv = 0; + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (NULL); + } + if (!service_done) init_services(); Would anybody mind if I commit it? Cheers, =Anton. -- | Anton Berezin | FreeBSD: The power to serve | | catpipe Systems ApS _ _ |_ | http://www.FreeBSD.org | | tobez@catpipe.net (_(_|| | tobez@FreeBSD.org | | +45 7021 0050 | Private: tobez@tobez.org | To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message