bin/101660: restore(8) does not preserve uid and gid on short symlinks

Andrey V. Elsukov bu7cher at yandex.ru
Wed Aug 16 12:42:37 UTC 2006


The following reply was made to PR bin/101660; it has been noted by GNATS.

From: "Andrey V. Elsukov" <bu7cher at yandex.ru>
To: bug-followup at FreeBSD.org, minear at securecomputing.com
Cc:  
Subject: Re: bin/101660: restore(8) does not preserve uid and gid on short
 symlinks
Date: Wed, 16 Aug 2006 16:28:41 +0400

 Can you try the following patch:
 
 Index: tape.c
 ===================================================================
 RCS file: /mnt/cvs/ncvs/src/sbin/restore/tape.c,v
 retrieving revision 1.44
 diff -u -r1.44 tape.c
 --- tape.c	29 May 2005 15:57:00 -0000	1.44
 +++ tape.c	16 Aug 2006 12:18:00 -0000
 @@ -554,6 +554,7 @@
   	mode_t mode;
   	struct timeval mtimep[2], ctimep[2];
   	struct entry *ep;
 +	u_int32_t luid, lgid;
 
   	curfile.name = name;
   	curfile.action = USING;
 @@ -593,6 +594,8 @@
   	case IFLNK:
   		lnkbuf[0] = '\0';
   		pathlen = 0;
 +		luid = curfile.uid;
 +		lgid = curfile.gid;
   		getfile(xtrlnkfile, xtrlnkskip);
   		if (pathlen == 0) {
   			vprintf(stdout,
 @@ -600,7 +603,7 @@
   			return (GOOD);
   		}
   		if (linkit(lnkbuf, name, SYMLINK) == GOOD) {
 -			(void) lchown(name, curfile.uid, curfile.gid);
 +			(void) lchown(name, luid, lgid);
   			(void) lchmod(name, mode);
   			(void) lutimes(name, ctimep);
   			(void) lutimes(name, mtimep);
 
 -- 
 WBR, Andrey V. Elsukov


More information about the freebsd-bugs mailing list