From patchwork Sun Mar 21 19:20:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 48230 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by ozlabs.org (Postfix) with ESMTP id 60B26B7CEF for ; Mon, 22 Mar 2010 06:20:50 +1100 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 16CF0AD23B; Sun, 21 Mar 2010 13:20:51 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=3.8 tests=AWL, BAYES_00, NO_MORE_FUNN, SPF_PASS autolearn=no version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.120]) by lists.samba.org (Postfix) with ESMTP id 5B6E8AD1B8 for ; Sun, 21 Mar 2010 13:20:30 -0600 (MDT) X-Authority-Analysis: v=1.0 c=1 a=Ws0qtvR4qDcA:10 a=20KFwNOVAAAA:8 a=qrQphbOqkhpp7dS6cIIA:9 a=Yh-iYd-Ri5eRn8p5MBIeI160A4IA:4 a=jEp0ucaQiEUA:10 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:53423] helo=mail.poochiereds.net) by cdptpa-oedge01.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id D4/AF-07392-C7176AB4; Sun, 21 Mar 2010 19:20:28 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id B017958060; Sun, 21 Mar 2010 15:20:27 -0400 (EDT) From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Sun, 21 Mar 2010 15:20:23 -0400 Message-Id: <1269199227-21446-7-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: References: Subject: [linux-cifs-client] [PATCH 06/10] mount.cifs: make check_mountpoint a noop for non-legacy builds X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org Now that we chdir() to the mountpoint, the checks in that function are pointless. Just make it a noop for non-legacy setuid builds. Signed-off-by: Jeff Layton --- mount.cifs.c | 31 ++++++++----------------------- 1 files changed, 8 insertions(+), 23 deletions(-) diff --git a/mount.cifs.c b/mount.cifs.c index 84167f3..4631310 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -115,31 +115,10 @@ char * domain_name = NULL; char * prefixpath = NULL; const char *cifs_fstype = "cifs"; -/* - * If an unprivileged user is doing the mounting then we need to ensure - * that the entry is in /etc/fstab. - */ +#if CIFS_LEGACY_SETUID_CHECK static int check_mountpoint(const char *progname, char *mountpoint) { - int err; - struct stat statbuf; - - /* does mountpoint exist and is it a directory? */ - err = stat(".", &statbuf); - if (err) { - fprintf(stderr, "%s: failed to stat %s: %s\n", progname, - mountpoint, strerror(errno)); - return EX_USAGE; - } - - if (!S_ISDIR(statbuf.st_mode)) { - fprintf(stderr, "%s: %s is not a directory!", progname, - mountpoint); - return EX_USAGE; - } - -#if CIFS_LEGACY_SETUID_CHECK /* do extra checks on mountpoint for legacy setuid behavior */ if (!getuid() || geteuid()) return 0; @@ -155,10 +134,16 @@ check_mountpoint(const char *progname, char *mountpoint) mountpoint); return EX_USAGE; } -#endif /* CIFS_LEGACY_SETUID_CHECK */ return 0; } +#else /* CIFS_LEGACY_SETUID_CHECK */ +static int +check_mountpoint(const char *progname, char *mountpoint) +{ + return 0; +} +#endif /* CIFS_LEGACY_SETUID_CHECK */ #if CIFS_DISABLE_SETUID_CHECK static int