From owner-cvs-all Tue Dec 3 11: 7:32 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0168737B401 for ; Tue, 3 Dec 2002 11:07:31 -0800 (PST) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 30D3B43EC2 for ; Tue, 3 Dec 2002 11:07:30 -0800 (PST) (envelope-from nate@rootlabs.com) Received: (qmail 7527 invoked by uid 1000); 3 Dec 2002 19:07:30 -0000 Date: Tue, 3 Dec 2002 11:07:30 -0800 (PST) From: Nate Lawson To: Kirk McKusick Cc: cvs-all@freebsd.org, cvs-committers@freebsd.org Subject: Re: cvs commit: src/sbin/dump dump.8 main.c In-Reply-To: <20021203182524.BA85337B4A9@hub.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Minor comments, thx for doing this. Does the creation of snapshots follow symlinks? What happens if an attacker creates /.dump_snapshot in /tmp and then root dumps /tmp? On Tue, 3 Dec 2002, Kirk McKusick wrote: > mckusick 2002/12/03 10:21:09 PST > > Modified files: > sbin/dump dump.8 main.c > Log: > Add the `L' option to dump to notify it that it is dumping a > live filesystem. To obtain a consistent dump image, dump takes > a snapshot of the filesystem and then does a dump of the snapshot. > The snapshot is removed when the dump is complete. > > --- src/sbin/dump/main.c:1.42 Tue Nov 26 18:18:56 2002 > +++ src/sbin/dump/main.c Tue Dec 3 10:21:09 2002 > > + if ((diskfd = open(snapname, O_RDONLY)) < 0) { > + unlink(snapname); > + errx(X_STARTUP, "Cannot open %s: %s\n", > + snapname, strerror(errno)); > + } > + unlink(snapname); If call to open was before if, snapname could be unconditionally unlinked before if() and the err case would be smaller. > (void)strcpy(spcl.c_label, "none"); > (void)gethostname(spcl.c_host, NAMELEN); > spcl.c_level = level - '0'; > spcl.c_type = TS_TAPE; > - if (!Tflag) > - getdumptime(); /* /etc/dumpdates snarfed */ > > if (spcl.c_date == 0) { > tmsg = "the epoch\n"; > @@ -323,6 +373,9 @@ > tmsg = ctime(&t); > } > msg("Date of this level %c dump: %s", level, tmsg); > + > + if (!Tflag) > + getdumptime(); /* /etc/dumpdates snarfed */ > if (spcl.c_ddate == 0) { > tmsg = "the epoch\n"; > } else { I don't see what this does? -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message