Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Aug 1996 14:23:27 +0100
From:      Andy Whitcroft <andy@sarc.city.ac.uk>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/1483: rdist(1) bug and fix
Message-ID:  <199608091323.OAA17333@cripplecock.sarc.city.ac.uk>
Resent-Message-ID: <199608091330.GAA08578@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608091323.OAA17333>