From patchwork Fri Mar 26 14:25:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 48643 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 555B6B7C09 for ; Sat, 27 Mar 2010 01:26:10 +1100 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id D9BAB4667E; Fri, 26 Mar 2010 08:26:09 -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=-9.9 required=3.8 tests=BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_NEUTRAL autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by lists.samba.org (Postfix) with ESMTP id AFCB546650 for ; Fri, 26 Mar 2010 08:25:48 -0600 (MDT) Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2QEPlNo010378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Mar 2010 10:25:47 -0400 Received: from localhost.localdomain (vpn-10-105.rdu.redhat.com [10.11.10.105]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2QEPdCg026868 for ; Fri, 26 Mar 2010 10:25:47 -0400 From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Fri, 26 Mar 2010 10:25:34 -0400 Message-Id: <1269613542-6402-12-git-send-email-jlayton@samba.org> In-Reply-To: <1269613542-6402-1-git-send-email-jlayton@samba.org> References: <1269613542-6402-1-git-send-email-jlayton@samba.org> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Subject: [linux-cifs-client] [PATCH 11/19] mount.cifs: clean up command-line options 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 From: Jeff Layton The mount.cifs command apparently tries to take a ton of command-line options. Many of these will never be passed to mount.cifs by /bin/mount. Others are more appropriately specified as mount options. In both cases, there are a lot of options in the switch statement that are not listed in the optstring, and there are characters in the optstring that are not dealt with by the switch statement. Other options are poorly wired to the rest of the code and don't actually do anything. Clean it up by removing all but the ones that are likely to ever be used. Signed-off-by: Jeff Layton --- mount.cifs.c | 99 ++-------------------------------------------------------- 1 files changed, 3 insertions(+), 96 deletions(-) diff --git a/mount.cifs.c b/mount.cifs.c index 6dfab61..fd110c7 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -1005,8 +1005,6 @@ int main(int argc, char ** argv) char *currentaddress, *nextaddress; int rc = 0; int nomtab = 0; - int uid = 0; - int gid = 0; int fakemnt = 0; int already_uppercased = 0; size_t options_size = MAX_OPTIONS_LEN; @@ -1040,20 +1038,9 @@ int main(int argc, char ** argv) parsed_info->flags = MS_MANDLOCK; /* add sharename in opts string as unc= parm */ - while ((c = getopt_long (argc, argv, "afFhilL:no:O:rsSU:vVwt:", - longopts, NULL)) != -1) { + while ((c = getopt_long (argc, argv, "?fhno:rvVw", + longopts, NULL)) != -1) { switch (c) { -/* No code to do the following options yet */ -/* case 'l': - list_with_volumelabel = 1; - break; - case 'L': - volumelabel = optarg; - break; */ -/* case 'a': - ++mount_all; - break; */ - case '?': case 'h': /* help */ rc = mount_cifs_usage(stdout); @@ -1061,22 +1048,6 @@ int main(int argc, char ** argv) case 'n': ++nomtab; break; - case 'b': -#ifdef MS_BIND - parsed_info->flags |= MS_BIND; -#else - fprintf(stderr, - "option 'b' (MS_BIND) not supported\n"); -#endif - break; - case 'm': -#ifdef MS_MOVE - parsed_info->flags |= MS_MOVE; -#else - fprintf(stderr, - "option 'm' (MS_MOVE) not supported\n"); -#endif - break; case 'o': orgoptions = strndup(optarg, MAX_OPTIONS_LEN); if (!orgoptions) { @@ -1096,75 +1067,11 @@ int main(int argc, char ** argv) case 'w': parsed_info->flags &= ~MS_RDONLY; break; - case '1': - if (isdigit(*optarg)) { - char *ep; - - uid = strtoul(optarg, &ep, 10); - if (*ep) { - fprintf(stderr, "bad uid value \"%s\"\n", optarg); - rc = EX_USAGE; - goto mount_exit; - } - } else { - struct passwd *pw; - - if (!(pw = getpwnam(optarg))) { - fprintf(stderr, "bad user name \"%s\"\n", optarg); - rc = EX_USAGE; - goto mount_exit; - } - uid = pw->pw_uid; - endpwent(); - } - break; - case '2': - if (isdigit(*optarg)) { - char *ep; - - gid = strtoul(optarg, &ep, 10); - if (*ep) { - fprintf(stderr, "bad gid value \"%s\"\n", optarg); - rc = EX_USAGE; - goto mount_exit; - } - } else { - struct group *gr; - - if (!(gr = getgrnam(optarg))) { - fprintf(stderr, "bad user name \"%s\"\n", optarg); - rc = EX_USAGE; - goto mount_exit; - } - gid = gr->gr_gid; - endpwent(); - } - break; - case 'u': - parsed_info->got_user = 1; - strlcpy(parsed_info->username, optarg, - sizeof(parsed_info->username)); - break; - case 'd': - strlcpy(parsed_info->domain, optarg, sizeof(parsed_info->domain)); - break; - case 'p': - rc = set_password(parsed_info, optarg); - if (rc) - goto mount_exit; - break; - case 'S': - rc = get_password_from_file(0, NULL, parsed_info); - if (rc) - goto mount_exit; - break; - case 't': - break; case 'f': ++fakemnt; break; default: - fprintf(stderr, "unknown mount option %c\n",c); + fprintf(stderr, "unknown command-line option: %c\n", c); rc = mount_cifs_usage(stderr); goto mount_exit; }