Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Aug 2006 12:40:18 GMT
From:      "Andrey V. Elsukov" <bu7cher@yandex.ru>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/101660: restore(8) does not preserve uid and gid on short symlinks
Message-ID:  <200608161240.k7GCeI90063394@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/101660; it has been noted by GNATS.

From: "Andrey V. Elsukov" <bu7cher@yandex.ru>
To: bug-followup@FreeBSD.org, minear@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



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