From owner-freebsd-bugs Fri Aug 9 06:30:04 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id GAA08585 for bugs-outgoing; Fri, 9 Aug 1996 06:30:04 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id GAA08578; Fri, 9 Aug 1996 06:30:02 -0700 (PDT) Resent-Date: Fri, 9 Aug 1996 06:30:02 -0700 (PDT) Resent-Message-Id: <199608091330.GAA08578@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, andy@sarc.city.ac.uk Received: from cripplecock.sarc.city.ac.uk ([138.40.91.253]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id GAA08171 for ; Fri, 9 Aug 1996 06:23:39 -0700 (PDT) Received: (from andy@localhost) by cripplecock.sarc.city.ac.uk (8.6.12/8.6.12) id OAA17333; Fri, 9 Aug 1996 14:23:27 +0100 Message-Id: <199608091323.OAA17333@cripplecock.sarc.city.ac.uk> Date: Fri, 9 Aug 1996 14:23:27 +0100 From: Andy Whitcroft Reply-To: andy@sarc.city.ac.uk To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/1483: rdist(1) bug and fix Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 1483 >Category: bin >Synopsis: rdist(1) server silently exits verifying symlinks >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 9 06:30:01 PDT 1996 >Last-Modified: >Originator: Andy Whitcroft >Organization: Andy. -- Andy Whitcroft EMail: andy@cs.city.ac.uk (MIME) (PGP) Systems Support, Informatics, Tel: +44 71 477 8550, Fax: 8587 City University, London, UK. URL: http://web.cs.city.ac.uk/finger/andy >Release: FreeBSD 2.1-STABLE i386 and later >Environment: >Description: rdist(1) server will silently disconnect from the originator when asked to verify a symlink which is either incorrect or not a symlink. rdist is able to install the link correctly if not verifying. >How-To-Repeat: Attempt to rdist a symlink over an existing directory of the same name. All futher communication with the server is impossible. >Fix: The problem is caused by the badnew2 bail out code which closes fd 'f'. In the case of a symlink installation f is not initialised at all and tends to be 0 so closing the client/server channel. --- server.c.orig Fri Jul 12 09:03:00 1996 +++ server.c Fri Aug 9 14:08:47 1996 @@ -697,7 +697,7 @@ int type; { register char *cp; - int f, mode, opts, wrerr, olderrno; + int f = -1, mode, opts, wrerr, olderrno; off_t i, size; time_t mtime; struct stat stb; @@ -922,7 +922,7 @@ note("%s: utimes failed %s: %s\n", host, new, strerror(errno)); if (fchog(f, new, owner, group, mode) < 0) { -badnew2: (void) close(f); +badnew2: (void) if (f != -1) close(f); (void) unlink(new); return; } >Audit-Trail: >Unformatted: