From owner-freebsd-stable@FreeBSD.ORG Thu Jan 27 15:27:49 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 446A816A4CE; Thu, 27 Jan 2005 15:27:49 +0000 (GMT) Received: from dastardly.newsbastards.org.72.27.172.IN-addr.ARPA.NOSPAM.dyndns.dk (84-72-25-249.dclient.hispeed.ch [84.72.25.249]) by mx1.FreeBSD.org (Postfix) with ESMTP id 36B8B43D46; Thu, 27 Jan 2005 15:27:46 +0000 (GMT) (envelope-from bounce@NOSPAM.dyndns.dk) Received: from Mail.NOSPAM.DynDNS.dK (ipv6.NOSPAM.dyndns.dk [IPv6:2002:5448:19f9:0:206:28ff:fed8:8dcf]) (8.13.2/8.11.6-SPAMMERS-DeLiGHt) with ESMTP id j0RFROQ2000999NO); Thu, 27 Jan 2005 16:27:29 +0100 (CET) (envelope-from bounce@NOSPAM.dyndns.dk) Received: (from beer@localhost) by Mail.NOSPAM.DynDNS.dK (8.13.2/FNORD) id j0RFRML1000998; Thu, 27 Jan 2005 16:27:23 +0100 (CET) (envelope-from bounce@NOSPAM.dyndns.dk) Date: Thu, 27 Jan 2005 16:27:23 +0100 (CET) Message-Id: <200501271527.j0RFRML1000998@Mail.NOSPAM.DynDNS.dK> X-Authentication-Warning: localhost.newsbastards.org.72.27.172.IN-addr.A: beer set sender to bounce@NOSPAM.dyndns.dk using -f X-Authentication-Warning: localhost.newsbastards.org.72.27.172.IN-addr.A: Processed from queue /tmp X-Authentication-Warning: localhost.newsbastards.org.72.27.172.IN-addr.A: Processed by beer with -C /etc/mail/sendmail.cf-LOCAL From: Barry Bouwsma References: <1105317580.22779.12.camel@wednesday.pricegrabber.com> <20050110132233.GA5374@lum.celabo.org> <41E2D492.9020302@elischer.org> <200501121456.j0CEu3J2088923@Mail.NOSPAM.DynDNS.dK> <41E57E85.5040102@elischer.org> To: FreeBSD Barnyard and Stable Mail-Followup-To: FreeBSD Barnyard and Stable , cc: "Jacques A. Vidrine" cc: Julian Elischer Subject: Re: update for 4.11 Security Officer-supported branches X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Barry Bouwsma List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2005 15:27:49 -0000 [sorry for the delay in this reply; I can't remember if I already sent a response...] On Wed, 12 Jan 2005 11:46:13 -0800, Julian Elischer wrote: > >>While a 4.12 will PROBABLY not happen, I do plan on continued MFCs of > >>important > >>changes to RELENG_4 as I do not envision my custommers moving to 5.x > >Thanks, Julian, and I'd like to contemplate getting a few of my MFC > >One of these things I've found very handy is the `mount' option > >introduced in 5.x that allows one to specify with -F an alternate > >to /etc/fstab to be used. > we can probably MFC anything that doesn't break any existing ABI. I'll plead ignorance and stupidity. Would an ABI change be something like what I needed to do in another project, changing - int (* seek) (data_source_t *source, long offset, int whence); + int (* seek) (data_source_t *source, ogg_int64_t offset, int whence); in order to fix largefile support, when this is something expected to be called by userland programs? I'll guess yes. > >In order to adopt this change, I had to add to libc in 4.x as well > >as butcher the `mount' code. Does such a change stand a chance of > >being added to 4.x, or are infrastructure changes required this way, > >like to libc, off-limits outside my own hive of personal hackery? > libc is not usually a target in a legacy branch. Addign a new function to it > may be ok in some cases but probably best to not do it. I'll leave the call to you, or anyone else who knows better than I. As far as I know, it's not easily possible to implement the `-F' mount option without this libc change, but I haven't played with it as a MFC did the job for me. The diff below is based on what was -current when this option was introduced, and is fairly clean, as follows -- the diff needed for `mount' itself would follow later, if this diff to RELENG_4 libc does not raise serious objections: --- /stand/FreeBSD4-src/source-hacks/lib/libc/gen/fstab.c-ORIG Fri Jan 28 00:06:15 2000 +++ /stand/FreeBSD4-src/source-hacks/lib/libc/gen/fstab.c Tue Jul 27 10:30:39 2004 @@ -57,11 +57,40 @@ static FILE *_fs_fp; static struct fstab _fs_fstab; static int LineNo = 0; +static char *path_fstab; +static char fstab_path[PATH_MAX]; +static int fsp_set = 0; static void error __P((int)); static void fixfsfile __P((void)); static int fstabscan __P((void)); +void +setfstab(const char *file) +{ + + if (file == NULL) { + path_fstab = _PATH_FSTAB; + } else { + strncpy(fstab_path, file, PATH_MAX); + fstab_path[PATH_MAX - 1] = '\0'; + path_fstab = fstab_path; + } + fsp_set = 1; + + return; +} + +const char * +getfstab (void) +{ + + if (fsp_set) + return (path_fstab); + else + return (_PATH_FSTAB); +} + static void fixfsfile() { @@ -229,7 +258,13 @@ LineNo = 0; return(1); } - if ((_fs_fp = fopen(_PATH_FSTAB, "r")) != NULL) { + if (fsp_set == 0) { + if (issetugid()) + setfstab(NULL); + else + setfstab(getenv("PATH_FSTAB")); + } + if ((_fs_fp = fopen(path_fstab, "r")) != NULL) { LineNo = 0; return(1); } @@ -244,6 +279,8 @@ (void)fclose(_fs_fp); _fs_fp = NULL; } + + fsp_set = 0; } static void @@ -254,7 +291,7 @@ char num[30]; (void)_write(STDERR_FILENO, "fstab: ", 7); - (void)_write(STDERR_FILENO, _PATH_FSTAB, sizeof(_PATH_FSTAB) - 1); + (void)_write(STDERR_FILENO, path_fstab, strlen(path_fstab)); (void)_write(STDERR_FILENO, ":", 1); sprintf(num, "%d: ", LineNo); (void)_write(STDERR_FILENO, num, strlen(num)); I'm pretty sure (but not positive) that these diffs do not have tentacles afflicting other code, and should be safe to apply to a virginal RELENG_4 system without major breakage. thanks barry bouwsma