From owner-svn-src-all@freebsd.org Tue Oct 30 15:43:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4F9A10EBD21; Tue, 30 Oct 2018 15:43:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A4596BB44; Tue, 30 Oct 2018 15:43:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B7D71F6CD; Tue, 30 Oct 2018 15:43:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9UFh72W023744; Tue, 30 Oct 2018 15:43:07 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9UFh727023743; Tue, 30 Oct 2018 15:43:07 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201810301543.w9UFh727023743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 30 Oct 2018 15:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339920 - head/contrib/tzcode/stdtime X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/contrib/tzcode/stdtime X-SVN-Commit-Revision: 339920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 15:43:07 -0000 Author: trasz Date: Tue Oct 30 15:43:06 2018 New Revision: 339920 URL: https://svnweb.freebsd.org/changeset/base/339920 Log: Remove useless call to access(2) from tzcode. Quoting OpenBSD: > Remove doaccess variable and access(2) call since this interfers with > applications like zdump(8) because pledge(2) doesn't allow access(2) to > /usr/share/zoneinfo. > > millert@ better described why this call can go away: > > "This looks like an attempt to do access checks based on the real uid instead > of the effective uid. Basically for setuid programs we don't want to allow a > user to set TZ to a path they should not be able to otherwise access. > > However, we already have a check for issetugid() above so I think the doaccess > bits can just be removed and we can rely on open()." > > After discussion with tb@, deraadt@ and millert@, this was also OK'ed by them Reviewed by: imp Obtained from: OpenBSD MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17701 Modified: head/contrib/tzcode/stdtime/localtime.c Modified: head/contrib/tzcode/stdtime/localtime.c ============================================================================== --- head/contrib/tzcode/stdtime/localtime.c Tue Oct 30 15:39:33 2018 (r339919) +++ head/contrib/tzcode/stdtime/localtime.c Tue Oct 30 15:43:06 2018 (r339920) @@ -398,7 +398,6 @@ register const int doextend; if (name == NULL && (name = TZDEFAULT) == NULL) return -1; { - int doaccess; struct stat stab; /* ** Section 4.9.1 of the C standard says that @@ -415,8 +414,7 @@ register const int doextend; if (name[0] == ':') ++name; - doaccess = name[0] == '/'; - if (!doaccess) { + if (name[0] != '/') { if ((p = TZDIR) == NULL) { free(fullname); return -1; @@ -428,16 +426,7 @@ register const int doextend; (void) strcpy(fullname, p); (void) strcat(fullname, "/"); (void) strcat(fullname, name); - /* - ** Set doaccess if '.' (as in "../") shows up in name. - */ - if (strchr(name, '.') != NULL) - doaccess = TRUE; name = fullname; - } - if (doaccess && access(name, R_OK) != 0) { - free(fullname); - return -1; } if ((fid = _open(name, OPEN_MODE)) == -1) { free(fullname);